From 7ca58c96abbcc35753b822361c40b5e32b3e5784 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sun, 12 Mar 2023 00:12:48 +0000 Subject: [PATCH] Shorten variable `aria_log_buffer` to `log_buffer` --- devine/core/downloaders/aria2c.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/devine/core/downloaders/aria2c.py b/devine/core/downloaders/aria2c.py index 5478adb..0c708fb 100644 --- a/devine/core/downloaders/aria2c.py +++ b/devine/core/downloaders/aria2c.py @@ -102,7 +102,7 @@ async def aria2c( if p.stdout: is_dl_summary = False - aria_log_buffer = "" + log_buffer = "" while True: try: chunk = await p.stdout.readuntil(b"\r") @@ -135,16 +135,16 @@ async def aria2c( elif not is_dl_summary: if "aria2 will resume download if the transfer is restarted" in line: continue - aria_log_buffer += f"{line.strip()}\n" + log_buffer += f"{line.strip()}\n" - if aria_log_buffer: + if log_buffer: # wrap to console width - padding - '[Aria2c]: ' - aria_log_buffer = "\n ".join(textwrap.wrap( - aria_log_buffer.rstrip(), + log_buffer = "\n ".join(textwrap.wrap( + log_buffer.rstrip(), width=console.width - 20, initial_indent="" )) - console.log(Text.from_ansi("\n[Aria2c]: " + aria_log_buffer)) + console.log(Text.from_ansi("\n[Aria2c]: " + log_buffer)) await p.wait()