- if len(formats_s) != 1:
- formats_s[0] += ' (worst)'
- formats_s[-1] += ' (best)'
- formats_s = "\n".join(formats_s)
- self.to_screen(u'[info] Available formats for %s:\n'
- u'format code extension note resolution\n%s' % (
- info_dict['id'], formats_s))
+
+ formats = info_dict.get('formats', [info_dict])
+ formats_s = list(map(line, formats))
+ if len(formats) > 1:
+ formats_s[0] += (' ' if formats[0].get('format_note') else '') + '(worst)'
+ formats_s[-1] += (' ' if formats[-1].get('format_note') else '') + '(best)'
+
+ header_line = line({
+ 'format_id': u'format code', 'ext': u'extension',
+ '_resolution': u'resolution', 'format_note': u'note'})
+ self.to_screen(u'[info] Available formats for %s:\n%s\n%s' %
+ (info_dict['id'], header_line, u"\n".join(formats_s)))