FFmpegExtractAudioPP: Simplify handling of already existing files
This commit is contained in:
		| @@ -264,15 +264,14 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor): | |||||||
|         new_path = prefix + sep + extension |         new_path = prefix + sep + 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: |         if (new_path == path or | ||||||
|             self._nopostoverwrites = True |                 (self._nopostoverwrites and os.path.exists(encodeFilename(new_path)))): | ||||||
|  |             self._downloader.to_screen('[youtube] Post-process file %s exists, skipping' % new_path) | ||||||
|  |             return True, information | ||||||
|  |  | ||||||
|         try: |         try: | ||||||
|             if self._nopostoverwrites and os.path.exists(encodeFilename(new_path)): |             self._downloader.to_screen('[' + self.basename + '] Destination: ' + new_path) | ||||||
|                 self._downloader.to_screen('[youtube] Post-process file %s exists, skipping' % new_path) |             self.run_ffmpeg(path, new_path, acodec, more_opts) | ||||||
|             else: |  | ||||||
|                 self._downloader.to_screen('[' + self.basename + '] Destination: ' + new_path) |  | ||||||
|                 self.run_ffmpeg(path, new_path, acodec, more_opts) |  | ||||||
|         except AudioConversionError as e: |         except AudioConversionError as e: | ||||||
|             raise PostProcessingError( |             raise PostProcessingError( | ||||||
|                 'audio conversion failed: ' + e.msg) |                 'audio conversion failed: ' + e.msg) | ||||||
| @@ -286,7 +285,7 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor): | |||||||
|                 errnote='Cannot update utime of audio file') |                 errnote='Cannot update utime of audio file') | ||||||
|  |  | ||||||
|         information['filepath'] = new_path |         information['filepath'] = new_path | ||||||
|         return self._nopostoverwrites, information |         return False, information | ||||||
|  |  | ||||||
|  |  | ||||||
| class FFmpegVideoConvertorPP(FFmpegPostProcessor): | class FFmpegVideoConvertorPP(FFmpegPostProcessor): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jaime Marquínez Ferrándiz
					Jaime Marquínez Ferrándiz