diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-07-13 18:19:37 +0200 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2013-10-11 16:34:49 +0200 |
commit | 79819f58f2328cdb08272c55d01965cd8c6624ba (patch) | |
tree | 61387b414598f7e40ce9c80f513c2134a34bb9fb /youtube_dl/YoutubeDL.py | |
parent | 6ff000b888a3da702a894addd9f9824139fd8c8d (diff) |
Default 'format' field to {width}x{height}
If width is None, use {height}p and if height is None, '???'
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r-- | youtube_dl/YoutubeDL.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index c6235abd3..829a70ec9 100644 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -466,9 +466,16 @@ class YoutubeDL(object): # We check that all the formats have the format and format_id fields for (i, format) in enumerate(formats): 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: - format['format_id'] = compat_str(i) + format['format_id'] = '???' if self.params.get('listformats', None): self.list_formats(info_dict) |