Nicer --list-formats output
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 28 Oct 2013 10:31:12 +0000 (11:31 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 28 Oct 2013 10:31:12 +0000 (11:31 +0100)
youtube_dl/YoutubeDL.py

index b09eeff32d0c03cd849dc28a168cf9fcf3352d59..12621ff95bd20a96df7f83c9cedbf97ef669a9a4 100644 (file)
@@ -757,23 +757,23 @@ class YoutubeDL(object):
             archive_file.write(vid_id + u'\n')
 
     @staticmethod
-    def format_resolution(format):
+    def format_resolution(format, default='unknown'):
         if format.get('height') is not None:
             if format.get('width') is not None:
                 res = u'%sx%s' % (format['width'], format['height'])
             else:
                 res = u'%sp' % format['height']
         else:
-            res = '???'
+            res = default
         return res
 
     def list_formats(self, info_dict):
         formats_s = []
         for format in info_dict.get('formats', [info_dict]):
-            formats_s.append(u'%-15s: %-5s     %-15s[%s]' % (
+            formats_s.append(u'%-15s%-7s     %-15s%s' % (
                 format['format_id'],
                 format['ext'],
-                format.get('format_note') or '-',
+                format.get('format_note', ''),
                 self.format_resolution(format),
                 )
             )