Major overhaul to the theme and now functioning.

This commit is contained in:
2026-01-05 16:07:30 -05:00
parent 5823ca3c39
commit a475dfeab6
5218 changed files with 1643729 additions and 13229 deletions
@@ -0,0 +1,43 @@
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
from typing import Optional, List
from ..downloader_manager import manager
router = APIRouter()
class DownloadRequest(BaseModel):
urls: List[str]
download_images: bool = True
download_videos: bool = True
max_workers: int = 3
force_overwrite: bool = False
class StatusResponse(BaseModel):
active: bool
status: str
downloaded: int
total: int
speed: float
eta: float
current_file: str
@router.post("/start")
def start_download(request: DownloadRequest):
try:
manager.start_download(request.urls, request.model_dump())
return {"message": "Download started"}
except Exception as e:
raise HTTPException(status_code=400, detail=str(e))
@router.post("/cancel")
def cancel_download():
manager.cancel_download()
return {"message": "Cancellation requested"}
@router.get("/status", response_model=StatusResponse)
def get_status():
return manager.progress
@router.get("/logs", response_model=List[str])
def get_logs():
return manager.logs