// What clip-deck.spec.ts walks (release 34 N1): a six-clip montage of one // synthetic source (vid1, its cues the fixture corpus's), every clip's window // cached in the project's out/clips-raw (a copy of vid1's 0-9 s), the seed's // edits.json with two earlier rulings (an exclude and a wider phrase), and a // voice-match.json in release 34 N2's shape scoring two clips. Its own project: // the spec writes montage-rulings.json beside its manifest. // // s01 0.5 s02 1.5 (edits: another speaker) s03 2.5 (edits: a wider phrase) // s04 3.5 (a voice check in its note) s05 4.5 s06 5.5 (voice: unlikely) // // Synthetic, like every fixture. import { copyFileSync, mkdirSync, writeFileSync } from "node:fs"; import path from "node:path"; const write = (dir, name, doc) => { mkdirSync(dir, { recursive: true }); writeFileSync(path.join(dir, name), JSON.stringify(doc, null, 2) + "\n"); }; /** * @param {{ reports: string, manifest: Function, cachedWindow: string }} o */ export function makeClipDeckFixture({ reports, manifest, cachedWindow }) { const dir = path.join(reports, "clip-deck-fixture"); const clip = (n, at, extra = {}) => ({ type: "clip", id: `s0${n}`, video: "vid1", start: at - 0.5, end: at + 2.5, cutStart: at, cutEnd: at + 2, cite: at, section: 0, lock: true, quote: `and it must be a slow news day number ${n} again`, onscreen: { title: "slow news day", subtitle: `${n} May 2020` }, note: "", montage: { n, of: 6, date: `2020050${n}`, platform: "youtube", match: "slow news day", speakerCheck: false }, ...extra, }); // fetchPad 0, as a montage seed writes it: the cached window holds every clip's extent exactly. const doc = manifest("clip-deck-fixture", "The Clip Deck Fixture", { siteOrigin: "https://archive.example" }, [ clip(1, 0.5), clip(2, 1.5), clip(3, 2.5), clip(4, 3.5, { note: "voice check: co-host show", montage: { n: 4, of: 6, date: "20200504", platform: "youtube", match: "slow news day", speakerCheck: true } }), clip(5, 4.5), clip(6, 5.5), ]); doc.render.fetchPad = 0; write(dir, "video.manifest.json", doc); write(dir, "edits.json", { exclude: [{ videoId: "vid1", near: 1.5, why: "another speaker" }], match: [{ videoId: "vid1", near: 2.5, match: "it must be a slow news day", why: "the whole line" }], }); write(dir, "voice-match.json", { version: 1, model: "titanet-small", reference: { clips: ["testchan/vid1@0.50"] }, clips: { "testchan/vid1@0.50": { score: 0.86, label: "likely", speechSeconds: 2 }, "testchan/vid1@5.50": { score: 0.21, label: "unlikely", speechSeconds: 1.8 }, }, }); mkdirSync(path.join(dir, "out", "clips-raw"), { recursive: true }); copyFileSync(cachedWindow, path.join(dir, "out", "clips-raw", "vid1_0.00-9.00.mp4")); return { dir }; }