[postprocessor/ffmpeg] Return correct filepath and ext in updated information in...
authorPierre Mdawar <p.mdawar@gmail.com>
Sat, 15 Oct 2016 19:12:03 +0000 (22:12 +0300)
committerSergey M <dstftw@gmail.com>
Sat, 15 Oct 2016 19:12:03 +0000 (02:12 +0700)
Return correct audio's filepath and ext instead of the video's when extracting audio and audio file already exists.

youtube_dl/postprocessor/ffmpeg.py

index 8d1214ee2c75e000ab846893394baf3a85e40a4d..652b1cb53608871e50fb48eaff222958d0f45375 100644 (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
         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 (new_path == path or
@@ -300,9 +303,6 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
                 new_path, time.time(), information['filetime'],
                 errnote='Cannot update utime of audio file')
 
-        information['filepath'] = new_path
-        information['ext'] = extension
-
         return [path], information