diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index d1a0c6484..1f03ac1e4 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -2341,7 +2341,7 @@ class YoutubeDL(object): table[-1][-1] += (' ' if table[-1][-1] else '') + '(best)' self.to_screen( '[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): thumbnails = info_dict.get('thumbnails') diff --git a/youtube_dlc/options.py b/youtube_dlc/options.py index 407c65e2f..6118952bb 100644 --- a/youtube_dlc/options.py +++ b/youtube_dlc/options.py @@ -416,7 +416,7 @@ def parseOpts(overrideArguments=None): help='Present the output of -F in a more tabular form') video_format.add_option( '--list-formats-old', - action='store_false', dest='listformats_table' + action='store_false', dest='listformats_table', help=optparse.SUPPRESS_HELP) video_format.add_option( '--youtube-include-dash-manifest', diff --git a/youtube_dlc/utils.py b/youtube_dlc/utils.py index 959af8e13..d2e8d7cc1 100644 --- a/youtube_dlc/utils.py +++ b/youtube_dlc/utils.py @@ -4311,13 +4311,13 @@ def determine_protocol(info_dict): 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 """ table = [header_row] + data max_lens = [max(len(compat_str(v)) for v in col) for col in zip(*table)] if delim: 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)