commit 8931da51993173f7257f00116dfb070ffeb89756
parent ac431a1cbbc4332d99a688ec8605e9df86cf5b6c
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 21 Nov 2026 16:20:42 -0500
record-live: nothing is removed when nothing landed, and a stored recording is replaced only by one proven to hold it
REVIEW-1 of live-guard-2, 1.1 and 1.2 (both in slice 1's landing, so on
main too; this lane's boot restart reaches them with no person involved):
- When landMediaFile keeps the container already in the store, nothing of
this run was stored, and nothing is removed: the unlanded part, every
part collected for removal, a joined file and its parts stay, listed as
kept parts; the run fails "not landed" and needs a person.
- A container already in the store is replaced only by a file that holds
the whole stream from its start (the coverage rule), or by a proven join
that includes it (the stored container joins as the base when the run
that stored it landed a part from its start). Otherwise nothing lands.
Also 1.4: a shorter from-start part is "inside" the landed one only when
neither is a restart, a stalled part or an index-0 part; those go by the
coverage rule alone. 1.7: no join while the run is being stopped. 1.10: a
live-edge part that ended over a minute after the landed part is kept
whatever the coverage tolerance says. Rows record what the landing kept.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
4 files changed, 261 insertions(+), 15 deletions(-)
diff --git a/common/controller/recordLive.test.ts b/common/controller/recordLive.test.ts
@@ -84,18 +84,23 @@ const NO_COOKIES = { cookies: undefined, mode: "when-required" } as const;
// Read after the recording (the stream has ended): a live record then says
// `was_live` (the platforms' own word for an ended stream), unless
// `stillLive` says it is still live.
-function refreshWith(meta: Record<string, unknown>, opts: { failFirst?: string; stillLive?: () => boolean; failAfterFirst?: string } = {}) {
+function refreshWith(
+ meta: Record<string, unknown>,
+ opts: { failFirst?: string; stillLive?: () => boolean; failAfterFirst?: string; afterRead?: (n: number) => void; failReads?: number[]; failWith?: string } = {},
+) {
let n = 0;
let wrote = 0;
return async (cwd: string, args: string[]): Promise<AttemptOutcome> => {
n++;
if (opts.failFirst && n === 1) return { exitCode: 1, stderrTail: opts.failFirst, archiveLine: null, formatLine: null };
if (opts.failAfterFirst && n > 1) return { exitCode: 1, stderrTail: opts.failAfterFirst, archiveLine: null, formatLine: null };
+ if (opts.failReads?.includes(n)) return { exitCode: 1, stderrTail: opts.failWith ?? "ERROR: Unable to download webpage: timed out", archiveLine: null, formatLine: null };
const o = args[args.indexOf("-o") + 1]!;
const dir = path.join(cwd, path.dirname(o));
wrote++;
const ended = wrote > 1 && meta.live_status === "is_live" && !(opts.stillLive?.() ?? false);
await writeFile(path.join(dir, "metadata.info.json"), JSON.stringify(ended ? { ...meta, live_status: "was_live" } : meta));
+ opts.afterRead?.(n);
return { exitCode: 0, stderrTail: "", archiveLine: null, formatLine: null };
};
}
@@ -1001,23 +1006,33 @@ test("2.3: only a landed from-start run that covers the stream supersedes; a liv
const id = "exmplcover1";
const first = await incidentRun(id, writesAfter(Infinity));
await assert.rejects(first.run);
- const stillNeeds = async () => (await rowOf(id)).find((r) => r.status === "failed")!;
+ const stillNeeds = async () => (await rowOf(id)).find((r) => r.status === "failed" && !/not landed/.test(r.error ?? ""))!;
// (a) asked not from its start: lands, does not supersede.
const edge = await incidentRun(id, writesAfter(0), { request: { fromStart: false } });
assert.equal((await edge.run).status, "landed");
assert.equal((await stillNeeds()).needsAttention, true, "a run from now does not hold the start");
assert.equal((await stillNeeds()).supersededBy, undefined);
- // (b) from its start, 600 s of a stream that has run two hours.
+ // (b) from its start, 600 s of a stream that has run two hours: the store
+ // holds (a)'s recording, which this one is not proven to hold — not landed
+ // (REVIEW-1 1.2 of live-guard-2), kept, needing a person.
const short = await incidentRun(id, writesAfter(0));
- const shortLog = short.log;
- assert.equal((await short.run).status, "landed");
+ await assert.rejects(short.run, /not landed/);
assert.equal((await stillNeeds()).needsAttention, true, "a short partial does not supersede");
- assert.ok(shortLog.some((l) => /does not supersede/.test(l)));
- const shortRow = (await rowOf(id)).find((r) => r.status === "landed" && r.fromStart && r.coverage)!;
+ const shortRow = (await rowOf(id)).find((r) => r.status === "failed" && /not landed/.test(r.error ?? ""))!;
+ assert.equal(shortRow.keptParts?.length, 1);
assert.equal(shortRow.coverage?.covers, false);
assert.equal(shortRow.coverage?.basis, "clock");
// (c) the ended stream's own duration, 610 s, against 600 s captured: covers.
- const whole = await incidentRun(id, writesAfter(0), { meta: { ...YT_META(id), live_status: "post_live", duration: 610 } });
+ // (c) the ended stream's own duration, 710 s, against 700 s captured: covers,
+ // and it holds the stored live-edge recording too, so it replaces it.
+ const whole = await incidentRun(
+ id,
+ async (args) => {
+ await writeFile(`${outOf(args)}.mp4`, "format=mov,mp4;seconds=700;");
+ return { exitCode: 0, stderrTail: "", signalled: false };
+ },
+ { meta: { ...YT_META(id), live_status: "post_live", duration: 710 } },
+ );
assert.equal((await whole.run).status, "landed");
const failed = await stillNeeds();
assert.ok(failed.supersededBy, "the whole stream, from its start, supersedes");
@@ -1751,7 +1766,22 @@ function fakeJoinDeps(o: { drop?: boolean } = {}) {
// whose recorder started `edgeClock` s into the stream and whose sound begins
// at `edgeStream` (the live edge lags the clock); the stream has ended; the
// boot pass's restart lands what is in staging.
-async function joinCase(id: string, o: { edgeClock: number; edgeStream: number; edgeSeconds: number; edgeSeed?: number; duration?: number; deps?: ReturnType<typeof fakeJoinDeps> }) {
+async function joinCase(
+ id: string,
+ o: {
+ edgeClock: number;
+ edgeStream: number;
+ edgeSeconds: number;
+ edgeSeed?: number;
+ duration?: number;
+ deps?: ReturnType<typeof fakeJoinDeps>;
+ signal?: AbortSignal;
+ shuttingDown?: boolean;
+ before?: () => Promise<void>;
+ refresh?: Parameters<typeof refreshWith>[1];
+ extraDeps?: Record<string, unknown>;
+ },
+) {
const S0 = 1_790_000_000;
const iso = (sec: number) => new Date((S0 + sec) * 1000).toISOString();
const runAt = iso(0);
@@ -1781,10 +1811,13 @@ async function joinCase(id: string, o: { edgeClock: number; edgeStream: number;
],
restart: { at: iso(9000), by: "boot", state: "asked" },
});
+ await o.before?.();
return incidentRun(id, writesAfter(0), {
request: { resumeOf: runAt },
meta: { ...YT_META(id), live_status: "was_live", release_timestamp: S0, ...(o.duration ? { duration: o.duration } : {}) },
- deps: { join: o.deps ?? fakeJoinDeps() },
+ ...(o.signal ? { signal: o.signal } : {}),
+ ...(o.refresh ? { refresh: o.refresh } : {}),
+ deps: { join: o.deps ?? fakeJoinDeps(), ...(o.shuttingDown ? { shuttingDown: () => true } : {}), ...(o.extraDeps ?? {}) },
});
}
const left = async (id: string) => (await readdir(store())).filter((n) => n.startsWith(`.${id}.`));
@@ -1879,3 +1912,146 @@ test("slice 3: attempts that each recorded only one of the two streams are not r
assert.equal(calls.length, 6, "the schedule only: no restart on top of it");
assert.equal((await rowOf(id))[0]!.restarts, undefined);
});
+
+// --- REVIEW-1 of live-guard-2: the store, containment, and the join's proof --------
+//
+// A container already in the store is never deleted around or replaced by a
+// part that is not proven to hold it; a part is removed only when THIS landing
+// stored and verified a file that holds it.
+
+const dataDir = (id: string) => path.join(CORPUS, "channels", YT_SLUG, "data", id);
+const storedSeconds = async (id: string): Promise<number | null> => {
+ const { savedVideoPath } = await import("../lib/savedVideo");
+ const p = await loadSavedVideo(dataDir(id));
+ return p ? ((await fakeProbe(savedVideoPath(p)))?.seconds ?? null) : null;
+};
+const okExit = { exitCode: 0, stderrTail: "", signalled: false };
+// Run 1: `seconds` from its start, landed by an editor shutdown.
+async function landedAtShutdown(id: string, seconds: number) {
+ const ac = new AbortController();
+ const r = await incidentRun(
+ id,
+ async (args) => {
+ await writeFile(`${outOf(args)}.mp4`, `format=mov,mp4;seconds=${seconds};stream=0;seed=7;`);
+ ac.abort();
+ return { exitCode: null, stderrTail: "", signalled: true };
+ },
+ { signal: ac.signal, deps: { shuttingDown: () => true, join: null } },
+ );
+ assert.equal((await r.run).status, "interrupted");
+ assert.equal(await storedSeconds(id), seconds);
+}
+
+test("REVIEW 1.2 + 1.1(b): a later run's live-edge part — longer or shorter — never replaces the stored start and is never deleted: kept, the store untouched, a person asked", { timeout: 60_000 }, async () => {
+ for (const [id, edge] of [
+ ["exmplrv1201", 7000],
+ ["exmplrv1202", 2000],
+ ] as const) {
+ await landedAtShutdown(id, 3600);
+ const r = await incidentRun(
+ id,
+ async (args, n) => {
+ if (n <= 3) return failEmpty;
+ await writeFile(`${outOf(args)}.mp4`, `format=mov,mp4;seconds=${edge};`);
+ return okExit;
+ },
+ { deps: { join: null } },
+ );
+ await assert.rejects(r.run, /not landed/);
+ assert.equal(await storedSeconds(id), 3600, `${id}: the stored start is still the stored container`);
+ assert.ok((await left(id)).some((n) => /ytdlp-edge-a4\.mp4$/.test(n)), `${id}: the live-edge part is still on disk`);
+ const row = (await rowOf(id)).find((x) => x.status === "failed")!;
+ assert.ok(row.keptParts?.some((k) => /ytdlp-edge-a4$/.test(k.stem)));
+ assert.equal(row.needsAttention, true);
+ }
+});
+
+test("REVIEW 1.1: when the landing keeps the container already in the store, NOTHING is removed — the unlanded part and every part collected for removal stay, listed", { timeout: 60_000 }, async () => {
+ const id = "exmplrv1101";
+ // Run 1 landed the whole stream, a little longer than run 2's.
+ const one = await incidentRun(id, async (args) => {
+ await writeFile(`${outOf(args)}.mp4`, "format=mov,mp4;seconds=7300;");
+ return okExit;
+ });
+ assert.equal((await one.run).status, "landed");
+ const earlier = await leftover(id, 300);
+ const two = await incidentRun(id, async (args) => {
+ await writeFile(`${outOf(args)}.mp4`, "format=mov,mp4;seconds=7200;");
+ return okExit;
+ });
+ await assert.rejects(two.run, /not landed/);
+ assert.equal(await storedSeconds(id), 7300);
+ assert.ok((await stat(earlier)).size > 0, "the earlier part is not removed");
+ const mine = (await left(id)).filter((n) => n !== path.basename(earlier));
+ assert.equal(mine.length, 1, "this run's part is not removed");
+ const row = (await rowOf(id)).find((x) => x.status === "failed")!;
+ assert.equal(row.removedParts, undefined);
+ assert.equal(row.keptParts?.length, 2);
+ assert.equal(row.needsAttention, true);
+});
+
+test("REVIEW 1.1(c): a joined file the store's longer container is kept over is not removed, nor are its parts", { timeout: 60_000 }, async () => {
+ const id = "exmpljoin05";
+ const r = await joinCase(id, {
+ edgeClock: 2421,
+ edgeStream: 2401,
+ edgeSeconds: 3000,
+ duration: 5401,
+ before: async () => {
+ // The store already holds a longer recording (by another way).
+ const { landMediaFile } = await import("./landMedia");
+ await mkdir(dataDir(id), { recursive: true });
+ await writeFile(path.join(dataDir(id), "metadata.info.json"), JSON.stringify(YT_META(id)));
+ const src = path.join(ROOT, `${id}-stored.mp4`);
+ await writeFile(src, "format=mov,mp4;seconds=10800;");
+ await landMediaFile({ paths, slug: YT_SLUG, channelConfig: YT_CONFIG, videoId: id, sourcePath: src, via: "record-live", move: true, onLog: () => {}, signal: new AbortController().signal, deps: land });
+ },
+ });
+ await assert.rejects(r.run, /not landed/);
+ assert.equal(await storedSeconds(id), 10800);
+ const files = await left(id);
+ assert.ok(files.some((n) => /\.joined\.mkv$/.test(n)), `the joined file is kept: ${files.join(", ")}`);
+ assert.ok(files.some((n) => /\.ytdlp\.mp4$/.test(n)) && files.some((n) => /ytdlp-edge-a4\.mp4$/.test(n)), "its parts are kept");
+ const row = (await rowOf(id)).find((x) => x.resumeOf)!;
+ assert.equal(row.removedParts, undefined);
+ assert.equal(row.needsAttention, true);
+});
+
+test("REVIEW 1.4: a restart's earlier sibling from its start is not removed on the strength of index 0 — only the coverage rule removes it", { timeout: 60_000 }, async () => {
+ const id = "exmplrv1401";
+ let live = true;
+ const hang = hangAfter(300);
+ const { run } = await incidentRun(
+ id,
+ async (args, n, signal) => {
+ if (n === 1) return hang(args, n, signal);
+ await writeFile(`${outOf(args)}.mp4`, "format=mov,mp4;seconds=5000;");
+ live = false;
+ return okExit;
+ },
+ { deps: { ...FAST_WATCH, join: null }, refresh: { stillLive: () => live } },
+ );
+ assert.equal((await run).status, "landed");
+ const row = (await rowOf(id))[0]!;
+ assert.equal(row.coverage?.covers, false);
+ assert.ok(row.keptParts?.some((k) => /\.ytdlp$/.test(k.stem)), "the stalled first part is kept");
+ assert.ok((await left(id)).some((n) => /\.ytdlp\.mp4$/.test(n)));
+});
+
+test("REVIEW 1.7: no join during a shutdown's landing — the longest lands, the rest are kept", { timeout: 60_000 }, async () => {
+ const id = "exmpljoin06";
+ const ac = new AbortController();
+ let calls = 0;
+ const deps = fakeJoinDeps();
+ const counted = { ...deps, decode: async (...a: Parameters<typeof deps.decode>) => (calls++, deps.decode(...a)) };
+ const r = await joinCase(id, { edgeClock: 2421, edgeStream: 2401, edgeSeconds: 2900, duration: 5301, signal: ac.signal,
+ shuttingDown: true,
+ deps: counted,
+ // The shutdown comes as the landing begins.
+ extraDeps: { land: { ...land, probe: async (f: string) => (ac.abort(), fakeProbe(f)) } },
+ });
+ const s = await r.run;
+ assert.equal(calls, 0, "the join never ran");
+ assert.equal(s.landed?.seconds, 3000);
+ assert.ok((await left(id)).some((n) => /ytdlp-edge-a4\.mp4$/.test(n)), "the other part is kept");
+});
diff --git a/common/controller/recordLive.ts b/common/controller/recordLive.ts
@@ -114,7 +114,8 @@ import { markLiveBootRestart } from "./liveRecordingBoot";
import { isDoNotClean, setDoNotClean } from "../lib/doNotClean-server";
import type { Paths } from "../lib/paths";
import { detectPlatform } from "../lib/platform";
-import { savedVideoDir, savedVideoRoot } from "../lib/savedVideo";
+import { savedVideoDir, savedVideoPath, savedVideoRoot } from "../lib/savedVideo";
+import { loadSavedVideo } from "../lib/savedVideo-server";
import { assertSavedVideosStoreWritable } from "../lib/savedVideoStore";
import { getFreeBytes } from "../lib/diskSpace";
import { formatBytes } from "../lib/format";
@@ -1240,6 +1241,7 @@ async function recordLiveRunInner(
if (opts.recovery) part.recovery = true;
if (opts.restart) part.restart = opts.restart;
if (opts.insurance) part.insurance = true;
+ if (mode === "index0") part.index0 = true;
const stem = part.stem!;
opts.onStart?.(stem);
await save();
@@ -1943,12 +1945,19 @@ async function recordLiveRunInner(
// Inside the landed file without asking how long the stream is: a shorter
// part of THIS run, both from the start (both begin where the stream's
// record begins).
+ // Not a restart's sibling nor a stalled part (REVIEW-1 1.4 of live-guard-2):
+ // on a DVR window that slides, a later from-start part starts later; nor
+ // an index-0 part unless the playlist was read to reach the start. Those
+ // go only by the coverage rule.
+ const sure = (p: LivePart) => p.restart === undefined && !p.stalled && (!p.index0 || record.reach?.fromStart === true);
const contained = (c: Candidate) =>
c !== best &&
c.part !== undefined &&
best.part !== undefined &&
c.part.fromStart &&
best.part.fromStart &&
+ sure(c.part) &&
+ sure(best.part) &&
c.seconds !== null &&
best.seconds !== null &&
c.seconds <= best.seconds;
@@ -2004,19 +2013,40 @@ async function recordLiveRunInner(
// join); its parts are removed only after it has landed. Unproven: the
// longest lands and the rest are kept, as before.
let joinsRecord: Omit<LiveJoinsRecord, "landedAt" | "container"> | null = null;
- if (!cov.covers && candidates.length >= 2 && !record.missingStream && deps.join !== null) {
+ // WHAT THE STORE ALREADY HOLDS for this id (REVIEW-1 1.2 of live-guard-2):
+ // it is replaced only by a file that holds the whole stream from its start,
+ // or by a proven join that holds it. Its place is known only when the run
+ // that stored it says it landed a part from the start.
+ const STORED = "<the store>";
+ const pointer = await loadSavedVideo(videoDir).catch(() => null);
+ const storedPath = pointer ? savedVideoPath(pointer) : null;
+ const storedSeconds = storedPath && (await stat(storedPath).then((x) => x.isFile(), () => false)) ? ((await probe(storedPath, landSignal).catch(() => null))?.seconds ?? null) : null;
+ const stored = storedPath && storedSeconds !== null ? { file: storedPath, seconds: storedSeconds } : null;
+ let storedInJoin = false;
+ // Never while the run is being stopped (REVIEW-1 1.7): land the longest,
+ // keep the rest; the next run joins.
+ if (!cov.covers && (candidates.length >= 2 || stored) && !record.missingStream && deps.join !== null && !stopped && !signal.aborted) {
const rows = await loadLiveRecordingRows(paths, req.slug).catch(() => []);
const earlier = new Map(rows.filter((r) => r.id === id).flatMap((r) => r.parts).filter((x) => x.stem).map((x) => [x.stem!, x]));
const placed = candidates.flatMap((c) => {
const p = c.part ?? earlier.get(c.group.stem);
return p && c.seconds !== null ? [{ c, jp: { stem: c.group.stem, file: c.file, seconds: c.seconds, fromStart: p.fromStart, startedAt: p.startedAt ?? null } }] : [];
});
+ if (stored) {
+ const by = rows
+ .filter((r) => r.id === id && r.kept === "new" && r.landedPart !== undefined && r.startedAt !== record.startedAt)
+ .sort((a, b) => Date.parse(b.endedAt ?? b.startedAt) - Date.parse(a.endedAt ?? a.startedAt))[0];
+ const lp = by?.parts[by.landedPart!];
+ if (lp?.fromStart && !lp.restart && !lp.stalled && !lp.index0) {
+ placed.push({ c: null as unknown as Candidate, jp: { stem: STORED, file: stored.file, seconds: stored.seconds, fromStart: true, startedAt: lp.startedAt ?? null } });
+ }
+ }
// The joined file needs as much room again as its parts (staging is the
// store's disk).
let room = true;
if (placed.length >= 2) {
let need = 0;
- for (const x of placed) need += await sizeOf(x.c.file);
+ for (const x of placed) need += await sizeOf(x.jp.file);
const free = await (deps.freeBytes ?? getFreeBytes)(storeRoot).catch(() => 0);
if (free < need + RECORD_LIVE_MIN_FREE_BYTES) {
room = false;
@@ -2050,7 +2080,9 @@ async function recordLiveRunInner(
);
// Every joined part is inside the joined file (proven): removed
// after it lands. The rest keep the coverage rule below.
- for (const c of placed.map((x) => x.c).filter((c) => inJoin.has(c.group.stem))) {
+ storedInJoin = inJoin.has(STORED);
+ // (The stored container is replaced by the landing itself, never removed here.)
+ for (const c of placed.filter((x) => x.jp.stem !== STORED).map((x) => x.c).filter((c) => inJoin.has(c.group.stem))) {
const i = others.findIndex((o) => o.group.stem === c.group.stem);
if (i >= 0) others.splice(i, 1);
if (toRemove.some((t) => t.group.stem === c.group.stem)) continue;
@@ -2091,8 +2123,12 @@ async function recordLiveRunInner(
// is inside the landed file by definition, and goes (recorded, with why).
// Not covered — a live-edge landing, a partial, a stream whose length is
// not known — every other part with bytes is kept and needs a person.
+ const bestEnd = best.part?.endedAt ? Date.parse(best.part.endedAt) : null;
for (const o of others) {
- if (cov.covers) {
+ // A live-edge part that ended more than a minute after the landed part
+ // may hold the stream's end, however the tolerance reads (REVIEW-1 1.10).
+ const laterEnd = o.part && !o.part.fromStart && o.part.endedAt && bestEnd !== null && Date.parse(o.part.endedAt) > bestEnd + 60_000;
+ if (cov.covers && !laterEnd) {
toRemove.push({
group: o.group,
why: `inside the landed file, which holds the whole stream from its start (${spanWords(cov.capturedSeconds ?? 0)} of ${spanWords(cov.streamSeconds ?? 0)}, ${cov.basis === "duration" ? "its duration" : "by the clock"})`,
@@ -2124,6 +2160,31 @@ async function recordLiveRunInner(
say(`${RECORD_LIVE_RESULT_MARKER}${JSON.stringify(summary)}`);
throw new Error(record.error);
};
+ // NOTHING LANDED (REVIEW-1 1.1/1.2 of live-guard-2): the store keeps what it
+ // holds, and every part — the one that would have landed, every part meant
+ // for removal, a joined file and its parts — stays, listed, needing a person.
+ const notLanded = async (why: string): Promise<RecordLiveSummary> => {
+ await keep(best.group, `not landed: ${why}`, { seconds: best.seconds, ...(best.part ? { part: best.part } : {}), extra: [best.file] });
+ for (const r of toRemove) await keep(r.group, `${r.o.why}; kept: nothing was landed`, r.o);
+ record.status = stopped?.status ?? "failed";
+ if (stopped) record.stoppedBy = stopped.by;
+ record.endedAt = now().toISOString();
+ record.error = `not landed: ${why}`;
+ if (kept.length) record.keptParts = kept;
+ delete record.joins;
+ sayKept();
+ await save();
+ summary.status = record.status;
+ say(`${RECORD_LIVE_RESULT_MARKER}${JSON.stringify(summary)}`);
+ if (!cancelled) throw new Error(record.error);
+ return summary;
+ };
+ if (stored && !cov.covers && !storedInJoin) {
+ return notLanded(
+ `the store already holds a recording of this stream (${spanWords(stored.seconds)}), and this one is not proven to hold it ` +
+ "(not the whole stream from its start, nor a join that includes it): the stored one stays",
+ );
+ }
let landed: Awaited<ReturnType<typeof landMediaFile>>;
try {
landed = await landMediaFile({
@@ -2152,6 +2213,9 @@ async function recordLiveRunInner(
);
}
}
+ if (landed.kept !== "new") {
+ return notLanded(`the store holds a recording as long or longer (${spanWords(landed.existingSeconds ?? 0)}); this one may hold time it does not`);
+ }
for (const r of toRemove) await removeGroup(r.group, r.why, r.extra);
// The landed part's files were staging scratch (it is moved or copied into
// the store), and so were the streams a merge was made from.
diff --git a/common/lib/liveCapture.ts b/common/lib/liveCapture.ts
@@ -460,6 +460,9 @@ export type LivePart = {
// The insurance recorder's part: the live edge, beside a from-start
// recording that is catching up (LiveInsurance).
insurance?: boolean;
+ // Recorded `--no-live-from-start` with ffmpeg at the playlist's first listed
+ // segment: from the start only if the playlist reaches it.
+ index0?: boolean;
};
export type MissingStream = "video" | "audio" | "unknown";
diff --git a/common/lib/liveRecordings-server.ts b/common/lib/liveRecordings-server.ts
@@ -84,6 +84,8 @@ export type LiveRecordingRow = {
restart?: LiveBootRestart;
insurance?: LiveInsurance;
joins?: LiveJoin[];
+ // What the landing kept: this run's file stored ("new"), or the store's.
+ kept?: "new" | "existing";
acknowledgedAt?: string;
acknowledgedBy?: string;
// The run (its jobId, else its startedAt) that later landed this id.
@@ -255,6 +257,7 @@ export function rowOfRecord(
...(rec.streamStartedAt ? { streamStartedAt: rec.streamStartedAt } : {}),
parts: rec.parts.map((p) => ({ ...p })),
...(rec.landedPart !== undefined ? { landedPart: rec.landedPart } : {}),
+ ...(rec.kept ? { kept: rec.kept } : {}),
...(rec.failureClass ? { failureClass: rec.failureClass } : {}),
...(rec.missingStream ? { missingStream: rec.missingStream } : {}),
...(rec.stoppedBy ? { stoppedBy: rec.stoppedBy } : {}),