mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-19 00:03:36 +00:00
Add explicit authoritative library selection endpoint
This commit is contained in:
@@ -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)],
|
||||
|
||||
Reference in New Issue
Block a user