mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-27 00:43:06 +00:00
FFmpegExtractAudioPP: Simplify handling of already existing files
This commit is contained in:
parent
7691a7a3bd
commit
ce81b1411d
1 changed files with 7 additions and 8 deletions
|
@ -264,13 +264,12 @@ def run(self, information):
|
|||
new_path = prefix + sep + extension
|
||||
|
||||
# If we download foo.mp3 and convert it to... foo.mp3, then don't delete foo.mp3, silly.
|
||||
if new_path == path:
|
||||
self._nopostoverwrites = True
|
||||
if (new_path == path or
|
||||
(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:
|
||||
if self._nopostoverwrites and os.path.exists(encodeFilename(new_path)):
|
||||
self._downloader.to_screen('[youtube] Post-process file %s exists, skipping' % new_path)
|
||||
else:
|
||||
self._downloader.to_screen('[' + self.basename + '] Destination: ' + new_path)
|
||||
self.run_ffmpeg(path, new_path, acodec, more_opts)
|
||||
except AudioConversionError as e:
|
||||
|
@ -286,7 +285,7 @@ def run(self, information):
|
|||
errnote='Cannot update utime of audio file')
|
||||
|
||||
information['filepath'] = new_path
|
||||
return self._nopostoverwrites, information
|
||||
return False, information
|
||||
|
||||
|
||||
class FFmpegVideoConvertorPP(FFmpegPostProcessor):
|
||||
|
|
Loading…
Reference in a new issue