Skip to content

Commit

Permalink
Switched to subprocess.call
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePython10110 authored Oct 22, 2023
1 parent 83a3bdd commit 6902119
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions batch_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,11 @@ def list_files(startpath):
except FileExistsError:
pass

# Convert files with https://github.com/thepython10110/midiflip
try:
print("Attempting to use midiflip on path")
print(subprocess.run(["midiflip", "-i", (output if output else ".") + "/MIDI/**/*.midi", "-o", (output if output else ".") + "/FlippedMIDI", "-f"], shell=True, capture_output = True)) #Flip all MIDI files, using my fork of https://github.com/1j01/midiflip
except:
print("Midiflip may not be on PATH.")
try:
print(subprocess.run([".\\node_modules\\.bin\\midiflip", "-i", (output if output else ".") + "/MIDI/**/*.midi", "-o", (output if output else ".") + "/FlippedMIDI", "-f"], shell = True, capture_output = True)) #Flip all MIDI files, using my fork of https://github.com/1j01/midiflip
except:
print("Midiflip may not be installed. Install it with NodeJS:\n\nnpm install https://github.com/thepython10110/midiflip\n\nIt should install to %UserProfile%\\node_modules\\.bin\\midiflip.cmd")
subprocess.call(["midiflip", "-i", (output if output else ".") + "/MIDI/**/*.midi", "-o", (output if output else ".") + "/FlippedMIDI", "-f"], shell = True))
except FileNotFoundError:
subprocess.call([".\\node_modules\\.bin\\midiflip", "-i", (output if output else ".") + "/MIDI/**/*.midi", "-o", (output if output else ".") + "/FlippedMIDI", "-f"], shell = True))

if not args.auto:
input("\n(Press ENTER to exit)")

0 comments on commit 6902119

Please sign in to comment.