Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 60f91f06a0b5db1023323c57fa17dc013c83861f
parent be485ac2e5d664c340cc1683569aed0f8c71b2d1
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sun,  1 Nov 2026 10:55:38 -0500

Merge branch 'lane/playcut-gaps' into lane/play-walk-app

Diffstat:
Mumtool/e2e/gaps-zoom.spec.ts | 49+++++++++++++++++++++++++++++++++++++++----------
Aumtool/lib/report/playTakeGaps.test.mjs | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 140 insertions(+), 10 deletions(-)

diff --git a/umtool/e2e/gaps-zoom.spec.ts b/umtool/e2e/gaps-zoom.spec.ts @@ -1,5 +1,5 @@ import { test, expect, type APIRequestContext, type Page } from "@playwright/test"; -import { readFileSync } from "node:fs"; +import { mkdirSync, readFileSync, writeFileSync } from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import * as urls from "./urls"; @@ -245,15 +245,14 @@ test("the bench plays across a gap the way the cut will: the gap is skipped", as await page.locator("body").press(" "); }); -test("Play the cut plays a gapped clip as one item of jump cuts", async ({ page, request }) => { - expect((await putWindow(request, { gapAdd: "3.5-5.5" })).ok()).toBeTruthy(); - // The render's cut: the gap on the frame grid, the footage the kept seconds. - const got = await (await request.get(`/api/report/cut-points?project=${encodeURIComponent(PROJECT)}`)).json(); - const g01 = got.clips.find((c: { id: string }) => c.id === "g01"); - expect(g01).toMatchObject({ cutStart: 0.5, cutEnd: 8.5, gaps: [{ from: 3.5, to: 5.5 }], footage: 6 }); - - await page.goto(urls.playHref(PROJECT)); +/** + * Play the cut (or `take`) plays g01 -- gap 3.5-5.5 -- as one item of jump cuts: the jump + * on the reel strip 3 s in, no frame from inside the gap, two sound nodes abutting at the join. + */ +const playsJumpCut = async (page: Page, take: string | null = null) => { + await page.goto(urls.playHref(PROJECT, { take })); const root = page.locator("[data-play-cut]"); + await expect(root).toHaveAttribute("data-play-cut", take ?? ""); await expect(root).toHaveAttribute("data-play-edges", "render", { timeout: 30_000 }); await expect(root).toHaveAttribute("data-play-item", "g01"); // The jump cut on the reel strip, 3 s into the clip. @@ -272,7 +271,7 @@ test("Play the cut plays a gapped clip as one item of jump cuts", async ({ page, return id === "g01" && t > 3.2 ? Number(at) : -1; }, { timeout: 20_000, intervals: [100] }) .toBeGreaterThan(5.5); - console.log(`gaps-zoom: drawn ${seen.join(" ")}`); + console.log(`gaps-zoom${take ? ` (take ${take})` : ""}: drawn ${seen.join(" ")}`); const inGap = seen.map((x) => x.split("=")[1]).filter((d) => d.startsWith("g01:")).map((d) => Number(d.split(":")[1])).filter((at) => at > 3.6 && at < 5.4); expect(inGap, "no frame from inside the gap").toEqual([]); // Two sound nodes for g01, abutting at the join (cut second 3), and g02 after its six seconds. @@ -287,4 +286,34 @@ test("Play the cut plays a gapped clip as one item of jump cuts", async ({ page, expect(pieces[1].from).toBeCloseTo(3, 2); expect(pieces[1].to).toBeCloseTo(6, 2); await page.keyboard.press("k"); +}; + +test("Play the cut plays a gapped clip as one item of jump cuts", async ({ page, request }) => { + expect((await putWindow(request, { gapAdd: "3.5-5.5" })).ok()).toBeTruthy(); + // The render's cut: the gap on the frame grid, the footage the kept seconds. + const got = await (await request.get(`/api/report/cut-points?project=${encodeURIComponent(PROJECT)}`)).json(); + const g01 = got.clips.find((c: { id: string }) => c.id === "g01"); + expect(g01).toMatchObject({ cutStart: 0.5, cutEnd: 8.5, gaps: [{ from: 3.5, to: 5.5 }], footage: 6 }); + await playsJumpCut(page); +}); + +// A TAKE plays its gaps too (operator, 1 Nov 2026: a gapped clip played whole in a take's +// Play the cut while the take's render left the gap out). The take is the project's cut +// with its patch -- here a retitle and the deck on, as a real take's is -- so the gap +// is the project's, written after the take was made, and the take's view must keep it. +test("Play the cut on a take plays a gapped clip's kept pieces only", async ({ page, request }) => { + expect((await putWindow(request, { gapAdd: "3.5-5.5" })).ok()).toBeTruthy(); + const dir = path.join(path.dirname(MANIFEST), "takes", "gapped"); + mkdirSync(dir, { recursive: true }); + writeFileSync( + path.join(dir, "take.json"), + `${JSON.stringify({ + id: "gapped", group: "takes", order: 1, label: "Gapped", kind: "different", summary: "", preview: "preview.mp4", window: "full", + patch: { title: "The Gaps Fixture, a take", render: { chrome: { engine: "hyperframes", layout: "deck", deck: {} } } }, + }, null, 2)}\n`, + ); + // The take's render cut names the gap as the project's does. + const got = await (await request.get(`/api/report/cut-points?project=${encodeURIComponent(PROJECT)}&take=gapped`)).json(); + expect(got.clips.find((c: { id: string }) => c.id === "g01")).toMatchObject({ cutStart: 0.5, cutEnd: 8.5, gaps: [{ from: 3.5, to: 5.5 }], footage: 6 }); + await playsJumpCut(page, "gapped"); }); diff --git a/umtool/lib/report/playTakeGaps.test.mjs b/umtool/lib/report/playTakeGaps.test.mjs @@ -0,0 +1,101 @@ +// Play the cut ON A TAKE with gaps inside a clip (operator, 1 Nov 2026: a +// gapped clip reported playing whole in a take's Play the cut while the take's +// render left the gap out). A take plays the project's manifest NOW with its +// patch (takeManifest.mjs), so a gap the project's clip carries -- written +// before or after the take was made -- is in the take's view, its plan and its +// sound, exactly as in the project's own: one item, one sound span per kept +// piece, on the estimate's clock and on the render's edges (the cut-points +// route's shape). A patch that turns the deck and its effects on (draft-21's) +// changes none of that. +// +// Run with: pnpm test:scripts +import assert from "node:assert/strict"; +import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import test from "node:test"; + +const GAPS = [{ from: 12, to: 13 }, { from: 15, to: 15.5 }]; +const manifest = () => ({ + slug: "t", + title: "The cut", + provenance: { channelSlug: "testchan", siteOrigin: "https://archive.example" }, + render: { width: 1920, height: 1080, fps: 30, transition: 0 }, + timeline: [ + { type: "clip", id: "a", video: "v1", start: 10, end: 18, lock: true, gaps: GAPS }, + { type: "clip", id: "b", video: "v2", start: 100, end: 103, lock: true }, + ], +}); + +async function fixture() { + const root = await mkdtemp(path.join(tmpdir(), "play-take-gaps-")); + // Never the real corpus: the play view looks for cached windows under the channels dir. + process.env.CHANNELS_DIR = path.join(root, "channels"); + const dir = path.join(root, "p"); + await mkdir(path.join(dir, "takes", "t1"), { recursive: true }); + await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify(manifest())); + await writeFile( + path.join(dir, "takes", "t1", "take.json"), + JSON.stringify({ + id: "t1", group: "takes", order: 1, label: "Take one", kind: "different", preview: "preview.mp4", window: "full", + // draft-21's shape: a retitle and the deck with its effects on, no timeline of its own. + patch: { title: "The cut, a take", render: { chrome: { engine: "hyperframes", layout: "deck", deck: {}, fx: { zoom: {} } } } }, + }), + ); + return { root, project: { id: "p", dir } }; +} + +/** The render's edges as the cut-points route returns them: the cut, its gaps, the kept footage. */ +const CUTS = new Map([ + ["a", { cutStart: 10, cutEnd: 18, gaps: GAPS, footage: 6.5 }], + ["b", { cutStart: 100, cutEnd: 103, footage: 3 }], +]); + +test("a take's view, plan and sound keep the project's gaps: one item, one span per kept piece", async () => { + const { root, project } = await fixture(); + try { + const { playView } = await import("./playView.mjs"); + const { playPlan } = await import("./playCut.mjs"); + const { audioSpans } = await import("./playSchedule.mjs"); + const pieces = (view, cuts) => + audioSpans(playPlan(view.segments, view.entries, { leadIn: view.leadIn, cuts })) + .filter((s) => s.id === "a") + .map((s) => [s.src, s.srcTo]); + const cut = await playView(project); + const take = await playView(project, { take: "t1" }); + assert.equal(take.take?.id, "t1"); + assert.equal(take.title, "The cut, a take"); + assert.equal(take.deckOn, true, "the take's patch turns the deck on"); + assert.deepEqual(take.entries.find((e) => e.id === "a")?.gaps, GAPS, "the take's entry carries the project's gaps"); + // The render's edges: the kept pieces, the same for the take as for the cut. + const kept = [[10, 12], [13, 15], [15.5, 18]]; + assert.deepEqual(pieces(take, CUTS), kept); + assert.deepEqual(pieces(cut, CUTS), kept); + // The estimate's clock (before the edges are measured): one span per piece too, never the whole window. + const est = pieces(take, null); + assert.equal(est.length, 3); + assert.deepEqual(est, pieces(cut, null)); + const item = playPlan(take.segments, take.entries, { leadIn: take.leadIn, cuts: CUTS }).items.find((i) => i.id === "a"); + assert.deepEqual(item?.clip?.gaps, GAPS); + assert.equal(Math.round((item.clip.playEnd - item.start) * 1000) / 1000, 6.5, "its footage is the kept seconds"); + } finally { + await rm(root, { recursive: true, force: true }); + } +}); + +test("a gap written to the project after the take was made plays in the take", async () => { + const { root, project } = await fixture(); + try { + const m = manifest(); + m.timeline[1].gaps = [{ from: 101, to: 102 }]; + await writeFile(path.join(project.dir, "video.manifest.json"), JSON.stringify(m)); + const { playView } = await import("./playView.mjs"); + const { playPlan } = await import("./playCut.mjs"); + const { audioSpans } = await import("./playSchedule.mjs"); + const take = await playView(project, { take: "t1" }); + const spans = audioSpans(playPlan(take.segments, take.entries, { leadIn: take.leadIn })).filter((s) => s.id === "b"); + assert.deepEqual(spans.map((s) => [s.src, s.srcTo]), [[100, 101], [102, 103]]); + } finally { + await rm(root, { recursive: true, force: true }); + } +});