From 7560ee96c9ee086eb4d93620a76c7cf3fda8d511 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sun, 26 Feb 2023 23:35:40 +0000 Subject: [PATCH] Replace console.log calls with padded console.prints While console.log is currently removing the need for `Padding(..., (0, 5))` as it is overwritten to do it automatically, but in terms of purpose the `console.print` function is more logical. I hope to find a way to automate the padding within console.print in the future, but for now this will work. --- devine/commands/dl.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/devine/commands/dl.py b/devine/commands/dl.py index 794ce54..d34a6db 100644 --- a/devine/commands/dl.py +++ b/devine/commands/dl.py @@ -296,7 +296,10 @@ class dl: (1, 2) )) - console.log(titles.tree(verbose=list_titles)) + console.print(Padding( + titles.tree(verbose=list_titles), + (0, 5) + )) if list_titles: return @@ -340,7 +343,10 @@ class dl: if list_: available_tracks, _ = title.tracks.tree() - console.log(Panel(available_tracks, title="Available Tracks")) + console.print(Padding( + Panel(available_tracks, title="Available Tracks"), + (0, 5) + )) continue with console.status("Selecting tracks...", spinner="dots"): @@ -555,7 +561,10 @@ class dl: downloaded_table = Table.grid(expand=True) downloaded_table.add_row("Download Finished! :tada:") downloaded_table.add_row(Text(str(final_path), overflow="fold")) - console.log(Padding(downloaded_table, (0, 0, 1, 0))) + console.print(Padding( + downloaded_table, + (0, 5, 1, 5) + )) # update cookies cookie_file = config.directories.cookies / service.__class__.__name__ / f"{self.profile}.txt" @@ -570,9 +579,9 @@ class dl: hours, minutes = divmod(minutes, 60) time_string = (f"{hours:d}h" if hours else "") + f"{minutes:d}m{seconds:d}s" - console.log(Padding( + console.print(Padding( f"Processed all titles in [progress.elapsed]{time_string}", - (0, 0, 1, 0) + (0, 5, 1, 5) )) def prepare_drm(