From de2203a53dbf9957c190051dd0f1e33df0269fee Mon Sep 17 00:00:00 2001 From: SBCrumb Date: Mon, 3 Nov 2025 10:49:30 -0500 Subject: [PATCH] udpates: to database population --- nfoguard-web/api/web_routes.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nfoguard-web/api/web_routes.py b/nfoguard-web/api/web_routes.py index 6c304a2..4b41b20 100644 --- a/nfoguard-web/api/web_routes.py +++ b/nfoguard-web/api/web_routes.py @@ -1136,8 +1136,8 @@ async def get_populate_status(): def register_web_routes(app, dependencies): """Register all web API routes with FastAPI app""" from fastapi import Request, Response - - # Dashboard and stats endpoints + + # Dashboard and stats endpoints @app.get("/api/dashboard") async def api_dashboard(): return await get_dashboard_stats(dependencies) @@ -1259,8 +1259,14 @@ def register_web_routes(app, dependencies): # Database population endpoints @app.post("/admin/populate-database") - async def api_populate_database(background_tasks: BackgroundTasks, media_type: str = "both"): + async def api_populate_database(request: Request, background_tasks: BackgroundTasks): """Populate database from Radarr/Sonarr""" + try: + data = await request.json() + media_type = data.get("media_type", "both") + except Exception: + # Fallback to query parameter if JSON parsing fails + media_type = request.query_params.get("media_type", "both") return await populate_database(background_tasks, media_type, dependencies) @app.get("/api/populate/status")