// A total of video lengths and the videos it cannot hold. The server decides what a length is (a // YouTube "length" past a day is a 24/7 stream's archive reporting the years it has run, and the API // sends none for it: `catalog.models.LENGTH_MAX_S`), so this side keeps no copy of that limit. It only // names what a sum left out: every video with no length — live, an archive, or not fetched yet — as the // server's `Video.without_length` counts it for the totals it sums itself. The two rules are the same, // so the count and the sum never disagree about what was left out. import type { TFunction } from "i18next"; import type { Video } from "../../lib/api/feed"; export function isWithoutLength(v: Pick): boolean { return v.duration_seconds == null; } /** "12 hr 5 min +2 without length": `total` is the formatted sum ("" when nothing summed), `leftOut` * the count it left out. Empty when both are. */ export function withLeftOutCount(total: string, leftOut: number, t: TFunction): string { const suffix = leftOut > 0 ? t("card.withoutLength", { count: leftOut }) : ""; return [total, suffix].filter(Boolean).join(" "); }