diff options
author | Jesús <heckyel@hyperbola.info> | 2022-02-12 21:05:27 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2022-02-12 21:05:27 -0500 |
commit | af4847e22e81d05177f92c712983ab3f2f20184b (patch) | |
tree | 6b749333494ffe379df3e1a060660e4b1afcdf85 /yt_dlp/options.py | |
parent | c4b763b19f54ed5dfc2fd408adb9ed74126f6740 (diff) | |
parent | 29448350808619262d6a9ddd393a2c28df1720fe (diff) | |
download | hypervideo-pre-af4847e22e81d05177f92c712983ab3f2f20184b.tar.lz hypervideo-pre-af4847e22e81d05177f92c712983ab3f2f20184b.tar.xz hypervideo-pre-af4847e22e81d05177f92c712983ab3f2f20184b.zip |
updated from upstream | 12/02/2022 at 21:05
Diffstat (limited to 'yt_dlp/options.py')
-rw-r--r-- | yt_dlp/options.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/yt_dlp/options.py b/yt_dlp/options.py index 0086c3619..eb21a25ac 100644 --- a/yt_dlp/options.py +++ b/yt_dlp/options.py @@ -117,6 +117,19 @@ def parseOpts(overrideArguments=None, ignore_config_files='if_override'): return parser, opts, args +class _YoutubeDLOptionParser(optparse.OptionParser): + # optparse is deprecated since python 3.2. So assume a stable interface even for private methods + + def _match_long_opt(self, opt): + """Improve ambigious argument resolution by comparing option objects instead of argument strings""" + try: + return super()._match_long_opt(opt) + except optparse.AmbiguousOptionError as e: + if len(set(self._long_opt[p] for p in e.possibilities)) == 1: + return e.possibilities[0] + raise + + def create_parser(): def _format_option_string(option): ''' ('-o', '--option') -> -o, --format METAVAR''' @@ -215,7 +228,7 @@ def create_parser(): 'conflict_handler': 'resolve', } - parser = optparse.OptionParser(**compat_kwargs(kw)) + parser = _YoutubeDLOptionParser(**compat_kwargs(kw)) general = optparse.OptionGroup(parser, 'General Options') general.add_option( @@ -1191,13 +1204,13 @@ def create_parser(): action='store_false', dest='allow_playlist_files', help='Do not write playlist metadata when using --write-info-json, --write-description etc.') filesystem.add_option( - '--clean-infojson', + '--clean-info-json', '--clean-infojson', action='store_true', dest='clean_infojson', default=None, help=( 'Remove some private fields such as filenames from the infojson. ' 'Note that it could still contain some personal information (default)')) filesystem.add_option( - '--no-clean-infojson', + '--no-clean-info-json', '--no-clean-infojson', action='store_false', dest='clean_infojson', help='Write all fields to the infojson') filesystem.add_option( |