Add explicit authoritative library selection endpoint

This commit is contained in:
Sleeps
2026-10-07 12:33:53 +01:00
parent f0701ec1ef
commit b3999f6c65
+20
View File
@@ -137,6 +137,26 @@ def jellyfin_libraries() -> dict:
raise HTTPException(status_code=503, detail=str(exc)) from exc
@app.post(
"/api/jellyfin/libraries/selection",
dependencies=[Depends(require_api_key)],
)
def jellyfin_library_selection(request: IndexRequest) -> dict:
try:
with _job_start_lock:
if get_caption_jobs().running:
raise RuntimeError(
"Captioning is currently running. Wait for it to finish before changing indexed libraries."
)
return get_index_jobs().apply_library_selection(request.library_ids)
except RuntimeError as exc:
message = str(exc)
status = 409 if "running" in message.lower() else 400
raise HTTPException(status_code=status, detail=message) from exc
except Exception as exc:
raise HTTPException(status_code=503, detail=str(exc)) from exc
@app.post(
"/api/jellyfin/index",
dependencies=[Depends(require_api_key)],