diff --git a/backend/src/media_library_viewer_api/integrations/qbittorrent.py b/backend/src/media_library_viewer_api/integrations/qbittorrent.py
index 121d2ff..aaa73e1 100644
--- a/backend/src/media_library_viewer_api/integrations/qbittorrent.py
+++ b/backend/src/media_library_viewer_api/integrations/qbittorrent.py
@@ -117,7 +117,7 @@ DEFINITION = ServiceDefinition(
widget_kind(
kind="active",
name="Active torrents",
- description="Torrents currently downloading or uploading.",
+ description="All active download/upload work, including queued and stalled transfers.",
model_cls=QbittorrentWidgetConfig,
default_config={},
refresh_interval_ms=15_000,
diff --git a/backend/src/media_library_viewer_api/widgets/sources.py b/backend/src/media_library_viewer_api/widgets/sources.py
index f0aed93..40e5140 100644
--- a/backend/src/media_library_viewer_api/widgets/sources.py
+++ b/backend/src/media_library_viewer_api/widgets/sources.py
@@ -411,9 +411,10 @@ def _qbittorrent_client(cache_key: tuple[str, str, str, str, int]) -> Qbittorren
_QBITTORRENT_DOWNLOAD_STATES = frozenset(
- {"downloading", "forceddl", "stalleddl", "metadl", "allocating"}
+ {"downloading", "forceddl", "stalleddl", "queueddl", "metadl", "forcedmetadl", "allocating", "checkingdl"}
)
-_QBITTORRENT_UPLOAD_STATES = frozenset({"uploading", "forcedup", "stalledup"})
+_QBITTORRENT_UPLOAD_STATES = frozenset({"uploading", "forcedup", "stalledup", "queuedup", "checkingup"})
+_QBITTORRENT_OTHER_ACTIVE_STATES = frozenset({"checkingresumedata", "moving"})
def _qbit_torrent_direction(torrent: dict[str, Any]) -> str | None:
@@ -430,6 +431,11 @@ def _qbit_torrent_direction(torrent: dict[str, Any]) -> str | None:
return None
+def _qbit_torrent_is_active(torrent: dict[str, Any]) -> bool:
+ state = str(torrent.get("state") or "").lower()
+ return bool(_qbit_torrent_direction(torrent)) or state in _QBITTORRENT_OTHER_ACTIVE_STATES
+
+
class QbittorrentWidgetSource:
"""Fetch qBittorrent data for totals, active, and speed widgets."""
@@ -492,9 +498,9 @@ class QbittorrentWidgetSource:
if widget_kind == "active":
active = []
for torrent in torrents.values():
- direction = _qbit_torrent_direction(torrent)
- if not direction:
+ if not _qbit_torrent_is_active(torrent):
continue
+ direction = _qbit_torrent_direction(torrent)
active.append(
{
"name": torrent.get("name"),
diff --git a/backend/tests/test_widgets.py b/backend/tests/test_widgets.py
index 48faa9d..af002fe 100644
--- a/backend/tests/test_widgets.py
+++ b/backend/tests/test_widgets.py
@@ -1128,12 +1128,12 @@ async def test_qbittorrent_totals_counts_all_torrents():
assert result["by_state"]["uploading"] == 1
assert result["by_state"]["queuedDL"] == 1
assert result["by_state"]["pausedDL"] == 1
- assert result["by_direction"] == {"downloading": 2, "uploading": 2}
+ assert result["by_direction"] == {"downloading": 3, "uploading": 2}
@pytest.mark.asyncio
async def test_qbittorrent_active_filters_dl_ul_only():
- """Active kind returns only downloading/uploading torrents (Q3)."""
+ """Active kind returns all active download/upload states, including queued work."""
from media_library_viewer_api.widgets.sources import QbittorrentWidgetSource
adapter = QbittorrentWidgetSource()
@@ -1149,14 +1149,14 @@ async def test_qbittorrent_active_filters_dl_ul_only():
result = await adapter.fetch(service, "active", {})
active = result["torrents"]
- assert len(active) == 4
+ assert len(active) == 5
names = [t["name"] for t in active]
assert "Movie.mkv" in names
assert "Show.mkv" in names
assert "Forced download" in names
assert "Stalled upload" in names
- # Queued and paused are excluded
- assert "Queued" not in names
+ assert "Queued" in names
+ # Paused torrents remain excluded, but queued transfer work is visible.
assert "Paused" not in names
diff --git a/frontend/src/integrations/registry.ts b/frontend/src/integrations/registry.ts
index 442c697..9d44d64 100644
--- a/frontend/src/integrations/registry.ts
+++ b/frontend/src/integrations/registry.ts
@@ -210,7 +210,8 @@ export const SERVICE_REGISTRY: Record
- {formatSize(torrent.size)} · {formatProgress(torrent.progress)} + {formatSize(torrent.size)} ·{" "} + {formatProgress(torrent.progress)}