Initial commit — Movie Night media discovery app
AI-powered web app that recommends unwatched movies from a Jellyfin library based on natural language mood input. Jellyfin auth, modular LLM backend (Claude/OpenAI/Ollama), two-tier pre-filter + AI ranking, mobile-responsive dark theme UI with poster cards and deep links. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import asyncio
|
||||
|
||||
from fastapi import APIRouter, Request
|
||||
|
||||
from app.database import get_db
|
||||
from app.routers.auth import get_current_user
|
||||
from app.services.library_sync import sync_movie_metadata, sync_watch_state
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/stats")
|
||||
async def library_stats(request: Request):
|
||||
await get_current_user(request)
|
||||
|
||||
db = await get_db()
|
||||
try:
|
||||
cursor = await db.execute("SELECT COUNT(*) as count FROM movies")
|
||||
row = await cursor.fetchone()
|
||||
total_movies = row["count"]
|
||||
|
||||
cursor = await db.execute(
|
||||
"SELECT value FROM sync_status WHERE key = 'last_metadata_sync'"
|
||||
)
|
||||
row = await cursor.fetchone()
|
||||
last_sync = row["value"] if row else None
|
||||
|
||||
return {
|
||||
"total_movies": total_movies,
|
||||
"last_sync": last_sync,
|
||||
}
|
||||
finally:
|
||||
await db.close()
|
||||
|
||||
|
||||
@router.post("/sync")
|
||||
async def trigger_sync(request: Request):
|
||||
await get_current_user(request)
|
||||
asyncio.create_task(_do_sync())
|
||||
return {"status": "sync started"}
|
||||
|
||||
|
||||
async def _do_sync():
|
||||
await sync_movie_metadata()
|
||||
await sync_watch_state()
|
||||
Reference in New Issue
Block a user