From 935154856127b64e32e984b7111ef764624fa026 Mon Sep 17 00:00:00 2001 From: Audionut Date: Sun, 25 Aug 2024 19:39:13 +1000 Subject: [PATCH] immediate break in reuploading if using approved host --- src/trackers/MTV.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/trackers/MTV.py b/src/trackers/MTV.py index 4aa0ceac4..46f43a994 100644 --- a/src/trackers/MTV.py +++ b/src/trackers/MTV.py @@ -51,17 +51,15 @@ async def upload_with_retry(self, meta, cookiefile, common, img_host_index=1): # Call handle_image_upload and pass the updated meta with the current image host index image_list, retry_mode = await self.handle_image_upload(meta, img_host_index, approved_image_hosts) - # If retry_mode is True, switch to the next host - if retry_mode: - console.print(f"[yellow]Switching to the next image host. Current index: {img_host_index}") - img_host_index += 1 - continue - - # If we successfully uploaded images, break out of the loop - if image_list is not None: + # If we successfully uploaded images or are already using an approved host, break out of the loop + if not retry_mode: break - if image_list is None: + # If retry_mode is True, switch to the next host + console.print(f"[yellow]Switching to the next image host. Current index: {img_host_index}") + img_host_index += 1 + + if not image_list: console.print("[red]All image hosts failed. Please check your configuration.") return