From 6a8d627c0139060ac7f594803bf1bf7bcebddde3 Mon Sep 17 00:00:00 2001 From: Justin Donofrio Date: Thu, 7 Nov 2024 11:31:06 -0500 Subject: [PATCH] Add download delay to failed items --- src/onthespot/downloader.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/onthespot/downloader.py b/src/onthespot/downloader.py index db3a4a9..135af98 100644 --- a/src/onthespot/downloader.py +++ b/src/onthespot/downloader.py @@ -345,14 +345,17 @@ def run(self): continue except Exception as e: logger.error(f"Unknown Exception: {str(e)}") - if os.path.exists(temp_file_path): - os.remove(temp_file_path) - if os.path.exists(file_path): - os.remove(file_path) item['item_status'] = "Failed" if self.gui: self.progress.emit(item, self.tr("Failed"), 0) + + time.sleep(config.get("download_delay")) self.readd_item_to_download_queue(item) + + if os.path.exists(temp_file_path): + os.remove(temp_file_path) + if os.path.exists(file_path): + os.remove(file_path) continue else: time.sleep(1)