Add scheduled sync, disk space awareness, and subtitle downloads
- auto-sync daemon: background thread checks every hour and syncs followed channels for users with sync_interval_hours set (6/12/24h options) - disk stats: /api/stats now returns total/used/free/download bytes; Stats page shows a disk usage bar - subtitles: subtitle_langs setting (e.g. "en,sv") passed through all download paths; yt-dlp writes .srt files alongside the video - Settings page: sync interval dropdown + subtitle languages input Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -621,17 +621,20 @@ def start_download(
|
||||
on_complete: Any,
|
||||
on_error: Any,
|
||||
quality: str = "best",
|
||||
subtitle_langs: str = "",
|
||||
) -> None:
|
||||
"""Start yt-dlp download in a background thread.
|
||||
|
||||
Uses a single progressive MP4 format so the file is playable as it downloads.
|
||||
--no-part writes directly to the final filename (no .part rename at the end).
|
||||
"""
|
||||
url = f"https://www.youtube.com/watch?v={video_id}"
|
||||
# Predictable output path — lets the player start before download finishes
|
||||
output_template = str(Path(settings.download_path) / f"{video_id}.%(ext)s")
|
||||
|
||||
fmt = QUALITY_FORMATS.get(quality, QUALITY_FORMATS["best"])
|
||||
subtitle_args = (
|
||||
["--write-subs", "--write-auto-subs", "--sub-langs", subtitle_langs, "--convert-subs", "srt"]
|
||||
if subtitle_langs else []
|
||||
)
|
||||
|
||||
def _run_download():
|
||||
with _SEMAPHORE:
|
||||
@@ -645,6 +648,7 @@ def start_download(
|
||||
"--no-part", "--no-mtime",
|
||||
"-o", output_template,
|
||||
"--newline", "--progress", "--no-colors",
|
||||
*subtitle_args,
|
||||
*cookie_args,
|
||||
],
|
||||
stdout=subprocess.PIPE,
|
||||
|
||||
Reference in New Issue
Block a user