mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 12:01:28 +00:00
Skip fixup of existing files and add --fixup force
to force it
This commit is contained in:
parent
fd7cfb6444
commit
f89b3e2d7a
|
@ -2690,7 +2690,10 @@ def fixup():
|
||||||
return
|
return
|
||||||
elif fixup_policy == 'warn':
|
elif fixup_policy == 'warn':
|
||||||
do_fixup = False
|
do_fixup = False
|
||||||
assert fixup_policy in ('detect_or_warn', None)
|
elif fixup_policy != 'force':
|
||||||
|
assert fixup_policy in ('detect_or_warn', None)
|
||||||
|
if not info_dict.get('__real_download'):
|
||||||
|
do_fixup = False
|
||||||
|
|
||||||
def ffmpeg_fixup(cndn, msg, cls):
|
def ffmpeg_fixup(cndn, msg, cls):
|
||||||
if not cndn:
|
if not cndn:
|
||||||
|
|
|
@ -1230,11 +1230,12 @@ def _dict_from_options_callback(
|
||||||
postproc.add_option(
|
postproc.add_option(
|
||||||
'--fixup',
|
'--fixup',
|
||||||
metavar='POLICY', dest='fixup', default=None,
|
metavar='POLICY', dest='fixup', default=None,
|
||||||
choices=('never', 'ignore', 'warn', 'detect_or_warn'),
|
choices=('never', 'ignore', 'warn', 'detect_or_warn', 'force'),
|
||||||
help=(
|
help=(
|
||||||
'Automatically correct known faults of the file. '
|
'Automatically correct known faults of the file. '
|
||||||
'One of never (do nothing), warn (only emit a warning), '
|
'One of never (do nothing), warn (only emit a warning), '
|
||||||
'detect_or_warn (the default; fix file if we can, warn otherwise)'))
|
'detect_or_warn (the default; fix file if we can, warn otherwise), '
|
||||||
|
'force (try fixing even if file already exists'))
|
||||||
postproc.add_option(
|
postproc.add_option(
|
||||||
'--prefer-avconv', '--no-prefer-ffmpeg',
|
'--prefer-avconv', '--no-prefer-ffmpeg',
|
||||||
action='store_false', dest='prefer_ffmpeg',
|
action='store_false', dest='prefer_ffmpeg',
|
||||||
|
|
|
@ -665,7 +665,7 @@ class FFmpegFixupPostProcessor(FFmpegPostProcessor):
|
||||||
def _fixup(self, msg, filename, options):
|
def _fixup(self, msg, filename, options):
|
||||||
temp_filename = prepend_extension(filename, 'temp')
|
temp_filename = prepend_extension(filename, 'temp')
|
||||||
|
|
||||||
self.to_screen('{msg} of "{filename}"')
|
self.to_screen(f'{msg} of "{filename}"')
|
||||||
self.run_ffmpeg(filename, temp_filename, options)
|
self.run_ffmpeg(filename, temp_filename, options)
|
||||||
|
|
||||||
os.remove(encodeFilename(filename))
|
os.remove(encodeFilename(filename))
|
||||||
|
|
Loading…
Reference in a new issue