78007461e1
Pluggable fetch source: ytmusicapi search + yt-dlp download (cookies-file guard), DownloadJob entity/repo + DownloadService, download_task worker with exponential-backoff retries, and wired /search, /sources/{source}/search, and /downloads endpoints. Adds youtube_enabled/cookies config, yt-dlp+ytmusicapi deps, and the download_jobs.track_id migration. Snapshot also bundles in-progress storage/tracks/acoustid edits.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
27 lines
708 B
Python
27 lines
708 B
Python
"""Download job domain entity (plan §6.1).
|
|
|
|
A queued fetch from an external source, tracked through its lifecycle so the UI
|
|
download manager (screen §A5) can show progress, errors, and retries. The
|
|
``status`` strings mirror :class:`~app.infrastructure.db.models.enums.DownloadStatus`.
|
|
"""
|
|
|
|
import datetime as dt
|
|
import uuid
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class DownloadJob:
|
|
id: uuid.UUID
|
|
source: str
|
|
source_id: str | None
|
|
query: str | None
|
|
requested_by: uuid.UUID | None
|
|
status: str
|
|
progress: float
|
|
error_message: str | None
|
|
retry_count: int
|
|
track_id: uuid.UUID | None
|
|
created_at: dt.datetime
|
|
updated_at: dt.datetime
|