new functions
This commit is contained in:
@@ -36,22 +36,28 @@ def _has_error(row: dict) -> bool:
|
||||
return bool(message and any(pattern in message for pattern in _ERROR_PATTERNS))
|
||||
|
||||
|
||||
def _is_checking(row: dict) -> bool:
|
||||
return str(row.get("status") or "") == "Checking" or _number(row, "hashing") > 0
|
||||
|
||||
|
||||
def _matches(row: dict, summary_type: str) -> bool:
|
||||
status = str(row.get("status") or "")
|
||||
checking = _is_checking(row)
|
||||
if summary_type == "all":
|
||||
return True
|
||||
if summary_type == "downloading":
|
||||
return not bool(row.get("complete")) and bool(row.get("state")) and not bool(row.get("paused"))
|
||||
return not checking and not bool(row.get("complete")) and bool(row.get("state")) and not bool(row.get("paused"))
|
||||
if summary_type == "seeding":
|
||||
return status != "Checking" and bool(row.get("complete")) and bool(row.get("state")) and not bool(row.get("paused"))
|
||||
return not checking and bool(row.get("complete")) and bool(row.get("state")) and not bool(row.get("paused"))
|
||||
if summary_type == "paused":
|
||||
return bool(row.get("paused")) or status == "Paused"
|
||||
return not checking and (bool(row.get("paused")) or status == "Paused")
|
||||
if summary_type == "checking":
|
||||
return status == "Checking" or _number(row, "hashing") > 0
|
||||
return checking
|
||||
if summary_type == "error":
|
||||
return _has_error(row)
|
||||
if summary_type == "stopped":
|
||||
return not bool(row.get("state"))
|
||||
# Note: Stopped count follows the UI filter exactly, so torrents being hash-checked do not inflate an empty Stopped list.
|
||||
return not checking and not bool(row.get("state"))
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user