From d0c79e5bcaca14b4b38faa94efcd9b7272475750 Mon Sep 17 00:00:00 2001 From: 4gray Date: Wed, 12 Aug 2026 01:25:12 +0200 Subject: [PATCH] docs(xtream): cite the measured evidence for the category language gate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The gate's rationale named hypothetical category shapes. On a real catalog the four it actually turns away are VOD (5,245 movies), KIDS (1,010), SHOW and WWE — without it the language select offers "VOD" and "KIDS" as languages. Comments, doc and one spec case only. Co-Authored-By: Claude Fable 5 --- docs/architecture/vod-multi-source.md | 12 +++++++----- .../src/lib/vod-source-language.util.spec.ts | 8 ++++++++ .../interfaces/src/lib/vod-source-language.util.ts | 12 +++++++----- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/docs/architecture/vod-multi-source.md b/docs/architecture/vod-multi-source.md index df51654a6..a909b3a33 100644 --- a/docs/architecture/vod-multi-source.md +++ b/docs/architecture/vod-multi-source.md @@ -223,11 +223,13 @@ per `(playlist_id, xtream_id)` in both query tiers — `char(31)` because the default `,` appears inside real category names), and `unambiguousCategoryLanguage` reduces them: categories without a recognized language prefix abstain, all prefixed ones must agree, and a conflict yields -nothing. Category prefixes must additionally pass `isKnownLanguageTag`, -because categories routinely start with "NEW |", "TOP |" or "VIP |" — and -`new`, `top` and `hot` are even assigned ISO 639-3 codes, which is why the -gate is an `Intl.DisplayNames` check for two-letter codes plus a curated list -for longer tags rather than a registry lookup. Only the pipe title form stays +nothing. Category prefixes must additionally pass `isKnownLanguageTag`. +Measured on a real catalog, that gate is what keeps "VOD" (5,245 movies), +"KIDS" (1,010), "SHOW" and "WWE" out of a list of LANGUAGES; "NEW |", +"TOP |" and "VIP |" are everyday shapes too, and `new`, `top` and `hot` are +even assigned ISO 639-3 codes — which is why the gate is an +`Intl.DisplayNames` check for two-letter codes plus a curated list for +longer tags rather than a registry lookup. Only the pipe title form stays permissive: a tag before a pipe in a movie title is overwhelmingly a language, and tightening the legacy form would drop filter options that work today. The route's own row reads the one category the route arrived through diff --git a/libs/shared/interfaces/src/lib/vod-source-language.util.spec.ts b/libs/shared/interfaces/src/lib/vod-source-language.util.spec.ts index 71fefb4c8..7e3d52011 100644 --- a/libs/shared/interfaces/src/lib/vod-source-language.util.spec.ts +++ b/libs/shared/interfaces/src/lib/vod-source-language.util.spec.ts @@ -95,6 +95,14 @@ describe('isKnownLanguageTag', () => { expect(isKnownLanguageTag('MULTI')).toBe(true); }); + it('rejects the content-type prefixes categories actually use', () => { + // The four the gate turns away most often on a real catalog; without + // it the language select offers "VOD" and "KIDS". + for (const tag of ['VOD', 'KIDS', 'SHOW', 'WWE']) { + expect(isKnownLanguageTag(tag)).toBe(false); + } + }); + it('rejects everyday category words that are real ISO 639-3 codes', () => { // `new`, `top` and `hot` are assigned in ISO 639-3, which is exactly // why validation is curated instead of registry-driven. diff --git a/libs/shared/interfaces/src/lib/vod-source-language.util.ts b/libs/shared/interfaces/src/lib/vod-source-language.util.ts index 7ea24ea74..c7908d9b4 100644 --- a/libs/shared/interfaces/src/lib/vod-source-language.util.ts +++ b/libs/shared/interfaces/src/lib/vod-source-language.util.ts @@ -20,11 +20,13 @@ import { PROVIDER_PIPE_CLASS } from './title-normalization.util'; * rip tags — "[HD] Dune", "NEW - Dune" — which would not only pollute the * select but, since a title prefix outranks the category language, mask a * real one and get the row excluded by the very filter meant to find it. - * - Category names are noisiest: "NEW | 2024", "TOP | 250" and "VIP | Cinema" - * are everyday category shapes, and `new`, `top` and `hot` are even real - * ISO 639-3 codes, so a prefix read off a category always passes - * `isKnownLanguageTag`. Empty beats wrong: an unrecognized tag yields no - * language rather than a wrong filter option. + * - Category names are noisiest, so a prefix read off a category always + * passes `isKnownLanguageTag`. Measured on a real catalog, the gate is what + * keeps "VOD" (5,245 movies), "KIDS" (1,010), "SHOW" and "WWE" out of a + * list of LANGUAGES; "NEW | 2024" and "TOP | 250" are everyday shapes too, + * and `new`, `top` and `hot` are even assigned ISO 639-3 codes — which is + * why the gate is curated rather than a registry lookup. Empty beats wrong: + * an unrecognized tag yields no language rather than a wrong filter option. */ /**