From 69021195a1e74cd1b50cd77e5d76116e09094cb4 Mon Sep 17 00:00:00 2001 From: ThePython <87204246+ThePython10110@users.noreply.github.com> Date: Sun, 22 Oct 2023 16:36:21 -0700 Subject: [PATCH] Switched to `subprocess.call` --- batch_convert.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/batch_convert.py b/batch_convert.py index e231d88..3f080ec 100644 --- a/batch_convert.py +++ b/batch_convert.py @@ -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)")