[documentation] Better document --prefer-free-formats

Also added `--no-prefer-free-formats`
This commit is contained in:
pukkandan 2021-02-18 19:47:46 +05:30
parent 155d2b48c5
commit da9be05edf
3 changed files with 15 additions and 6 deletions

View File

@ -520,8 +520,12 @@ ## Video Format Options:
--no-audio-multistreams Only one audio stream is downloaded for --no-audio-multistreams Only one audio stream is downloaded for
each output file (default) each output file (default)
--all-formats Download all available video formats --all-formats Download all available video formats
--prefer-free-formats Prefer free video formats over non-free --prefer-free-formats Prefer video formats with free containers
formats of same quality over non-free ones of same quality. Use
with "-S ext" to strictly prefer free
containers irrespective of quality
--no-prefer-free-formats Don't give any special preference to free
containers (default)
-F, --list-formats List all available formats of requested -F, --list-formats List all available formats of requested
videos videos
--list-formats-as-table Present the output of -F in tabular form --list-formats-as-table Present the output of -F in tabular form

View File

@ -1469,13 +1469,12 @@ def _resolve_field_value(self, field, value, convertNone=False):
elif conversion == 'bytes': elif conversion == 'bytes':
return FileDownloader.parse_bytes(value) return FileDownloader.parse_bytes(value)
elif conversion == 'order': elif conversion == 'order':
order_free = self._get_field_setting(field, 'order_free') order_list = (self._use_free_order and self._get_field_setting(field, 'order_free')) or self._get_field_setting(field, 'order')
order_list = order_free if order_free and self._use_free_order else self._get_field_setting(field, 'order')
use_regex = self._get_field_setting(field, 'regex') use_regex = self._get_field_setting(field, 'regex')
list_length = len(order_list) list_length = len(order_list)
empty_pos = order_list.index('') if '' in order_list else list_length + 1 empty_pos = order_list.index('') if '' in order_list else list_length + 1
if use_regex and value is not None: if use_regex and value is not None:
for (i, regex) in enumerate(order_list): for i, regex in enumerate(order_list):
if regex and re.match(regex, value): if regex and re.match(regex, value):
return list_length - i return list_length - i
return list_length - empty_pos # not in list return list_length - empty_pos # not in list

View File

@ -483,7 +483,13 @@ def _dict_from_multiple_values_options_callback(
video_format.add_option( video_format.add_option(
'--prefer-free-formats', '--prefer-free-formats',
action='store_true', dest='prefer_free_formats', default=False, action='store_true', dest='prefer_free_formats', default=False,
help='Prefer free video formats over non-free formats of same quality') help=(
'Prefer video formats with free containers over non-free ones of same quality. '
'Use with "-S ext" to strictly prefer free containers irrespective of quality'))
video_format.add_option(
'--no-prefer-free-formats',
action='store_true', dest='prefer_free_formats', default=False,
help="Don't give any special preference to free containers (default)")
video_format.add_option( video_format.add_option(
'-F', '--list-formats', '-F', '--list-formats',
action='store_true', dest='listformats', action='store_true', dest='listformats',