From 520619c77d53142b6e12d3af6c1257d75d0fe207 Mon Sep 17 00:00:00 2001 From: Feramance Date: Sun, 30 Jun 2024 13:41:59 +0200 Subject: [PATCH] Stalled updates --- qBitrr/arss.py | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/qBitrr/arss.py b/qBitrr/arss.py index 5de8058b..06c0c990 100755 --- a/qBitrr/arss.py +++ b/qBitrr/arss.py @@ -3970,7 +3970,7 @@ def _process_single_torrent(self, torrent: qbittorrentapi.TorrentDictionary): ) maximum_eta = _tracker_max_eta - stalled_ignore = False + stalled_ignore = True self.logger.trace( "Stalled check: %s [Current:%s][Added:%s][Limit:%s]", torrent.name, @@ -3981,15 +3981,25 @@ def _process_single_torrent(self, torrent: qbittorrentapi.TorrentDictionary): ), ) if ( - torrent.state_enum - in ( - TorrentStates.METADATA_DOWNLOAD, - TorrentStates.STALLED_DOWNLOAD, + ( + torrent.state_enum + in ( + TorrentStates.METADATA_DOWNLOAD, + TorrentStates.STALLED_DOWNLOAD, + ) + and "qBitrr-ignored" not in torrent.tags + and "qBitrr-free_space_paused" not in torrent.tags ) or ( - torrent.availability < 1 - and not self.is_uploading_state(torrent) - and torrent.state_enum != TorrentStates.PAUSED_DOWNLOAD + ( + self.recently_queue.get(torrent.hash, torrent.added_on) + < time_now - self.ignore_torrents_younger_than + and torrent.availability < 1 + ) + and torrent.hash in self.cleaned_torrents + and self.is_downloading_state(torrent) + and "qBitrr-ignored" not in torrent.tags + and "qBitrr-free_space_paused" not in torrent.tags ) ) and self.allowed_stalled: if ( @@ -4003,24 +4013,24 @@ def _process_single_torrent(self, torrent: qbittorrentapi.TorrentDictionary): ) elif "qBitrr-allowed_stalled" not in torrent.tags: torrent.add_tags(["qBitrr-allowed_stalled"]) - stalled_ignore = True self.logger.trace( "Stalled, adding tag: %s", torrent.name, ) elif "qBitrr-allowed_stalled" in torrent.tags: - stalled_ignore = True self.logger.trace( "Stalled: %s", torrent.name, ) elif "qBitrr-allowed_stalled" in torrent.tags: torrent.remove_tags(["qBitrr-allowed_stalled"]) + stalled_ignore = False self.logger.trace( "Not stalled, removing tag: %s", torrent.name, ) else: + stalled_ignore = False self.logger.trace( "Not stalled: %s", torrent.name,