From 0782dc8ce1c8a193c1f091851e72e7d084c7d7a5 Mon Sep 17 00:00:00 2001 From: Audionut Date: Sat, 26 Oct 2024 17:11:26 +1000 Subject: [PATCH] Fix torrent validation error prints fixes https://github.com/Audionut/Upload-Assistant/issues/107 --- src/clients.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/clients.py b/src/clients.py index 9357142d..f4c2d45e 100644 --- a/src/clients.py +++ b/src/clients.py @@ -100,7 +100,6 @@ async def find_existing_torrent(self, meta): async def is_valid_torrent(self, meta, torrent_path, torrenthash, torrent_client, print_err=False): valid = False wrong_file = False - err_print = "" # Normalize the torrent hash based on the client if torrent_client in ('qbit', 'deluge'): @@ -174,16 +173,16 @@ async def is_valid_torrent(self, meta, torrent_path, torrenthash, torrent_client # Piece size and count validations if (reuse_torrent.pieces >= 7000 and reuse_torrent.piece_size < 8388608) or (reuse_torrent.pieces >= 4000 and reuse_torrent.piece_size < 4194304): - err_print = "[bold yellow]Too many pieces exist in current hash. REHASHING" + console.print("[bold yellow]Too many pieces exist in current hash. REHASHING") valid = False elif reuse_torrent.piece_size < 32768: - err_print = "[bold yellow]Piece size too small to reuse" + console.print("[bold yellow]Piece size too small to reuse") valid = False elif wrong_file: - err_print = "[bold red] Provided .torrent has files that were not expected" + console.print("[bold red] Provided .torrent has files that were not expected") valid = False else: - err_print = f'[bold green]REUSING .torrent with infohash: [bold yellow]{torrenthash}' + console.print(f"[bold green]REUSING .torrent with infohash: [bold yellow]{torrenthash}") except Exception as e: console.print(f'[bold red]Error checking reuse torrent: {e}') valid = False @@ -191,11 +190,7 @@ async def is_valid_torrent(self, meta, torrent_path, torrenthash, torrent_client if meta['debug']: console.log(f"Final validity after piece checks: valid={valid}") else: - err_print = '[bold yellow]Unwanted Files/Folders Identified' - - # Print the error message if needed - if print_err: - console.print(err_print) + console.print("[bold yellow]Unwanted Files/Folders Identified") return valid, torrent_path