From c221e439a4683ede34635b517a7d6a66c77e1f17 Mon Sep 17 00:00:00 2001 From: Ronan Date: Tue, 21 Jan 2020 10:35:31 +0100 Subject: [PATCH] Fixes from @mavieth (#308) --- scdl/scdl.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/scdl/scdl.py b/scdl/scdl.py index ad3a9d9..c8b1072 100755 --- a/scdl/scdl.py +++ b/scdl/scdl.py @@ -484,8 +484,10 @@ def download_original_file(track, title): newfilename = filename[:-4] + ".flac" new = shlex.quote(newfilename) old = shlex.quote(filename) - logger.debug("ffmpeg -i {0} {1} -loglevel fatal".format(old, new)) - subprocess.call("ffmpeg -i {0} {1} -loglevel fatal".format(old, new)) + + commands = ['ffmpeg', '-i', old, new, '-loglevel', 'fatal'] + logger.debug("Commands: {}".format(commands)) + subprocess.call(commands) os.remove(filename) filename = newfilename @@ -508,19 +510,15 @@ def get_track_m3u8(track): def download_hls_mp3(track, title): filename = get_filename(track) logger.debug("filename : {0}".format(filename)) - # Skip if file ID or filename already exists if already_downloaded(track, title, filename): return filename # Get the requests stream url = get_track_m3u8(track) - res = subprocess.call( - "ffmpeg -i {0} -c copy {1} -loglevel fatal".format( - '"' + url + '"', - '"' + filename + '"' - ) - ) + filename_path = os.path.abspath(filename) + + subprocess.call(['ffmpeg', '-i', url, '-c', 'copy', filename_path, '-loglevel', 'fatal']) return filename