From b41698ab65c0501c56b805c3c50592cbebfb06ad Mon Sep 17 00:00:00 2001 From: Cuan Date: Thu, 17 Mar 2022 15:23:45 -0400 Subject: [PATCH] Filename handling fixes & rg2sc is now run after each file is converted --- bin/flac2pod | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bin/flac2pod b/bin/flac2pod index 3917799..8ab20fa 100755 --- a/bin/flac2pod +++ b/bin/flac2pod @@ -37,18 +37,20 @@ def create_destination(): def scan_destination_convert_mp3(): for _file in source_directories[1]: - print(_file) if not Path(f"{_file.replace(path.expanduser(source), path.expanduser(destination))}.mp3").is_file(): - system("ffmpeg -i '" + _file.replace("'", "\\'") + - ".flac' -c:v copy -ab 320k -map_metadata 0 -id3v2_version 3 '" + - _file.replace(path.expanduser(source), path.expanduser(destination)).replace("'", "\\'") + ".mp3'") + _file_s = _file.replace(' ', '\\ ').replace("'", "\\'") + '.flac' + _file_d = _file.replace(path.expanduser(source), + path.expanduser(destination)).replace(' ', '\\ ').replace("'", "\\'") + '.mp3' + print(f"\n\u001b[38;5;0;48;5;15mConverting {_file_s} to {_file_d}...\u001b[0m\n") + system(f"ffmpeg -i {_file_s} -c:v copy -ab 320k -map_metadata 0 -id3v2_version 3 {_file_d}") + rg2sc(_file_d) -def rg2sc(): +def rg2sc(_file): if argument.__contains__('-f'): - system(f"{rg2sc} -f {destination}") + system(f"rg2sc -f {_file}") else: - system(f"{rg2sc} {destination}") + system(f"rg2sc {_file}") # program start sequence @@ -72,4 +74,3 @@ if destination.endswith('/'): source_directories = scan_source() create_destination() scan_destination_convert_mp3() -rg2sc()