Add search availability filter for sub and dub anime

This commit is contained in:
Dymas committed 2026-10-13 18:54:37 +02:00
1 parent 5208c61743
commit 7b453ff492
5 files changed
+30 -6

No files matched your search

+5
View File
@@ -1,5 +1,10 @@
# Changelog
## 0.54.4 - 2026-10-13
- Added a Search availability filter for Sub, Dub, and Sub + Dub. Sub + Dub remains the default and shows the full provider result set; the other choices filter using each title's available episode languages without changing its download mode.
- Checked all three bundled anime providers against upstream; no updates were needed and the existing local patches remain.
## 0.54.3 - 2026-10-13
- Catalog existing Czech ASS/SSA/SUB/TTML sidecars alongside SRT/VTT, and skip English translation when a matching Czech sidecar already exists. Unsupported formats are visible but remain catalog-only.
+1
View File
@@ -5,6 +5,7 @@ Kaizoku is a local web app for searching, tracking, and downloading anime from A
## Features
- Search anime through the configured provider and tag results with available `SUB` and `DUB` episode languages, ignoring empty provider language groups that do not expose playable servers. Results already in any watchlist are highlighted green and tagged with their watchlist name.
- Filter Search results by Sub, Dub, or Sub + Dub (the default full result set) without changing the selected download mode.
- Choose the active provider from Config defaults or directly from the Search page.
- Prefer provider-supplied search artwork, with a local title-based thumbnail fallback when provider artwork is missing or broken.
- Fill Watchlist thumbnails from AnimeSchedule or AniDB title metadata when provider artwork is missing.
+1 -1
View File
@@ -1 +1 @@
0.54.3
0.54.4
+22 -4
View File
@@ -240,7 +240,7 @@ INDEX_HTML = r"""<!doctype html>
}
.search-panel .controls {
display: grid;
grid-template-columns: minmax(220px, 1fr) minmax(170px, 220px) auto;
grid-template-columns: minmax(220px, 1fr) minmax(150px, 200px) minmax(140px, 180px) auto;
align-items: end;
}
.results-panel {
@@ -481,6 +481,13 @@ INDEX_HTML = r"""<!doctype html>
<option value="pahe">AnimePahe</option>
</select>
</label>
<label for="searchLanguage">Availability
<select id="searchLanguage">
<option value="all" selected>Sub + Dub</option>
<option value="sub">Sub</option>
<option value="dub">Dub</option>
</select>
</label>
<button class="primary" id="searchBtn" type="button">Search</button>
</div>
<div class="notice" id="notice"></div>
@@ -689,6 +696,16 @@ INDEX_HTML = r"""<!doctype html>
return Boolean(item && item[`has_${mode}`]);
}
function renderFilteredResults() {
const language = $("searchLanguage").value;
const matches = language === "all" ? state.results : state.results.filter(item => modeAvailable(item, language));
renderResults(matches);
if (state.results.length && !matches.length) {
$("resultsMeta").textContent = `No ${language === "sub" ? "subbed" : "dubbed"} results found. Try Sub + Dub.`;
}
return matches.length;
}
async function loadSelectedEpisodes(mode) {
const requestId = ++state.episodeRequestId;
state.episodes = [];
@@ -767,8 +784,8 @@ INDEX_HTML = r"""<!doctype html>
const data = await api(`/api/search?q=${encodeURIComponent(query)}&mode=${state.config.mode}&provider=${encodeURIComponent(state.config.provider)}`);
if (requestId !== state.searchRequestId) return;
state.results = data.results;
renderResults(data.results);
setNotice(`${data.results.length} results`);
const matchCount = renderFilteredResults();
setNotice(`${matchCount} of ${data.results.length} results shown`);
} catch (error) {
if (requestId !== state.searchRequestId) return;
setNotice(error.message);
@@ -800,7 +817,7 @@ INDEX_HTML = r"""<!doctype html>
if (tracked) {
tracked.watchlist_category = data.item?.category || $("trackCategory").value;
tracked.watchlist_category_label = data.item?.category_label || ({watching:"Watching",planned:"Planned",finished:"Finished",dropped:"Dropped"}[tracked.watchlist_category] || "Watchlist");
renderResults(state.results);
renderFilteredResults();
}
closeSelectionModal();
} catch (error) {
@@ -842,6 +859,7 @@ INDEX_HTML = r"""<!doctype html>
}
$("searchBtn").addEventListener("click", search);
$("searchLanguage").addEventListener("change", renderFilteredResults);
$("search-query").addEventListener("keydown", (event) => {
if (event.key === "Enter") search();
});
+1 -1
View File
@@ -5129,7 +5129,7 @@ class TemplateHelperTests(unittest.TestCase):
def test_search_page_closes_selection_modal_after_successful_actions(self):
self.assertIn('setNotice(data.message || "Added to watchlist.");', APP.INDEX_HTML)
self.assertIn('renderResults(state.results);\n }\n closeSelectionModal();', APP.INDEX_HTML)
self.assertIn('renderFilteredResults();\n }\n closeSelectionModal();', APP.INDEX_HTML)
self.assertIn('setNotice("Added to queue. Open Queue to monitor progress.");\n closeSelectionModal();', APP.INDEX_HTML)
def test_search_page_selection_modal_controls_download_mode(self):