diff --git a/render_and_play.py b/render_and_play.py new file mode 100644 index 0000000..eacfd91 --- /dev/null +++ b/render_and_play.py @@ -0,0 +1,25 @@ +import pathlib +import re +import subprocess +import sys + + +win_root = pathlib.Path(r"C:\Users\louis\GitKraken\dottes") +lin_root = pathlib.Path("~/dottes") + +try: + win_abc_file_path = pathlib.Path(sys.argv[1]) +except IndexError: + win_abc_file_path = pathlib.Path(input()) + +if not str(win_abc_file_path).lower().endswith(".abc"): + input("Doesn't look like an abc file.") + exit(1) + +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 + +command = f"abc2midi {lin_abc_file_path.as_posix()} -o {output_path.as_posix()}" +print("Command:", command) +r = subprocess.run([r"wsl"], input=command.encode())