diff --git a/config.example.toml b/config.example.toml index 1e8e36c9..8a49714a 100644 --- a/config.example.toml +++ b/config.example.toml @@ -214,10 +214,10 @@ MaximumDeletablePercentage = 0.99 # Ignore slow torrents. DoNotRemoveSlow = true -# Allow stalled torrents -AllowStalled = false +# Re-search stalled torrents +ReSearchStalled = false -# Maximum allowed time for allowed stalled torrents in minutes +# Maximum allowed time for allowed stalled torrents in minutes (-1 = Disabled, 0 = Infinite) StalledDelay = -1 @@ -417,10 +417,10 @@ MaximumDeletablePercentage = 0.99 # Ignore slow torrents. DoNotRemoveSlow = true -# Allow stalled torrents -AllowStalled = false +# Re-search stalled torrents +ReSearchStalled = false -# Maximum allowed time for allowed stalled torrents in minutes +# Maximum allowed time for allowed stalled torrents in minutes (-1 = Disabled, 0 = Infinite) StalledDelay = -1 @@ -616,10 +616,10 @@ MaximumDeletablePercentage = 0.99 # Ignore slow torrents. DoNotRemoveSlow = true -# Allow stalled torrents -AllowStalled = false +# Re-search stalled torrents +ReSearchStalled = false -# Maximum allowed time for allowed stalled torrents in minutes +# Maximum allowed time for allowed stalled torrents in minutes (-1 = Disabled, 0 = Infinite) StalledDelay = -1 @@ -828,10 +828,10 @@ MaximumDeletablePercentage = 0.99 # Ignore slow torrents. DoNotRemoveSlow = true -# Allow stalled torrents -AllowStalled = false +# Re-search stalled torrents +ReSearchStalled = false -# Maximum allowed time for allowed stalled torrents in minutes +# Maximum allowed time for allowed stalled torrents in minutes (-1 = Disabled, 0 = Infinite) StalledDelay = -1 diff --git a/qBitrr/arss.py b/qBitrr/arss.py index cf7d8bc9..9b26ff37 100755 --- a/qBitrr/arss.py +++ b/qBitrr/arss.py @@ -223,8 +223,10 @@ def __init__( ) self.do_not_remove_slow = CONFIG.get(f"{name}.Torrent.DoNotRemoveSlow", fallback=False) - self.allowed_stalled = CONFIG.get(f"{name}.Torrent.AllowStalled", fallback=False) + self.re_search_stalled = CONFIG.get(f"{name}.Torrent.ReSearchStalled", fallback=False) self.stalled_delay = CONFIG.get(f"{name}.Torrent.StalledDelay", fallback=0) + self.allowed_stalled = True if self.stalled_delay != -1 else False + self.search_current_year = None if self.search_in_reverse: self._delta = 1 @@ -846,16 +848,19 @@ def _process_imports(self) -> None: self.sent_to_scan.add(path) self.import_torrents.clear() - def _process_failed_individual(self, hash_: str, entry: int, skip_blacklist: set[str]) -> None: - if hash_ not in skip_blacklist: - self.logger.debug( - "Blocklisting: %s (%s)", - hash_, - self.manager.qbit_manager.name_cache.get(hash_, "Deleted"), - ) - self.delete_from_queue(id_=entry, blacklist=True) - else: - self.delete_from_queue(id_=entry, blacklist=False) + def _process_failed_individual( + self, hash_: str, entry: int, skip_blacklist: set[str], stalled: bool = False + ) -> None: + if not stalled: + if hash_ not in skip_blacklist: + self.logger.debug( + "Blocklisting: %s (%s)", + hash_, + self.manager.qbit_manager.name_cache.get(hash_, "Deleted"), + ) + self.delete_from_queue(id_=entry, blacklist=True) + else: + self.delete_from_queue(id_=entry, blacklist=False) if hash_ in self.recently_queue: del self.recently_queue[hash_] object_id = self.requeue_cache.get(entry) @@ -4068,6 +4073,14 @@ def _process_single_torrent(self, torrent: qbittorrentapi.TorrentDictionary): ] ) + if "qBitrr-allowed_stalled" in torrent.tags and self.re_search_stalled: + payload = self.process_entries([torrent.hash]) + if payload: + for entry, hash_ in payload: + self._process_failed_individual( + hash_=hash_, entry=entry, skip_blacklist=set(), stalled=True + ) + if ( self.custom_format_unmet_search and self.custom_format_unmet_check(torrent) diff --git a/qBitrr/gen_config.py b/qBitrr/gen_config.py index 4f6c0982..d393259c 100755 --- a/qBitrr/gen_config.py +++ b/qBitrr/gen_config.py @@ -338,10 +338,10 @@ def _gen_default_torrent_table(category: str, cat_default: Table): 0.99, ) _gen_default_line(torrent_table, "Ignore slow torrents.", "DoNotRemoveSlow", True) - _gen_default_line(torrent_table, "Allow stalled torrents", "AllowStalled", False) + _gen_default_line(torrent_table, "Re-search stalled torrents", "ReSearchStalled", False) _gen_default_line( torrent_table, - "Maximum allowed time for allowed stalled torrents in minutes", + "Maximum allowed time for allowed stalled torrents in minutes (-1 = Disabled, 0 = Infinite)", "StalledDelay", -1, )