From caa22a1004e1464f83a04a3690997fe43b7d8fd1 Mon Sep 17 00:00:00 2001 From: Feramance Date: Fri, 25 Aug 2023 17:38:18 +0200 Subject: [PATCH] [patch] Added logic to check download queue before re-searching or posting any search at all --- qBitrr/arss.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/qBitrr/arss.py b/qBitrr/arss.py index 93038a2c..8da7b376 100644 --- a/qBitrr/arss.py +++ b/qBitrr/arss.py @@ -827,7 +827,8 @@ def _process_failed_individual(self, hash_: str, entry: int, skip_blacklist: set "Re-Searching episode: %s", object_id, ) - self.post_command("EpisodeSearch", episodeIds=[object_id]) + if object_id not in self.queue_file_ids: + self.post_command("EpisodeSearch", episodeIds=[object_id]) if self.persistent_queue and series_id: self.persistent_queue.insert(EntryId=series_id).on_conflict_ignore() elif self.type == "radarr": @@ -848,7 +849,8 @@ def _process_failed_individual(self, hash_: str, entry: int, skip_blacklist: set "Re-Searching movie: %s", object_id, ) - self.post_command("MoviesSearch", movieIds=[object_id]) + if object_id not in self.queue_file_ids: + self.post_command("MoviesSearch", movieIds=[object_id]) if self.persistent_queue: self.persistent_queue.insert(EntryId=object_id).on_conflict_ignore() @@ -1383,8 +1385,8 @@ def db_update(self): .order_by(self.model_arr_file.Added.desc()) ): self.db_update_single_series(db_entry=movies) - except BaseException as e: - self.logger.error(e.message) + except BaseException: + self.logger.error("Connection Error") raise DelayLoopException(length=300, type="delay") self.logger.trace(f"Finished updating database") @@ -1921,7 +1923,8 @@ def maybe_do_search( Completed=False, EntryId=file_model.EntryId, ).on_conflict_replace().execute() - self.client.post_command(self.search_api_command, seriesId=file_model.EntryId) + if file_model.EntryId not in self.queue_file_ids: + self.client.post_command(self.search_api_command, seriesId=file_model.EntryId) file_model.Searched = True file_model.save() self.logger.hnotice( @@ -3229,6 +3232,7 @@ def run_search_loop(self) -> NoReturn: while True: timer = datetime.now(timezone.utc) try: + self.refresh_download_queue() self.db_maybe_reset_entry_searched_state() self.db_update() self.run_request_search()