Route ended EPG S-ids through play-live KAP, not byguid VOD.
This commit is contained in:
parent
d06b984b9d
commit
7cfe2598a8
5 changed files with 33 additions and 18 deletions
|
|
@ -655,15 +655,9 @@ function productToRailItem(node: Record<string, unknown>): ViaplaySportRailItem
|
||||||
else if (type === "series" || type === "sportseries" || type === "episode") kind = "series";
|
else if (type === "series" || type === "sportseries" || type === "episode") kind = "series";
|
||||||
else if (type === "movie" || type === "film") kind = "series"; // docs/specials → VOD byguid
|
else if (type === "movie" || type === "film") kind = "series"; // docs/specials → VOD byguid
|
||||||
|
|
||||||
const now = Date.now();
|
|
||||||
const stillLive =
|
|
||||||
startMs != null && (endMs == null || endMs > now);
|
|
||||||
let playMode: ViaplaySportRailItem["playMode"] = null;
|
let playMode: ViaplaySportRailItem["playMode"] = null;
|
||||||
if (href?.includes("play-live.viaplay.com") || (kind === "sport" && stillLive)) {
|
if (href?.includes("play-live.viaplay.com") || (kind === "sport" && startMs != null)) {
|
||||||
playMode = "live";
|
playMode = "live";
|
||||||
} else if (kind === "sport" && endMs != null && endMs <= now) {
|
|
||||||
// Afgelopen hoofduitzending: web speelt byguid/vod-dash, niet live-TV.
|
|
||||||
playMode = "vod";
|
|
||||||
} else if (
|
} else if (
|
||||||
href?.includes("play.viaplay.com/api/stream/byguid") ||
|
href?.includes("play.viaplay.com/api/stream/byguid") ||
|
||||||
kind === "clip" ||
|
kind === "clip" ||
|
||||||
|
|
@ -899,6 +893,18 @@ export function isVodDashMpd(mpdUrl: string | null | undefined): boolean {
|
||||||
return /\/vp-sports-clip-/i.test(mpdUrl) && /\.ism\//i.test(mpdUrl);
|
return /\/vp-sports-clip-/i.test(mpdUrl) && /\.ism\//i.test(mpdUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** EPG/live-product (S2609…) — geen byguid-VOD. */
|
||||||
|
export function isViaplayEpgGuid(guid: string | null | undefined): boolean {
|
||||||
|
const g = String(guid || "")
|
||||||
|
.trim()
|
||||||
|
.replace(/-NL$/i, "");
|
||||||
|
return /^S\d{8,}$/i.test(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isViaplayClipGuid(guid: string | null | undefined): boolean {
|
||||||
|
return /vp-sports-clip/i.test(String(guid || ""));
|
||||||
|
}
|
||||||
|
|
||||||
function assertPlayNotSoftFail(
|
function assertPlayNotSoftFail(
|
||||||
played: ViaplayPlayResult,
|
played: ViaplayPlayResult,
|
||||||
opts?: { allowVod?: boolean }
|
opts?: { allowVod?: boolean }
|
||||||
|
|
|
||||||
|
|
@ -184,10 +184,10 @@ function isWeekendLocal(ms: number): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
function railItemToHome(item: ViaplaySportRailItem, nowMs: number): ViaplayHomeItem {
|
function railItemToHome(item: ViaplaySportRailItem, nowMs: number): ViaplayHomeItem {
|
||||||
|
const epg = /^S\d+/i.test(String(item.guid || "").replace(/-NL$/i, ""));
|
||||||
const isEvent =
|
const isEvent =
|
||||||
item.kind === "sport" &&
|
(item.kind === "sport" && item.playMode === "live") ||
|
||||||
item.playMode === "live" &&
|
(item.kind === "sport" && epg);
|
||||||
(item.endMs == null || item.endMs > nowMs);
|
|
||||||
const openAs: ViaplayHomeItem["openAs"] = isEvent ? "event" : "content";
|
const openAs: ViaplayHomeItem["openAs"] = isEvent ? "event" : "content";
|
||||||
const id =
|
const id =
|
||||||
openAs === "event" ? toEventId(toMediaGuid(item.guid)) : `viaplay-content:${item.guid}`;
|
openAs === "event" ? toEventId(toMediaGuid(item.guid)) : `viaplay-content:${item.guid}`;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ import {
|
||||||
isDontGoPlaceholder,
|
isDontGoPlaceholder,
|
||||||
isLiveDashMpd,
|
isLiveDashMpd,
|
||||||
isVodDashMpd,
|
isVodDashMpd,
|
||||||
|
isViaplayEpgGuid,
|
||||||
|
isViaplayClipGuid,
|
||||||
mpdLooksLikeDontGo,
|
mpdLooksLikeDontGo,
|
||||||
mpdHasContentProtection,
|
mpdHasContentProtection,
|
||||||
stripKapWindow,
|
stripKapWindow,
|
||||||
|
|
@ -458,10 +460,6 @@ async function dropEventMpdCache(mediaGuid: string, reason: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function isViaplayClipGuid(guid: string | null | undefined): boolean {
|
|
||||||
return /vp-sports-clip/i.test(String(guid || ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
function isNoPrioritizedVideo(message: string | null | undefined): boolean {
|
function isNoPrioritizedVideo(message: string | null | undefined): boolean {
|
||||||
return /no prioritized video found/i.test(String(message || ""));
|
return /no prioritized video found/i.test(String(message || ""));
|
||||||
}
|
}
|
||||||
|
|
@ -519,7 +517,7 @@ async function findCatchupClip(
|
||||||
let best: { guid: string; pageUrl: string | null; score: number } | null = null;
|
let best: { guid: string; pageUrl: string | null; score: number } | null = null;
|
||||||
for (const rail of rails) {
|
for (const rail of rails) {
|
||||||
for (const item of rail.items) {
|
for (const item of rail.items) {
|
||||||
if (item.playMode !== "vod") continue;
|
if (item.playMode !== "vod" || !isViaplayClipGuid(item.guid)) continue;
|
||||||
let score = catchupTitleScore(event.title, item.title);
|
let score = catchupTitleScore(event.title, item.title);
|
||||||
if (item.startMs != null && event.startMs) {
|
if (item.startMs != null && event.startMs) {
|
||||||
const delta = Math.abs(item.startMs - event.startMs);
|
const delta = Math.abs(item.startMs - event.startMs);
|
||||||
|
|
@ -994,7 +992,14 @@ export async function resolveViaplayGuidPlay(
|
||||||
opts?: { productUrl?: string | null }
|
opts?: { productUrl?: string | null }
|
||||||
): Promise<ResolveViaplayPlayResult> {
|
): Promise<ResolveViaplayPlayResult> {
|
||||||
try {
|
try {
|
||||||
return await resolveViaplayGuidPlayInner(sessionSecret, guidRaw, opts);
|
const guid = String(guidRaw || "").trim();
|
||||||
|
if (isViaplayEpgGuid(guid)) {
|
||||||
|
return await resolveViaplayPlay(
|
||||||
|
sessionSecret,
|
||||||
|
`viaplay:${toMediaGuid(guid)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return await resolveViaplayGuidPlayInner(sessionSecret, guid, opts);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof AppError) throw err;
|
if (err instanceof AppError) throw err;
|
||||||
throw new AppError(
|
throw new AppError(
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,11 @@ export function findViaplayEvent(
|
||||||
const id = raw.replace(/^viaplay:/i, "");
|
const id = raw.replace(/^viaplay:/i, "");
|
||||||
return (
|
return (
|
||||||
config.events.find(
|
config.events.find(
|
||||||
(e) => e.mediaGuid === id || e.guid === id || e.mediaGuid === `${id}-NL`
|
(e) =>
|
||||||
|
e.mediaGuid === id ||
|
||||||
|
e.guid === id ||
|
||||||
|
e.mediaGuid === `${id}-NL` ||
|
||||||
|
e.mediaGuid.replace(/-NL$/i, "") === id.replace(/-NL$/i, "")
|
||||||
) ?? null
|
) ?? null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1134,7 +1134,7 @@ export function registerViewerRoutes(
|
||||||
format: played.format,
|
format: played.format,
|
||||||
fallbackStreamUrl: null,
|
fallbackStreamUrl: null,
|
||||||
fallbackFormat: null,
|
fallbackFormat: null,
|
||||||
live: false,
|
live: played.live,
|
||||||
/** Deploy/debug: bevestigt VOD-resolver revisie na Dokploy. */
|
/** Deploy/debug: bevestigt VOD-resolver revisie na Dokploy. */
|
||||||
resolver: "viaplay-byguid-v10",
|
resolver: "viaplay-byguid-v10",
|
||||||
mediaPath: (() => {
|
mediaPath: (() => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue