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}