Add per-video subtitle language picker on Watch page
- fetch_available_subs() queries yt-dlp for manual + auto-generated
subtitle langs available on YouTube for any given video
- GET /api/videos/by-yt/{ytId}/subs exposes this to the frontend
- DownloadRequest now accepts subtitle_langs to override the global
setting on a per-download basis
- Watch page fetches available subtitle langs on load (in parallel),
shows a CC dropdown with manual langs + auto-generated langs labeled
"(auto)"; selected lang is passed through to the download
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ router = APIRouter()
|
||||
class DownloadRequest(BaseModel):
|
||||
youtube_video_id: str
|
||||
quality: Optional[str] = None
|
||||
subtitle_langs: Optional[str] = None # overrides user setting when provided
|
||||
|
||||
|
||||
TRASH_TTL_DAYS = 7
|
||||
@@ -127,7 +128,10 @@ def create_download(
|
||||
user_settings = db.query(UserSettings).filter_by(user_id=current_user.id).first()
|
||||
default_quality = user_settings.preferred_quality if user_settings else "best"
|
||||
quality = body.quality if body.quality in ytdlp.QUALITY_FORMATS else default_quality
|
||||
subtitle_langs = (user_settings.subtitle_langs or "") if user_settings else ""
|
||||
if body.subtitle_langs is not None:
|
||||
subtitle_langs = body.subtitle_langs.strip()
|
||||
else:
|
||||
subtitle_langs = (user_settings.subtitle_langs or "") if user_settings else ""
|
||||
|
||||
_DL_SELECT = """
|
||||
SELECT d.id, d.status, d.progress_percent, d.resolution,
|
||||
|
||||
Reference in New Issue
Block a user