Make posted library selection authoritative

This commit is contained in:
Sleeps
2026-10-07 12:28:13 +01:00
parent bb4620c7fa
commit 2f61e526c3
+9 -7
View File
@@ -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}