Warn when using old style (downloader/postprocessor)_args

This commit is contained in:
pukkandan 2021-01-23 17:41:21 +05:30
parent 256ed01025
commit b8f6bbe68a
2 changed files with 8 additions and 1 deletions

View file

@ -326,7 +326,12 @@ def parse_retries(retries):
'exec_cmd': opts.exec_cmd,
})
_args_compat_warning = 'WARNING: %s given without specifying name. The arguments will be given to all %s\n'
if 'default' in opts.external_downloader_args:
write_string(_args_compat_warning % ('--external-downloader-args', 'external downloaders'), out=sys.stderr),
if 'default-compat' in opts.postprocessor_args and 'default' not in opts.postprocessor_args:
write_string(_args_compat_warning % ('--post-processor-args', 'post-processors'), out=sys.stderr),
opts.postprocessor_args.setdefault('sponskrub', [])
opts.postprocessor_args['default'] = opts.postprocessor_args['default-compat']

View file

@ -640,7 +640,9 @@ def _dict_from_multiple_values_options_callback(
'--downloader-args', '--external-downloader-args',
metavar='NAME:ARGS', dest='external_downloader_args', default={}, type='str',
action='callback', callback=_dict_from_multiple_values_options_callback,
callback_kwargs={'default_key': 'default', 'process': compat_shlex_split},
callback_kwargs={
'allowed_keys': '|'.join(list_external_downloaders()),
'default_key': 'default', 'process': compat_shlex_split},
help=(
'Give these arguments to the external downloader. '
'Specify the downloader name and the arguments separated by a colon ":". '