From 75423c767142bd1c1ed8e60b7ae75732aeb601f8 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Fri, 30 Aug 2024 13:34:19 +0200 Subject: [PATCH] Show playlists in a table --- twitchdl/commands/info.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/twitchdl/commands/info.py b/twitchdl/commands/info.py index 81c221d..e5706e3 100644 --- a/twitchdl/commands/info.py +++ b/twitchdl/commands/info.py @@ -6,7 +6,7 @@ import m3u8 from twitchdl import twitch, utils from twitchdl.exceptions import ConsoleError from twitchdl.naming import video_placeholders -from twitchdl.output import bold, print_clip, print_json, print_log, print_table, print_video +from twitchdl.output import bold, dim, print_clip, print_json, print_log, print_table, print_video from twitchdl.playlists import parse_playlists from twitchdl.twitch import Chapter, Clip, Video @@ -55,9 +55,19 @@ def video_info(video: Video, playlists: str, chapters: List[Chapter]): click.echo() print_video(video) - click.echo("Playlists:") - for p in parse_playlists(playlists): - click.echo(f"{bold(p.name)} {p.url}") + click.echo("Playlists:\n") + + playlist_headers = ["Name", "Group", "Resolution", "URL"] + playlist_data = [ + [ + f"{p.name} {dim('source')}" if p.is_source else p.name, + p.group_id, + f"{p.resolution}", + p.url, + ] + for p in parse_playlists(playlists) + ] + print_table(playlist_headers, playlist_data) if chapters: click.echo()