From 2f61e526c3727cfccb16f08016a20ca4a2b32b82 Mon Sep 17 00:00:00 2001 From: Sleeps Date: Wed, 7 Oct 2026 12:28:13 +0100 Subject: [PATCH] Make posted library selection authoritative --- scene_search/jellyfin_index.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scene_search/jellyfin_index.py b/scene_search/jellyfin_index.py index d812e3a..9089296 100644 --- a/scene_search/jellyfin_index.py +++ b/scene_search/jellyfin_index.py @@ -450,12 +450,14 @@ def _restore_frame_annotations( return len(matches) -def reconcile_removed_libraries(client: JellyfinClient) -> dict[str, object]: - """Prune canonical rows whose Jellyfin library no longer exists.""" - current_ids = { - str(library.get("Id") or "") - for library in client.media_folders() - if str(library.get("Id") or "") +def reconcile_selected_libraries( + selected_library_ids: set[str], +) -> dict[str, object]: + """Make the plugin/dashboard library selection authoritative locally.""" + selected = { + str(value).strip() + for value in selected_library_ids + if str(value).strip() } removed_library_ids: list[str] = [] @@ -474,7 +476,7 @@ def reconcile_removed_libraries(client: JellyfinClient) -> dict[str, object]: stale = [ row for row in rows - if str(row["jellyfin_library_id"]) not in current_ids + if str(row["jellyfin_library_id"]) not in selected ] removed_library_ids = sorted( {str(row["jellyfin_library_id"]) for row in stale}