From a5595cf9f1785cfc2bc1771e69b596e486efc829 Mon Sep 17 00:00:00 2001 From: CaliBrain Date: Mon, 24 Aug 2026 17:54:10 -0400 Subject: [PATCH] Change test for fake extension that wont work (#1266) --- shelfmark/release_sources/prowlarr/source.py | 6 +++--- src/frontend/src/components/ReleaseCell.tsx | 2 +- src/frontend/src/tests/releaseFormats.test.ts | 8 ++++---- src/frontend/src/utils/releaseFormats.ts | 2 +- tests/prowlarr/test_source.py | 12 ++++++------ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/shelfmark/release_sources/prowlarr/source.py b/shelfmark/release_sources/prowlarr/source.py index a2e635f0..20fb7cc5 100644 --- a/shelfmark/release_sources/prowlarr/source.py +++ b/shelfmark/release_sources/prowlarr/source.py @@ -327,7 +327,7 @@ def _split_mam_formats(raw_title: str) -> tuple[list[str], list[str]]: heuristics for other indexers). Tokens after the "/" that Shelfmark does not know as a book or audiobook format - (e.g. ``[ENG / MP4]``) are returned separately so the UI can warn that the release + (e.g. ``[ENG / AVI]``) are returned separately so the UI can warn that the release will download but cannot be processed, instead of showing a bare content-type icon that looks like an ordinary result. """ @@ -572,8 +572,8 @@ def _prowlarr_result_to_release( "info_hash": result.get("infoHash"), "formats": formats or None, "formats_display": formats_display, - # Format tokens the indexer declared but Shelfmark can't process (#1264-style - # "[ENG / MP4]"). Lets the UI warn instead of showing a bare content icon. + # Format tokens the indexer declared but Shelfmark can't process (e.g. a MAM + # "[ENG / AVI]"). Lets the UI warn instead of showing a bare content icon. "unrecognized_formats": unrecognized_formats or None, # Raw torznab attributes for rich tooltips (enriched indexers) "torznab_attrs": result.get("torznabAttrs"), diff --git a/src/frontend/src/components/ReleaseCell.tsx b/src/frontend/src/components/ReleaseCell.tsx index 523e4766..8bf82933 100644 --- a/src/frontend/src/components/ReleaseCell.tsx +++ b/src/frontend/src/components/ReleaseCell.tsx @@ -425,7 +425,7 @@ export const ReleaseCell = ({ const primaryFormat = formats?.[0] || null; const additionalFormats = formats?.slice(1) || []; - // The indexer named a format Shelfmark can't process (e.g. MAM "[ENG / MP4]"). + // The indexer named a format Shelfmark can't process (e.g. MAM "[ENG / AVI]"). // Downloading it would only fail post-processing, so warn instead of showing the // bare content-type icon that makes it look like any other result. const unrecognizedFormats = primaryFormat ? [] : getUnrecognizedReleaseFormats(release); diff --git a/src/frontend/src/tests/releaseFormats.test.ts b/src/frontend/src/tests/releaseFormats.test.ts index 6d1af636..e57c9acb 100644 --- a/src/frontend/src/tests/releaseFormats.test.ts +++ b/src/frontend/src/tests/releaseFormats.test.ts @@ -42,16 +42,16 @@ describe('releaseFormats.getReleaseFormats', () => { describe('releaseFormats.getUnrecognizedReleaseFormats', () => { it('returns normalized, deduplicated unrecognized formats from extra', () => { const release = buildRelease({ - extra: { unrecognized_formats: ['MP4', ' mp4 ', 'WEBM'] }, + extra: { unrecognized_formats: ['AVI', ' avi ', 'WEBM'] }, }); - expect(getUnrecognizedReleaseFormats(release)).toEqual(['mp4', 'webm']); + expect(getUnrecognizedReleaseFormats(release)).toEqual(['avi', 'webm']); }); it('accepts a single string value', () => { - const release = buildRelease({ extra: { unrecognized_formats: 'MP4' } }); + const release = buildRelease({ extra: { unrecognized_formats: 'AVI' } }); - expect(getUnrecognizedReleaseFormats(release)).toEqual(['mp4']); + expect(getUnrecognizedReleaseFormats(release)).toEqual(['avi']); }); it('returns an empty list when nothing was flagged', () => { diff --git a/src/frontend/src/utils/releaseFormats.ts b/src/frontend/src/utils/releaseFormats.ts index 864e126b..e822c26c 100644 --- a/src/frontend/src/utils/releaseFormats.ts +++ b/src/frontend/src/utils/releaseFormats.ts @@ -36,7 +36,7 @@ export function getReleaseFormats(release: Release): string[] { /** * Format tokens the indexer declared but the backend could not map to a known - * book/audiobook format (e.g. MyAnonamouse "[ENG / MP4]"). Such a release will + * book/audiobook format (e.g. MyAnonamouse "[ENG / AVI]"). Such a release will * download but fail post-processing, so the UI warns instead of showing a bare * content-type icon. */ diff --git a/tests/prowlarr/test_source.py b/tests/prowlarr/test_source.py index e5cd28cf..6a4ee15f 100644 --- a/tests/prowlarr/test_source.py +++ b/tests/prowlarr/test_source.py @@ -1411,12 +1411,12 @@ class TestSplitMamFormats: def test_unrecognized_only_is_surfaced(self): from shelfmark.release_sources.prowlarr.source import _split_mam_formats - assert _split_mam_formats("The Martian by Andy Weir [ENG / MP4]") == ([], ["mp4"]) + assert _split_mam_formats("The Martian by Andy Weir [ENG / AVI]") == ([], ["avi"]) def test_mixed_keeps_both_sides(self): from shelfmark.release_sources.prowlarr.source import _split_mam_formats - assert _split_mam_formats("Title [ENG / M4B MP4]") == (["m4b"], ["mp4"]) + assert _split_mam_formats("Title [ENG / M4B AVI]") == (["m4b"], ["avi"]) def test_no_structured_bracket(self): from shelfmark.release_sources.prowlarr.source import _split_mam_formats @@ -1428,7 +1428,7 @@ class TestSplitMamFormats: from shelfmark.release_sources.prowlarr.source import _extract_mam_formats assert _extract_mam_formats("Title [ENG / MP3]") == ["mp3"] - assert _extract_mam_formats("Title [ENG / MP4]") == [] + assert _extract_mam_formats("Title [ENG / AVI]") == [] class TestUnrecognizedFormatOnRelease: @@ -1449,13 +1449,13 @@ class TestUnrecognizedFormatOnRelease: from shelfmark.release_sources.prowlarr.source import _prowlarr_result_to_release release = _prowlarr_result_to_release( - self._result("The Martian by Andy Weir [ENG / MP4]"), + self._result("The Martian by Andy Weir [ENG / AVI]"), "audiobook", enable_format_detection=True, ) assert release.format is None assert release.extra["formats"] is None - assert release.extra["unrecognized_formats"] == ["mp4"] + assert release.extra["unrecognized_formats"] == ["avi"] def test_recognized_format_leaves_unrecognized_empty(self): from shelfmark.release_sources.prowlarr.source import _prowlarr_result_to_release @@ -1472,6 +1472,6 @@ class TestUnrecognizedFormatOnRelease: from shelfmark.release_sources.prowlarr.source import _prowlarr_result_to_release release = _prowlarr_result_to_release( - self._result("The Martian by Andy Weir [ENG / MP4]"), "audiobook" + self._result("The Martian by Andy Weir [ENG / AVI]"), "audiobook" ) assert release.extra["unrecognized_formats"] is None