join_nonempty,
orderedSet_from_options,
remove_end,
+ variadic,
write_string,
)
from .version import CHANNEL, __version__
if multiple_args:
val = [val, *value[1:]]
elif default_key is not None:
- keys, val = [default_key], value
+ keys, val = variadic(default_key), value
else:
raise optparse.OptionValueError(
f'wrong {opt_str} formatting; it should be {option.metavar}, not "{value}"')
help='Do not mark videos watched (default)')
general.add_option(
'--no-colors', '--no-colours',
- action='store_true', dest='no_color', default=False,
- help='Do not emit color codes in output (Alias: --no-colours)')
+ action='store_const', dest='color', const={
+ 'stdout': 'no_color',
+ 'stderr': 'no_color',
+ },
+ help=optparse.SUPPRESS_HELP)
+ general.add_option(
+ '--color',
+ dest='color', metavar='[STREAM:]POLICY', default={}, type='str',
+ action='callback', callback=_dict_from_options_callback,
+ callback_kwargs={
+ 'allowed_keys': 'stdout|stderr',
+ 'default_key': ['stdout', 'stderr'],
+ 'process': str.strip,
+ }, help=(
+ 'Whether to emit color codes in output, optionally prefixed by '
+ 'the STREAM (stdout or stderr) to apply the setting to. '
+ 'Can be one of "always", "auto" (default), "never", or '
+ '"no_color" (use non color terminal sequences). '
+ 'Can be used multiple times'))
general.add_option(
'--compat-options',
metavar='OPTS', dest='compat_opts', default=set(), type='str',
callback_kwargs={
'allowed_values': {
'filename', 'filename-sanitization', 'format-sort', 'abort-on-error', 'format-spec', 'no-playlist-metafiles',
- 'multistreams', 'no-live-chat', 'playlist-index', 'list-formats', 'no-direct-merge',
+ 'multistreams', 'no-live-chat', 'playlist-index', 'list-formats', 'no-direct-merge', 'playlist-match-filter',
'no-attach-info-json', 'embed-thumbnail-atomicparsley', 'no-external-downloader-progress',
'embed-metadata', 'seperate-video-versions', 'no-clean-infojson', 'no-keep-subs', 'no-certifi',
'no-youtube-channel-redirect', 'no-youtube-unavailable-videos', 'no-youtube-prefer-utc-upload-date',
}, 'aliases': {
- 'youtube-dl': ['all', '-multistreams'],
- 'youtube-dlc': ['all', '-no-youtube-channel-redirect', '-no-live-chat'],
+ 'youtube-dl': ['all', '-multistreams', '-playlist-match-filter'],
+ 'youtube-dlc': ['all', '-no-youtube-channel-redirect', '-no-live-chat', '-playlist-match-filter'],
'2021': ['2022', 'no-certifi', 'filename-sanitization', 'no-youtube-prefer-utc-upload-date'],
- '2022': ['no-external-downloader-progress'],
+ '2022': ['no-external-downloader-progress', 'playlist-match-filter'],
}
}, help=(
'Options that can help keep compatibility with youtube-dl or youtube-dlc '