From fc69656d1237955a90183466c6441df262d52a23 Mon Sep 17 00:00:00 2001 From: npeter83 Date: Fri, 3 Jul 2026 04:01:53 +0200 Subject: [PATCH] feat(downloads): granular post-processing phase labels ffmpeg post-steps have no byte-progress, so instead of a silent 'Processing' the row now names the current step (Merging / Extracting audio / Embedding thumbnail / Removing sponsors / Writing metadata) with an indeterminate pulse. Byte-progress phases (video/audio) keep the % bar. i18n en/hu/de. --- backend/app/worker.py | 25 ++++++++++++++++----- frontend/src/components/DownloadCenter.tsx | 10 ++++++--- frontend/src/i18n/locales/de/downloads.json | 4 ++++ frontend/src/i18n/locales/en/downloads.json | 4 ++++ frontend/src/i18n/locales/hu/downloads.json | 4 ++++ 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/backend/app/worker.py b/backend/app/worker.py index 20719da..1475f1b 100644 --- a/backend/app/worker.py +++ b/backend/app/worker.py @@ -246,15 +246,30 @@ def _make_progress_hook(job_id: int, asset_id: int): return hook +def _pp_phase(pp: str) -> str: + """Map a yt-dlp postprocessor class name to a user-facing phase label. ffmpeg post-steps + aren't byte-progress operations (no %), so the UI shows the step name + an indeterminate + pulse — this makes the long merge/finalize legible instead of a silent 'Processing'.""" + if "Merg" in pp: + return "merging" + if "ExtractAudio" in pp: + return "audio_extract" + if "Thumbnail" in pp: + return "thumbnail" + if "SponsorBlock" in pp or "ModifyChapters" in pp: + return "sponsorblock" + if "Metadata" in pp: + return "metadata" + return "processing" + + def _make_pp_hook(job_id: int): - """Postprocessor hook: surface the ffmpeg merge/convert/extract step so the bar shows a - 'Merging/Processing' label instead of freezing at 100% after the streams finish.""" + """Postprocessor hook: surface the current ffmpeg step so the bar shows a concrete label + (Merging / Embedding thumbnail / …) instead of freezing at 100% after the streams finish.""" def hook(d: dict) -> None: if d.get("status") in ("started", "processing"): - pp = d.get("postprocessor") or "" - phase = "merging" if "Merg" in pp else "processing" - _set_job(job_id, phase=phase, speed_bps=None, eta_s=None) + _set_job(job_id, phase=_pp_phase(d.get("postprocessor") or ""), speed_bps=None, eta_s=None) return hook diff --git a/frontend/src/components/DownloadCenter.tsx b/frontend/src/components/DownloadCenter.tsx index 7b1b406..8f6a441 100644 --- a/frontend/src/components/DownloadCenter.tsx +++ b/frontend/src/components/DownloadCenter.tsx @@ -36,7 +36,11 @@ const STATUS_CLS: Record = { canceled: "text-muted", }; -const PHASE_KEYS = ["video", "audio", "merging", "processing"]; +// Byte-progress phases (show a % bar) vs ffmpeg post-steps (no %, indeterminate pulse). +const DOWNLOAD_PHASES = ["video", "audio"]; +const PHASE_KEYS = [ + "video", "audio", "merging", "audio_extract", "thumbnail", "sponsorblock", "metadata", "processing", +]; function StatusPill({ job }: { job: DownloadJob }) { const { t } = useTranslation(); @@ -116,8 +120,8 @@ function DownloadRow({ {running && (
- {job.phase === "merging" || job.phase === "processing" ? ( - // No meaningful percentage during ffmpeg — show an indeterminate pulse. + {job.phase && !DOWNLOAD_PHASES.includes(job.phase) ? ( + // ffmpeg post-steps aren't byte-progress — show an indeterminate pulse, no %.
diff --git a/frontend/src/i18n/locales/de/downloads.json b/frontend/src/i18n/locales/de/downloads.json index 4a67e88..ccedd55 100644 --- a/frontend/src/i18n/locales/de/downloads.json +++ b/frontend/src/i18n/locales/de/downloads.json @@ -41,6 +41,10 @@ "video": "Video wird geladen", "audio": "Audio wird geladen", "merging": "Zusammenführen", + "audio_extract": "Audio wird extrahiert", + "thumbnail": "Vorschaubild einbetten", + "sponsorblock": "Sponsoren entfernen", + "metadata": "Metadaten schreiben", "processing": "Verarbeitung" }, "actions": { diff --git a/frontend/src/i18n/locales/en/downloads.json b/frontend/src/i18n/locales/en/downloads.json index 576a0f0..a5c43f0 100644 --- a/frontend/src/i18n/locales/en/downloads.json +++ b/frontend/src/i18n/locales/en/downloads.json @@ -41,6 +41,10 @@ "video": "Downloading video", "audio": "Downloading audio", "merging": "Merging", + "audio_extract": "Extracting audio", + "thumbnail": "Embedding thumbnail", + "sponsorblock": "Removing sponsors", + "metadata": "Writing metadata", "processing": "Processing" }, "actions": { diff --git a/frontend/src/i18n/locales/hu/downloads.json b/frontend/src/i18n/locales/hu/downloads.json index ea3866a..34f2eef 100644 --- a/frontend/src/i18n/locales/hu/downloads.json +++ b/frontend/src/i18n/locales/hu/downloads.json @@ -41,6 +41,10 @@ "video": "Videósáv letöltése", "audio": "Hangsáv letöltése", "merging": "Összefűzés", + "audio_extract": "Hang kinyerése", + "thumbnail": "Bélyegkép beágyazása", + "sponsorblock": "Szponzorok eltávolítása", + "metadata": "Metaadat írása", "processing": "Feldolgozás" }, "actions": {