diff --git a/scene_search/web/index.html b/scene_search/web/index.html index 2677738..45c846f 100644 --- a/scene_search/web/index.html +++ b/scene_search/web/index.html @@ -72,10 +72,11 @@ -
Deselected libraries are removed from Scene Search SQLite and Meilisearch when you apply the selection.
+
Apply selection removes deselected libraries directly from SQLite and Meilisearch. It does not rebuild the whole search index.
Loading…
- + +
@@ -239,6 +240,37 @@ } } + async function applyLibrarySelection() { + const ids = selectedLibraries(); + if (!ids.length && !window.confirm( + 'No libraries are selected. This will remove all Jellyfin-backed Scene Search data from SQLite and Meilisearch. Continue?' + )) { + return; + } + + try { + $('indexStatus').className = 'status'; + $('indexStatus').textContent = 'Applying library selection...'; + const result = await api('/api/jellyfin/libraries/selection', { + method:'POST', + body:JSON.stringify({library_ids:ids, force:false}) + }); + const removedLibraries = Number(result.removed_libraries || 0); + const removedMedia = Number(result.removed_media || 0); + $('indexStatus').className = 'status ok'; + $('indexStatus').textContent = removedLibraries + ? 'Selection applied: removed ' + removedLibraries + ' librar' + + (removedLibraries === 1 ? 'y' : 'ies') + ' and ' + removedMedia + ' media items' + : 'Selection applied: nothing to remove'; + $('indexDetail').textContent = 'No full Meilisearch rebuild was run.'; + await loadLibraries(); + refreshHealth(); + } catch (e) { + $('indexStatus').className = 'status error'; + $('indexStatus').textContent = e.message; + } + } + async function startIndex() { const ids = selectedLibraries(); if (!ids.length && !window.confirm( @@ -436,6 +468,7 @@ }; $('refreshLibraries').onclick = loadLibraries; $('selectAll').onclick = () => document.querySelectorAll('.libraryCheck').forEach(x => x.checked = true); + $('applyLibraries').onclick = applyLibrarySelection; $('indexNow').onclick = startIndex; $('captionNow').onclick = startCaption; $('captionPause').onclick = toggleCaptionPause;