Files
iptvnator/libs/shared/interfaces/src/lib/provider-overview.util.ts
T
4grayandClaude Fable 5 92be39ef66 fix(xtream): drop URL-only season overviews and fall back to TMDB (#1382)
Xtream panels routinely fill get_series_info seasons[].overview with a
bare cover-image URL, which rendered verbatim under the season tabs.
URL-only overviews are now treated as absent (sanitizeProviderOverview),
and the lazy season enrichment stores the TMDB season overview on the
selection (tmdb_season_overviews) as the fallback description - same
cached /tv/{id}/season/{n} payload, so no extra requests. Provider text
keeps priority when it is real prose.

The enrichment write is also convergent now: the serial detail re-fires
season enrichment after every selection write, and the previous
unconditional rewrite scheduled the next cache-served run indefinitely.
A repeat run that changes nothing no longer writes.

buildSeasonDescriptions is extracted from SerialDetailsComponent, which
would otherwise cross the 400-line max-lines limit.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-08 11:12:59 +02:00

27 lines
882 B
TypeScript

/**
* Xtream panels routinely fill editorial text fields with junk — most
* commonly a season `overview` that holds a bare cover-image URL instead
* of a description. Rendering that verbatim puts a raw URL on screen, so
* a value that is nothing but a URL is treated as absent.
*/
/**
* Trimmed overview text, or `null` when the value is empty or a bare URL.
* Prose that merely contains a URL is kept — only a single URL token with
* no surrounding text is junk.
*/
export function sanitizeProviderOverview(
text: string | null | undefined
): string | null {
const trimmed = text?.trim();
if (!trimmed) {
return null;
}
return isBareUrl(trimmed) ? null : trimmed;
}
/** A single absolute or protocol-relative URL token (`http://…/x.jpg`). */
function isBareUrl(text: string): boolean {
return /^(?:https?:)?\/\/\S+$/i.test(text);
}