From 912d89abba90810db36f1f78e58bb80a7acc617b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Tue, 5 May 2026 15:39:32 +0200 Subject: [PATCH] smart queue fix --- pytorrent/services/smart_queue.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pytorrent/services/smart_queue.py b/pytorrent/services/smart_queue.py index 54d2f6e..3d11bab 100644 --- a/pytorrent/services/smart_queue.py +++ b/pytorrent/services/smart_queue.py @@ -368,13 +368,14 @@ def _cleanup_auto_labels(client: Any, profile_id: int, torrents: list[dict[str, def _is_running_download_slot(t: dict[str, Any]) -> bool: - """Return True only for incomplete torrents that are currently allowed to run.""" - # Note: Samo state=1 nie wystarcza, bo d.pause w rTorrent zostawia state=1. - # Poprzednia logika traktowała pauzowane torrenty jako aktywne sloty, przez co Smart Queue - # nie dobijał do targetu i nie wybierał ich jako kandydatów do wznowienia. + """Return True for incomplete torrents that already occupy a Smart Queue slot.""" + # Note: Limit Smart Queue oznacza docelową liczbę slotów włączonych do pobierania. + # rTorrent często pokazuje d.is_active=0 dla torrentów bez chwilowego transferu, więc slot liczymy + # po d.state=1. Techniczny label Smart Queue jest wyjątkiem: oznacza pozycję oczekującą/pauzowaną, + # której nie wolno liczyć jako aktywnej. Dzięki temu przy limicie 100 i 82 slotach dobieramy 18. if int(t.get('complete') or 0): return False - if bool(t.get('paused')) or str(t.get('status') or '').lower() == 'paused': + if str(t.get('label') or '') == SMART_QUEUE_LABEL: return False if str(t.get('status') or '').lower() == 'checking': return False