import Link from "next/link"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { listLiveRecordings, type LiveRecordingView, type LiveRecordingsFileProblem, } from "yt-dlp-transcript-common/controller/liveRecordings"; import { LiveRecordingActions } from "./LiveRecordingActions"; // LIVE RECORDINGS THAT NEED A PERSON (controller/liveRecordings.ts): failed, // interrupted, cancelled when must-keep, recorded from the live edge with the // stream's start lost, one stream missing, parts kept on disk not landed — and // every recording that runs but has STOPPED GROWING (stalled: said here as a // failure is, with no Acknowledge, since it clears itself when the files grow // or the run ends), and a live-recordings.json that did not read. // One component for the four places it is said — /review's section, and the // banners on /jobs, the channel page and the video page (narrowed by `slug`, // `id`) — so all four say the same sentence. It stays until a person presses // Acknowledge or a later recording of the stream lands from its start. // // RENDERED ONLY WHEN THERE IS SOMETHING TO SAY, like /review's other sections. function when(iso: string): string { return `${iso.slice(0, 16).replace("T", " ")} UTC`; } function Row({ r }: { r: LiveRecordingView }) { return (
  • {r.slug}/{r.id} started {when(r.startedAt)} · {r.attempts} attempt{r.attempts === 1 ? "" : "s"} {r.mustKeep ? " · must keep" : ""} {r.job ? ( <> {" · "} job {r.job.status} ) : null} {r.reason} {r.keptParts && r.keptParts.length > 0 ? ( ) : null} {r.needsAttention ? ( ) : null}
  • ); } function FileRow({ f }: { f: LiveRecordingsFileProblem }) { return (
  • {f.message} {f.state === "set-aside" ? : null}
  • ); } export async function LiveRecordingsAttention({ slug, id, heading = false, }: { slug?: string; id?: string; // /review: a section with a heading; elsewhere a banner. heading?: boolean; }) { let rows: LiveRecordingView[]; let files: LiveRecordingsFileProblem[]; try { const l = await listLiveRecordings(getPaths(), { ...(slug ? { slug } : {}), ...(id ? { id } : {}) }); rows = l.rows.filter((r) => r.needsAttention || r.stalled); files = l.files.filter((f) => f.needsAttention); } catch { return null; } if (rows.length === 0 && files.length === 0) return null; const stalled = rows.filter((r) => r.stalled).length; const title = `Live recordings that need you (${rows.length + files.length}${stalled ? `, ${stalled} not growing` : ""})`; return (
    {heading ?

    {title}

    : {title}} pnpm ops get live-recordings lists every recording; pnpm ops live-recording-ack is Acknowledge.
    ); }