[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 @@ Then simply type this
--no-audio-multistreams Only one audio stream is downloaded for
each output file (default)
--all-formats Download all available video formats
--prefer-free-formats Prefer free video formats over non-free
formats of same quality
--prefer-free-formats 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
--no-prefer-free-formats Don't give any special preference to free
containers (default)
-F, --list-formats List all available formats of requested
videos
--list-formats-as-table Present the output of -F in tabular form

View File

@ -1469,13 +1469,12 @@ class InfoExtractor(object):
elif conversion == 'bytes':
return FileDownloader.parse_bytes(value)
elif conversion == 'order':
order_free = self._get_field_setting(field, 'order_free')
order_list = order_free if order_free and self._use_free_order else self._get_field_setting(field, 'order')
order_list = (self._use_free_order and self._get_field_setting(field, 'order_free')) or self._get_field_setting(field, 'order')
use_regex = self._get_field_setting(field, 'regex')
list_length = len(order_list)
empty_pos = order_list.index('') if '' in order_list else list_length + 1
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):
return list_length - i
return list_length - empty_pos # not in list

View File

@ -483,7 +483,13 @@ def parseOpts(overrideArguments=None):
video_format.add_option(
'--prefer-free-formats',
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(
'-F', '--list-formats',
action='store_true', dest='listformats',