import { viewerMomentUrl } from "yt-dlp-transcript-common/lib/momentUrl"; import { ARCHIVE_ORIGIN, ARCHIVE_CHANNEL, LEAD_IN } from "../song/archive-url.mjs"; // A clip's source moment, in the public archive. // // WHERE comes from song/archive-url.mjs -- the same constants the three page // generators use, so the app and the static pages can never point at different // archives. HOW comes from common/lib/momentUrl.ts, which is the module that // actually owns the viewer's `?v=&t=` scheme. // // The two agree exactly. viewerMomentUrl floors `t - LEAD_IN`; the generators // compute `floor(t) - LEAD_IN`. Those are the same number for every real `t` // because LEAD_IN is an integer. The one divergence is at the very start of an // episode: viewerMomentUrl omits `t` entirely when it would be 0, where the // generators emit `t=0`. The viewer treats both identically. export { ARCHIVE_ORIGIN, ARCHIVE_CHANNEL, LEAD_IN }; /** The viewer deep link for a source moment, with the lead-in applied. */ export function archiveMomentUrl(video: string, srcStart: number): string | null { return viewerMomentUrl(ARCHIVE_ORIGIN, `${ARCHIVE_CHANNEL}/${video}`, srcStart - LEAD_IN); }