Added extra separation to match old formatting

pull/189/head
pukkandan 5 years ago
parent 54b581c60d
commit 23d3a18011

@ -2341,7 +2341,7 @@ class YoutubeDL(object):
table[-1][-1] += (' ' if table[-1][-1] else '') + '(best)' table[-1][-1] += (' ' if table[-1][-1] else '') + '(best)'
self.to_screen( self.to_screen(
'[info] Available formats for %s:\n%s' % '[info] Available formats for %s:\n%s' %
(info_dict['id'], render_table(header_line, table, new_format))) (info_dict['id'], render_table(header_line, table, delim=new_format, extraGap=(0 if new_format else 1))))
def list_thumbnails(self, info_dict): def list_thumbnails(self, info_dict):
thumbnails = info_dict.get('thumbnails') thumbnails = info_dict.get('thumbnails')

@ -416,7 +416,7 @@ def parseOpts(overrideArguments=None):
help='Present the output of -F in a more tabular form') help='Present the output of -F in a more tabular form')
video_format.add_option( video_format.add_option(
'--list-formats-old', '--list-formats-old',
action='store_false', dest='listformats_table' action='store_false', dest='listformats_table',
help=optparse.SUPPRESS_HELP) help=optparse.SUPPRESS_HELP)
video_format.add_option( video_format.add_option(
'--youtube-include-dash-manifest', '--youtube-include-dash-manifest',

@ -4311,13 +4311,13 @@ def determine_protocol(info_dict):
return compat_urllib_parse_urlparse(url).scheme return compat_urllib_parse_urlparse(url).scheme
def render_table(header_row, data, delim=False): def render_table(header_row, data, delim=False, extraGap=0):
""" Render a list of rows, each as a list of values """ """ Render a list of rows, each as a list of values """
table = [header_row] + data table = [header_row] + data
max_lens = [max(len(compat_str(v)) for v in col) for col in zip(*table)] max_lens = [max(len(compat_str(v)) for v in col) for col in zip(*table)]
if delim: if delim:
table = [header_row] + [['-' * ml for ml in max_lens]] + data table = [header_row] + [['-' * ml for ml in max_lens]] + data
format_str = ' '.join('%-' + compat_str(ml) + 's' for ml in max_lens[:-1]) + ' %s' format_str = ' '.join('%-' + compat_str(ml + extraGap) + 's' for ml in max_lens[:-1]) + ' %s'
return '\n'.join(format_str % tuple(row) for row in table) return '\n'.join(format_str % tuple(row) for row in table)

Loading…
Cancel
Save