Add explicit library selection reconciliation action

This commit is contained in:
Sleeps
2026-10-07 12:33:39 +01:00
parent 50703de4f8
commit f0701ec1ef
+24
View File
@@ -82,6 +82,30 @@ class IndexJobManager:
)
return result
def apply_library_selection(self, library_ids: list[str]) -> dict[str, object]:
with self._state_lock:
if self._state.get("running"):
raise RuntimeError("A Jellyfin indexing job is already running.")
selected_ids = {
str(value).strip()
for value in library_ids
if str(value).strip()
}
result = reconcile_selected_libraries(selected_ids)
removed_ids = [
str(value)
for value in (result.get("removed_library_ids") or [])
]
if removed_ids:
self.search_service.meili.delete_jellyfin_libraries(removed_ids)
print(
"Removed deselected Jellyfin libraries: "
+ ", ".join(removed_ids)
+ f" ({int(result.get('removed_media') or 0)} media item(s))"
)
return result
def start(self, library_ids: list[str], *, force: bool = False) -> dict[str, Any]:
with self._state_lock:
if self._state.get("running"):