1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-13 14:00:11 +08:00

[FFmpegExtractAudioPP] fix info dict return audio filepath and ext instead of the video filepath if file already exists

If the converted audio file already exists, the `FFmpegExtractAudioPP.run` method returns the video filepath instead of the audio filepath and ext.
This commit is contained in:
Pierre Mdawar 2016-10-08 23:09:38 +03:00 committed by GitHub
parent 2b51dac1f9
commit ae5b06b6be

View File

@ -278,6 +278,9 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
prefix, sep, ext = path.rpartition('.') # not os.path.splitext, since the latter does not work on unicode in all setups prefix, sep, ext = path.rpartition('.') # not os.path.splitext, since the latter does not work on unicode in all setups
new_path = prefix + sep + extension new_path = prefix + sep + extension
information['filepath'] = new_path
information['ext'] = extension
# If we download foo.mp3 and convert it to... foo.mp3, then don't delete foo.mp3, silly. # If we download foo.mp3 and convert it to... foo.mp3, then don't delete foo.mp3, silly.
if (new_path == path or if (new_path == path or
@ -300,9 +303,6 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
new_path, time.time(), information['filetime'], new_path, time.time(), information['filetime'],
errnote='Cannot update utime of audio file') errnote='Cannot update utime of audio file')
information['filepath'] = new_path
information['ext'] = extension
return [path], information return [path], information