]> git.bitcoin.ninja Git - youtube-dl/commitdiff
Default 'format' field to {width}x{height}
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 13 Jul 2013 16:19:37 +0000 (18:19 +0200)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Fri, 11 Oct 2013 14:34:49 +0000 (16:34 +0200)
If width is None, use {height}p and if height is None, '???'

youtube_dl/YoutubeDL.py

index c6235abd313f94ec7f6271aaeb174ed493e2da78..829a70ec929af547c01f37436d5033dabbe25b72 100644 (file)
@@ -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)