Skip to content

Commit

Permalink
chore: filter max age torrents easier
Browse files Browse the repository at this point in the history
  • Loading branch information
buroa committed Aug 30, 2024
1 parent 7f9a694 commit 1932332
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions qbtools/commands/reannounce.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ def process_torrents(status):
torrents = client.torrents.info(status_filter=status, sort="time_active")
torrents_retries = retries.get(status, {})

if torrents:
torrents = list(filter(lambda t: t.time_active <= max_age, torrents))

if not torrents:
torrents_retries.clear()

for t in torrents:
invalid = len(list(filter(lambda s: s.status == 4, t.trackers))) > 0
if not invalid:
continue

if t.time_active > max_age:
logger.debug("Torrent %s has been active for %s seconds - not reannouncing", t.name, t.time_active)
invalid_trackers = list(filter(lambda s: s.status == 4, t.trackers))
if not invalid_trackers:
continue

peers = t.num_seeds + t.num_leechs
Expand Down

0 comments on commit 1932332

Please sign in to comment.