Add subtitle-only download for already-downloaded videos

- download_subs_only(): yt-dlp --skip-download to fetch just .vtt sidecar
- POST /by-yt/{ytId}/download-subs endpoint
- CC chip now visible on downloaded videos; clicking checks YouTube,
  shows lang picker with "Add subtitles" button separate from re-download

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 21:16:30 +02:00
parent 27f17c16ef
commit bbf8365c70
4 changed files with 76 additions and 17 deletions

View File

@@ -666,6 +666,22 @@ def get_available_subs(
return ytdlp.fetch_available_subs(youtube_video_id)
@router.post("/by-yt/{youtube_video_id}/download-subs")
def download_subs(
youtube_video_id: str,
body: dict,
current_user: User = Depends(get_current_user),
):
"""Download subtitle file(s) only for an already-downloaded video."""
langs = (body.get("subtitle_langs") or "").strip()
if not langs:
raise HTTPException(status_code=400, detail="subtitle_langs required")
ok = ytdlp.download_subs_only(youtube_video_id, langs)
if not ok:
raise HTTPException(status_code=500, detail="Subtitle download failed")
return {"ok": True}
@router.get("/by-yt/{youtube_video_id}/subtitle-files")
def list_subtitle_files(
youtube_video_id: str,