Enhance PVideoDl with finished_at tracking for downloads and UI updates. Added finished_at field to Download model, updated storage to handle legacy databases, and improved frontend to display recent downloads. Refactored scripts for better clarity and error handling.

This commit is contained in:
Leonid Pershin
2026-06-19 16:27:20 +03:00
parent 303de2b26c
commit 3e47e95fc4
14 changed files with 316 additions and 126 deletions
+8 -2
View File
@@ -13,7 +13,7 @@ import logging
from app.core.events import EventBus
from app.core.queue import DownloadQueue
from app.core.storage import Storage
from app.models import Download, DownloadEvent, DownloadStatus
from app.models import Download, DownloadEvent, DownloadStatus, _now
from app.services.downloader import Progress, pick_downloader
logger = logging.getLogger("pvideodl.worker")
@@ -89,7 +89,12 @@ class WorkerPool:
except Exception as exc: # noqa: BLE001
logger.warning("Ошибка скачивания %s: %s", download.url, exc)
failed = await self._storage.update(
download_id, status=DownloadStatus.FAILED, error=str(exc), speed=None, eta=None
download_id,
status=DownloadStatus.FAILED,
error=str(exc),
speed=None,
eta=None,
finished_at=_now(),
)
await self._publish("failed", failed)
return
@@ -104,6 +109,7 @@ class WorkerPool:
speed=None,
eta=0,
error=None,
finished_at=_now(),
)
await self._publish("done", done)