1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-12-22 23:16:08 +08:00

Default 'format' field to {width}x{height}

If width is None, use {height}p and if height is None, '???'
This commit is contained in:
Jaime Marquínez Ferrándiz 2013-07-13 18:19:37 +02:00
parent 6ff000b888
commit 79819f58f2

View File

@ -466,9 +466,16 @@ class YoutubeDL(object):
# We check that all the formats have the format and format_id fields # We check that all the formats have the format and format_id fields
for (i, format) in enumerate(formats): for (i, format) in enumerate(formats):
if format.get('format') is None: if format.get('format') is None:
format['format'] = compat_str(i) if format.get('height') is not None:
if format.get('width') is not None:
format_desc = u'%sx%s' % (format['width'], format['height'])
else:
format_desc = u'%sp' % format['height']
else:
format_desc = compat_str(i)
format['format'] = format_desc
if format.get('format_id') is None: if format.get('format_id') is None:
format['format_id'] = compat_str(i) format['format_id'] = '???'
if self.params.get('listformats', None): if self.params.get('listformats', None):
self.list_formats(info_dict) self.list_formats(info_dict)