Fix `mergeall` when requested formats are unavailable

This commit is contained in:
pukkandan 2021-04-10 22:29:58 +05:30
parent f7ad71607d
commit e01d6aa435
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
1 changed files with 3 additions and 1 deletions

View File

@ -1637,7 +1637,7 @@ class YoutubeDL(object):
return []
elif selector.type == SINGLE: # atom
format_spec = (selector.selector if selector.selector is not None else 'best').lower()
format_spec = (selector.selector or 'best').lower()
# TODO: Add allvideo, allaudio etc by generalizing the code with best/worst selector
if format_spec == 'all':
@ -1649,6 +1649,8 @@ class YoutubeDL(object):
elif format_spec == 'mergeall':
def selector_function(ctx):
formats = list(ctx['formats'])
if not formats:
return
merged_format = formats[0]
for f in formats[1:]:
merged_format = _merge((merged_format, f))