Skip to content

Commit

Permalink
[patch] Merge pull request #95 from Feramance/84-request-option-to-ke…
Browse files Browse the repository at this point in the history
…ep-stalled-torrents

Allow stalled adjustements
  • Loading branch information
Feramance authored Jul 16, 2024
2 parents e020855 + 24201c9 commit 81ef59f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build x64 Binaries
name: PR Build Checks

on:
pull_request:
Expand Down
32 changes: 22 additions & 10 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,18 @@ def __init__(
self.file_extension_allowlist,
)
self.logger.debug("Script Config: AutoDelete=%s", self.auto_delete)

self.logger.debug(
"Script Config: IgnoreTorrentsYoungerThan=%s",
self.ignore_torrents_younger_than,
)
self.logger.debug("Script Config: MaximumETA=%s", self.maximum_eta)
self.logger.debug(
"Script Config: MaximumDeletablePercentage=%s", self.maximum_deletable_percentage
)
self.logger.debug("Script Config: StalledDelay=%s", self.stalled_delay)
self.logger.debug("Script Config: AllowedStalled=%s", self.allowed_stalled)
self.logger.debug("Script Config: ReSearchStalled=%s", self.re_search_stalled)
self.logger.debug("Script Config: StalledDelay=%s", self.stalled_delay)

if self.search_missing:
self.logger.debug(
Expand Down Expand Up @@ -853,12 +859,14 @@ def _process_imports(self) -> None:
def _process_failed_individual(
self, hash_: str, entry: int, skip_blacklist: set[str], remove_from_client: bool = True
) -> None:
self.logger.debug(
"Deleting from queue: %s, [%s][Blocklisting:%s][Remove from client:%s]",
hash_,
self.manager.qbit_manager.name_cache.get(hash_, "Blocklisted"),
True if hash_ not in skip_blacklist else False,
remove_from_client,
)
if hash_ not in skip_blacklist:
self.logger.debug(
"Blocklisting: %s (%s)",
hash_,
self.manager.qbit_manager.name_cache.get(hash_, "Blocklisted"),
)
self.delete_from_queue(
id_=entry, remove_from_client=remove_from_client, blacklist=True
)
Expand Down Expand Up @@ -2662,7 +2670,10 @@ def delete_from_queue(self, id_, remove_from_client=True, blacklist=True):
while completed:
try:
completed = False
res = self.client.del_queue(id_, remove_from_client, blacklist)
res = self.client._delete(
f"queue/{id_}?removeFromClient={remove_from_client}&blocklist={blacklist}",
self.client.ver_uri,
)
except (
requests.exceptions.ChunkedEncodingError,
requests.exceptions.ContentDecodingError,
Expand Down Expand Up @@ -4024,7 +4035,7 @@ def _stalled_check(self, torrent: qbittorrentapi.TorrentDictionary, time_now: fl
and torrent.availability < 1
)
and torrent.hash in self.cleaned_torrents
and self.is_downloading_state(torrent)
and torrent.state_enum in (TorrentStates.DOWNLOADING)
and "qBitrr-ignored" not in torrent.tags
and "qBitrr-free_space_paused" not in torrent.tags
)
Expand All @@ -4045,13 +4056,14 @@ def _stalled_check(self, torrent: qbittorrentapi.TorrentDictionary, time_now: fl
"Stalled, adding tag, blocklosting and re-searching: %s",
torrent.name,
)
skip_blacklist = set()
payload = self.process_entries([torrent.hash])
if payload:
for entry, hash_ in payload:
self._process_failed_individual(
hash_=hash_,
entry=entry,
skip_blacklist=set(),
skip_blacklist=skip_blacklist,
remove_from_client=False,
)
else:
Expand Down Expand Up @@ -4681,7 +4693,7 @@ def get_year_search(self) -> tuple[list[int], int]:
years.append(key)
self.logger.trace("Years: %s", years)
years_count = len(years)
self.logger.trace("Years count: %s, Years: %s", years_count, years)
self.logger.trace("Years count: %s", years_count)
return years, years_count

def run_search_loop(self) -> NoReturn:
Expand Down

0 comments on commit 81ef59f

Please sign in to comment.