Add live download progress updates
Magent CI/CD / verify (push) Successful in 12m15s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Successful in 21s

This commit is contained in:
2026-08-29 20:52:49 +12:00
parent 655e2f8158
commit 96fc43365f
5 changed files with 242 additions and 35 deletions
+3 -3
View File
@@ -382,14 +382,14 @@ def _artwork_url(path: Optional[str], size: str, cache_mode: str) -> Optional[st
return f"https://image.tmdb.org/t/p/{size}{path}"
def _torrent_progress(torrent: Dict[str, Any]) -> Optional[int]:
def _torrent_progress(torrent: Dict[str, Any]) -> Optional[float]:
progress = torrent.get("progress")
try:
numeric = float(progress)
except (TypeError, ValueError):
numeric = -1
if 0 <= numeric <= 1:
return round(numeric * 100)
return round(numeric * 100, 1)
try:
size = float(torrent.get("size"))
amount_left = float(torrent.get("amount_left"))
@@ -397,7 +397,7 @@ def _torrent_progress(torrent: Dict[str, Any]) -> Optional[int]:
return None
if size <= 0:
return None
return max(0, min(100, round(((size - amount_left) / size) * 100)))
return max(0.0, min(100.0, round(((size - amount_left) / size) * 100, 1)))
def _build_presentation(