diff --git a/render_and_play.py b/render_and_play.py index eacfd91..bca12dc 100644 --- a/render_and_play.py +++ b/render_and_play.py @@ -1,5 +1,5 @@ +import os import pathlib -import re import subprocess import sys @@ -18,8 +18,13 @@ if not str(win_abc_file_path).lower().endswith(".abc"): lin_abc_file_path = lin_root / win_abc_file_path.relative_to(win_root) out_file_name = lin_abc_file_path.name.rsplit(".", 1)[0] + ".mid" -output_path = lin_abc_file_path.parent / out_file_name +lin_output_path = lin_abc_file_path.parent / out_file_name +win_output_path = win_abc_file_path.parent / out_file_name -command = f"abc2midi {lin_abc_file_path.as_posix()} -o {output_path.as_posix()}" +if win_output_path.exists(): + win_output_path.unlink() + +command = f"abc2midi {lin_abc_file_path.as_posix()} -o {lin_output_path.as_posix()}" print("Command:", command) r = subprocess.run([r"wsl"], input=command.encode()) +os.system(str(win_output_path))