Auto-select default format in -f-
(#7101)
Authored by: ivanskodje, pukkandan Closes #6720
This commit is contained in:
parent
4cbfa570a1
commit
372a0f3b9d
1 changed files with 9 additions and 8 deletions
|
@ -2744,21 +2744,22 @@ class YoutubeDL:
|
||||||
return info_dict
|
return info_dict
|
||||||
|
|
||||||
format_selector = self.format_selector
|
format_selector = self.format_selector
|
||||||
if format_selector is None:
|
|
||||||
req_format = self._default_format_spec(info_dict, download=download)
|
|
||||||
self.write_debug('Default format spec: %s' % req_format)
|
|
||||||
format_selector = self.build_format_selector(req_format)
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if interactive_format_selection:
|
if interactive_format_selection:
|
||||||
req_format = input(
|
req_format = input(self._format_screen('\nEnter format selector ', self.Styles.EMPHASIS)
|
||||||
self._format_screen('\nEnter format selector: ', self.Styles.EMPHASIS))
|
+ '(Press ENTER for default, or Ctrl+C to quit)'
|
||||||
|
+ self._format_screen(': ', self.Styles.EMPHASIS))
|
||||||
try:
|
try:
|
||||||
format_selector = self.build_format_selector(req_format)
|
format_selector = self.build_format_selector(req_format) if req_format else None
|
||||||
except SyntaxError as err:
|
except SyntaxError as err:
|
||||||
self.report_error(err, tb=False, is_error=False)
|
self.report_error(err, tb=False, is_error=False)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if format_selector is None:
|
||||||
|
req_format = self._default_format_spec(info_dict, download=download)
|
||||||
|
self.write_debug(f'Default format spec: {req_format}')
|
||||||
|
format_selector = self.build_format_selector(req_format)
|
||||||
|
|
||||||
formats_to_download = list(format_selector({
|
formats_to_download = list(format_selector({
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'has_merged_format': any('none' not in (f.get('acodec'), f.get('vcodec')) for f in formats),
|
'has_merged_format': any('none' not in (f.get('acodec'), f.get('vcodec')) for f in formats),
|
||||||
|
|
Loading…
Reference in a new issue