auto-commit for b6946a78-11ff-4dc8-85b6-12e35b57d256

This commit is contained in:
emergent-agent-e1
2026-04-29 16:34:49 +00:00
parent da8a2903b4
commit 21cdd24116
3 changed files with 22 additions and 9 deletions
+2 -2
View File
@@ -630,8 +630,8 @@ async def cancel_job(job_id: str, user: dict = Depends(require_admin)):
raise HTTPException(status_code=400, detail="Cannot cancel a running job")
await db.transcode_queue.update_one({"id": job_id}, {"$set": {"status": "cancelled", "finished_at": datetime.now(timezone.utc).isoformat()}})
if job["status"] == "pending":
# Reset movie hls_status so a new transcode can be triggered
await db.movies.update_one({"id": job["movie_id"]}, {"$set": {"hls_status": None}})
# Reset movie hls_status AND clear stale hls_path so the row no longer shows as transcoded
await db.movies.update_one({"id": job["movie_id"]}, {"$set": {"hls_status": None, "hls_path": None}})
return {"ok": True}
+5
View File
@@ -113,6 +113,11 @@ export default function TranscodeQueue() {
</span>
<span className="col-span-2 text-xs text-[#8A8A8A]">{new Date(j.created_at).toLocaleString()}</span>
<div className="col-span-1 flex justify-end gap-2">
{j.status === "running" && (
<button disabled className="text-[#444] cursor-not-allowed" title="Cannot cancel a running job" aria-label="Running">
<X size={14} strokeWidth={1.5} />
</button>
)}
{j.status === "pending" && (
<button onClick={() => cancel(j.id)} className="text-[#8A8A8A] hover:text-[#fca5a5]" data-testid={`cancel-${j.id}`} aria-label="Cancel">
<X size={14} strokeWidth={1.5} />
+15 -7
View File
@@ -44,17 +44,25 @@
- **Admin Settings page** for TMDB + Radarr config with masked inputs + connection test
### Phase 3 (2026-04-29)
- **Adaptive bitrate (ABR) HLS**: admin can choose Quick (stream-copy, single-rate, instant) OR ABR (re-encode to 360p/480p/720p/1080p with master playlist)
- **Smart variant selection**: ABR ladder auto-trims to source resolution (no upscaling)
- **Auth-aware playlist serving**: master.m3u8 and per-variant playlists are rewritten on serve to inject `?auth=token` into all relative URLs, so hls.js segment requests stay authenticated
- **Quality badge** in admin row shows whether HLS is `Quick` or `ABR`
- **Defensive `-pix_fmt yuv420p`** ensures encoder works across all source chroma formats
- Verified end-to-end: 720p source → 3 variants (720p/480p/360p) generated in seconds with proper master playlist
- **Adaptive bitrate (ABR) HLS**: admin chooses Quick (stream-copy, instant) or ABR (re-encode to 360p/480p/720p/1080p with master playlist)
- Smart variant selection: ladder auto-trims to source resolution (no upscaling)
- Auth-aware playlist serving rewrites `?auth=` into every relative URL so hls.js segment requests stay authenticated
- Quality badge in admin row shows `HLS done · Quick` or `HLS done · ABR`
- Defensive `-pix_fmt yuv420p` ensures encoder works across all source chroma formats
### Phase 4 (2026-04-29)
- **Background Transcode Queue** with persistent storage in MongoDB
- Single FIFO worker started at backend boot; processes one job at a time
- ffmpeg runs at **low CPU priority** (`nice -n 19`) so streaming + UI stay snappy during transcodes
- **Auto-transcode** toggle in Settings: Off / Quick / ABR — applied to every new upload AND Radarr import
- **Pause/resume** queue, **cancel** pending jobs, **retry** failed/cancelled jobs, **clear** finished history
- **Stat tiles** (pending/running/done/failed/cancelled) on `/admin/queue`
- **Crash recovery**: stuck `running` jobs are reset to `failed` on backend restart
- Cancel of a pending job clears `hls_path` to avoid stale references
## Backlog (P1)
- Sonarr (TV shows): requires episodes/seasons data model — significant addition
- Subtitle search via OpenSubtitles API
- Multi-bitrate HLS (current is single-rate stream-copy)
- Trakt.tv sync (mark watched, ratings)
- DLNA/Chromecast casting