Fixes from @mavieth (#308)

master
Ronan 2020-01-21 10:35:31 +01:00 committed by GitHub
parent aa3e5bee2b
commit c221e439a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -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