feat: flat design Sunset Glitch + download manager + settings + recommendations overhaul
- Sunset Glitch color palette applied to all templates - Font Awesome icons throughout UI - Download manager with parallel queue and progress tracking - Settings page with dynamic configuration - Recommendations router enhanced with scoring - Local vendor libs (Alpine.js, HTMX) for offline support - Auto test suite with screenshots - Series releases list component - New download model
This commit is contained in:
@@ -86,12 +86,17 @@ async def startup_event():
|
||||
|
||||
|
||||
def restore_completed_downloads():
|
||||
"""Scan downloads directory and restore completed download tasks"""
|
||||
"""Restore download tasks: first from the database, then scan for untracked files."""
|
||||
# Step 1: Load persisted tasks from database
|
||||
download_manager._load_tasks_from_db()
|
||||
|
||||
# Step 2: Scan downloads directory for files not yet tracked in the database
|
||||
download_dir = Path("downloads")
|
||||
if not download_dir.exists():
|
||||
return
|
||||
|
||||
video_extensions = {".mp4", ".mkv", ".avi", ".mov", ".wmv", ".flv", ".webm"}
|
||||
tracked_filenames = {t.filename for t in download_manager.tasks.values()}
|
||||
|
||||
for file_path in download_dir.iterdir():
|
||||
if file_path.is_file() and file_path.suffix.lower() in video_extensions:
|
||||
@@ -99,6 +104,11 @@ def restore_completed_downloads():
|
||||
continue
|
||||
|
||||
filename = file_path.name
|
||||
|
||||
# Skip if already tracked in DB
|
||||
if filename in tracked_filenames:
|
||||
continue
|
||||
|
||||
file_size = file_path.stat().st_size
|
||||
|
||||
task_id = str(uuid.uuid4())
|
||||
@@ -118,7 +128,8 @@ def restore_completed_downloads():
|
||||
)
|
||||
|
||||
download_manager.tasks[task_id] = task
|
||||
logger.info(f"Restored completed download: {filename}")
|
||||
download_manager._save_task_to_db(task)
|
||||
logger.info(f"Restored untracked completed download: {filename}")
|
||||
|
||||
|
||||
# Restore completed downloads on startup
|
||||
|
||||
Reference in New Issue
Block a user