smart queue fix
This commit is contained in:
@@ -304,10 +304,12 @@ def _is_smart_queue_hold(torrent: dict[str, Any] | None, manage_stopped: bool =
|
|||||||
return False
|
return False
|
||||||
if str(torrent.get('label') or '') == SMART_QUEUE_LABEL:
|
if str(torrent.get('label') or '') == SMART_QUEUE_LABEL:
|
||||||
return True
|
return True
|
||||||
# Note: Gdy manage_stopped=False, techniczne labele Smart Queue dotyczą tylko paused, a nie całkiem zatrzymanych torrentów.
|
# Note: Paused w rTorrent zwykle ma state=1 i active=0, więc nie wolno wymagać state=0.
|
||||||
if bool(torrent.get('paused')) and not int(torrent.get('state') or 0):
|
# Dzięki temu Smart Queue widzi pauzowane torrenty jako oczekujące i może później dobić target kolejki.
|
||||||
|
if bool(torrent.get('paused')):
|
||||||
return True
|
return True
|
||||||
if not manage_stopped and not int(torrent.get('state') or 0):
|
# Note: Całkiem zatrzymane pozycje są zarządzane tylko po włączeniu opcji Use stopped torrents.
|
||||||
|
if not manage_stopped:
|
||||||
return False
|
return False
|
||||||
return not int(torrent.get('state') or 0)
|
return not int(torrent.get('state') or 0)
|
||||||
|
|
||||||
@@ -352,14 +354,17 @@ def _cleanup_auto_labels(client: Any, profile_id: int, torrents: list[dict[str,
|
|||||||
|
|
||||||
|
|
||||||
def _is_running_download_slot(t: dict[str, Any]) -> bool:
|
def _is_running_download_slot(t: dict[str, Any]) -> bool:
|
||||||
"""Return True for torrents already started by rTorrent."""
|
"""Return True only for incomplete torrents that are currently allowed to run."""
|
||||||
# Note: Nie używamy d.is_active/paused do liczenia slotów Smart Queue.
|
# Note: Samo state=1 nie wystarcza, bo d.pause w rTorrent zostawia state=1.
|
||||||
# active=0 może oznaczać brak transferu/peerów, a nie wolny slot. Liczenie po active
|
# Poprzednia logika traktowała pauzowane torrenty jako aktywne sloty, przez co Smart Queue
|
||||||
# powodowało startowanie kolejki po 1 sztuce mimo targetu 100.
|
# nie dobijał do targetu i nie wybierał ich jako kandydatów do wznowienia.
|
||||||
return (
|
if int(t.get('complete') or 0):
|
||||||
not int(t.get('complete') or 0)
|
return False
|
||||||
and bool(int(t.get('state') or 0))
|
if bool(t.get('paused')) or str(t.get('status') or '').lower() == 'paused':
|
||||||
)
|
return False
|
||||||
|
if str(t.get('status') or '').lower() == 'checking':
|
||||||
|
return False
|
||||||
|
return bool(int(t.get('state') or 0))
|
||||||
|
|
||||||
|
|
||||||
def _is_waiting_download_candidate(t: dict[str, Any], manage_stopped: bool) -> bool:
|
def _is_waiting_download_candidate(t: dict[str, Any], manage_stopped: bool) -> bool:
|
||||||
@@ -368,8 +373,10 @@ def _is_waiting_download_candidate(t: dict[str, Any], manage_stopped: bool) -> b
|
|||||||
return False
|
return False
|
||||||
if str(t.get('label') or '') == SMART_QUEUE_LABEL:
|
if str(t.get('label') or '') == SMART_QUEUE_LABEL:
|
||||||
return True
|
return True
|
||||||
if bool(t.get('paused')):
|
# Note: Paused jest podstawowym źródłem dobijania kolejki, niezależnie od opcji manage_stopped.
|
||||||
|
if bool(t.get('paused')) or str(t.get('status') or '').lower() == 'paused':
|
||||||
return True
|
return True
|
||||||
|
# Note: Stopped dokładamy tylko wtedy, gdy użytkownik zaznaczył Use stopped torrents.
|
||||||
return bool(manage_stopped) and not int(t.get('state') or 0)
|
return bool(manage_stopped) and not int(t.get('state') or 0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user