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:
@@ -34,6 +34,8 @@ class SettingsOut(BaseModel):
|
||||
feed_weight_affinity: float = 5.0
|
||||
feed_weight_channel: float = 5.0
|
||||
use_oauth2: bool = False
|
||||
sync_interval_hours: int = 0
|
||||
subtitle_langs: str = ""
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
@@ -55,6 +57,8 @@ class SettingsPatch(BaseModel):
|
||||
feed_weight_affinity: Optional[float] = Field(None, ge=0.0, le=10.0)
|
||||
feed_weight_channel: Optional[float] = Field(None, ge=0.0, le=10.0)
|
||||
use_oauth2: Optional[bool] = None
|
||||
sync_interval_hours: Optional[int] = Field(None, ge=0, le=168)
|
||||
subtitle_langs: Optional[str] = None
|
||||
|
||||
|
||||
def _get_or_create(db: Session, user_id: int) -> UserSettings:
|
||||
@@ -123,6 +127,10 @@ def update_settings(
|
||||
if body.use_oauth2 is not None:
|
||||
s.use_oauth2 = body.use_oauth2
|
||||
ytdlp.set_oauth2(body.use_oauth2)
|
||||
if body.sync_interval_hours is not None:
|
||||
s.sync_interval_hours = body.sync_interval_hours
|
||||
if body.subtitle_langs is not None:
|
||||
s.subtitle_langs = body.subtitle_langs.strip()
|
||||
|
||||
db.commit()
|
||||
db.refresh(s)
|
||||
|
||||
Reference in New Issue
Block a user