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