feat: timeline and folder import

This commit is contained in:
2026-04-07 00:42:22 +02:00
parent 6d1b227fb9
commit 78e12e8309
20 changed files with 1036 additions and 75 deletions

View File

@@ -48,14 +48,25 @@ async def trigger_scan():
return {"status": "success", "message": "Library scan started"}
@router.get("/scan/status")
async def get_scan_status():
async def get_scan_status(db: AsyncSession = Depends(get_db)):
"""Get current scan status"""
# This would connect to Celery to get task status
# For now, return a simple response
import redis
from app.config import settings
# Connect to Redis to get scan status
r = redis.Redis.from_url(settings.redis_url)
# Get scan status from Redis (set by worker tasks)
is_scanning = r.get('scan:active') == b'true'
current_folder = r.get('scan:current_folder')
processed_files = int(r.get('scan:processed_files') or 0)
total_files = int(r.get('scan:total_files') or 0)
errors = r.lrange('scan:errors', 0, -1)
return {
"status": "idle",
"progress": 0,
"current_folder": None,
"queued": 0,
"done": 0
"is_scanning": is_scanning,
"current_folder": current_folder.decode() if current_folder else None,
"processed_files": processed_files,
"total_files": total_files,
"errors": [e.decode() for e in errors] if errors else []
}