From 41f2d32b935c1d382cfd1ec54f0bd3082e96f9f3 Mon Sep 17 00:00:00 2001 From: Sleeps Date: Wed, 7 Oct 2026 13:54:56 +0100 Subject: [PATCH] Add index report drill-down to Jellyfin plugin --- .../Configuration/configPage.html | 111 +++++++++++++++++- 1 file changed, 109 insertions(+), 2 deletions(-) diff --git a/jellyfin-plugin/Jellyfin.Plugin.SceneSearch/Configuration/configPage.html b/jellyfin-plugin/Jellyfin.Plugin.SceneSearch/Configuration/configPage.html index 3af5afc..70fa1fa 100644 --- a/jellyfin-plugin/Jellyfin.Plugin.SceneSearch/Configuration/configPage.html +++ b/jellyfin-plugin/Jellyfin.Plugin.SceneSearch/Configuration/configPage.html @@ -70,7 +70,17 @@ -
+
+
+ + + +
+
+
+

Captioning

@@ -115,6 +125,9 @@ var lastIndexRunning = false; var lastCaptionRunning = false; var lastCaptionStatus = null; + var reportCategory = null; + var reportOffset = 0; + var reportTotal = 0; function selectedLibraryIds() { return Array.prototype.slice.call( @@ -200,6 +213,79 @@ } } + function refreshIndexReportSummary() { + return ApiClient.getJSON( + ApiClient.getUrl('Plugins/SceneSearch/IndexReport') + '?limit=1' + ).then(function (report) { + var summary = (report && report.summary) || {}; + page.querySelector('#reportFailed span').textContent = + 'Failed (' + (summary.failed || 0) + ')'; + page.querySelector('#reportRemoved span').textContent = + 'Removed (' + (summary.pruned || 0) + ')'; + page.querySelector('#reportIndexed span').textContent = + 'Indexed (' + (summary.indexed || 0) + ')'; + if (!report || !report.available) { + page.querySelector('#indexReportMeta').textContent = + 'No saved index report yet.'; + } + }).catch(function () { + // Status remains usable even if no report is available. + }); + } + + function loadIndexReport(category, append) { + append = !!append; + var offset = append ? reportOffset : 0; + var url = ApiClient.getUrl('Plugins/SceneSearch/IndexReport') + + '?category=' + encodeURIComponent(category) + + '&offset=' + offset + '&limit=200'; + + return ApiClient.getJSON(url).then(function (report) { + reportCategory = category; + var items = (report && report.items) || []; + reportOffset = offset + items.length; + reportTotal = Number((report && report.total) || 0); + + var container = page.querySelector('#indexReportList'); + if (!append) { + container.innerHTML = ''; + } + + items.forEach(function (item) { + var row = document.createElement('div'); + row.style.cssText = + 'padding:.65em 0;border-bottom:1px solid rgba(255,255,255,.12)'; + + var title = document.createElement('strong'); + title.textContent = item.title || item.item_id || '(unnamed)'; + row.appendChild(title); + + var meta = document.createElement('div'); + meta.className = 'fieldDescription'; + meta.textContent = + (item.library || item.library_id || '') + + (item.item_id ? ' · ' + item.item_id : ''); + row.appendChild(meta); + + var reason = document.createElement('div'); + reason.textContent = item.reason || ''; + row.appendChild(reason); + container.appendChild(row); + }); + + page.querySelector('#indexReportMeta').textContent = + reportTotal + ' ' + category + ' item' + + (reportTotal === 1 ? '' : 's') + + (report.finished_at ? ' · last run ' + report.finished_at : ''); + + page.querySelector('#indexReportMore').style.display = + reportOffset < reportTotal ? '' : 'none'; + }).catch(function () { + page.querySelector('#indexReportMeta').textContent = + 'Could not load the saved index report.'; + }); + } + function refreshStatus() { return ApiClient.getJSON(ApiClient.getUrl('Plugins/SceneSearch/IndexStatus')) .then(function (status) { @@ -208,6 +294,7 @@ if (lastIndexRunning && !running) { loadLibraries(); + refreshIndexReportSummary(); } lastIndexRunning = running; }) @@ -346,7 +433,12 @@ page.querySelector('#maxResults').value = config.MaxResults || 20; page.querySelector('#timeoutSeconds').value = config.TimeoutSeconds || 60; - return Promise.all([loadLibraries(), refreshStatus(), refreshCaptionStatus()]); + return Promise.all([ + loadLibraries(), + refreshStatus(), + refreshCaptionStatus(), + refreshIndexReportSummary() + ]); }).then(function () { if (!statusTimer) { statusTimer = setInterval(refreshStatus, 2000); @@ -370,6 +462,21 @@ } }); + page.querySelector('#reportFailed').addEventListener('click', function () { + loadIndexReport('failed', false); + }); + page.querySelector('#reportRemoved').addEventListener('click', function () { + loadIndexReport('removed', false); + }); + page.querySelector('#reportIndexed').addEventListener('click', function () { + loadIndexReport('indexed', false); + }); + page.querySelector('#indexReportMore').addEventListener('click', function () { + if (reportCategory) { + loadIndexReport(reportCategory, true); + } + }); + page.querySelector('#applyLibraries').addEventListener('click', function () { var ids = selectedLibraryIds(); if (!ids.length && !window.confirm(