Archilyzer · Source

archilyzer

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

commit 0e4d2ba843970f1d610ff91bc1e05bec22d29427
parent 7b69f0f4cc2581c8226ee15631f259edce72a3f6
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sun, 18 Oct 2026 23:43:25 -0400

umtool: the Takes page's Effect list and `umtool take --effect` / `takes effects` — the effect presets a cut offers (fxPresetsFor), as patches a person edits

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/components/projects/NewTakePanel.tsx | 28++++++++++++++++++++++++++++
Mumtool/components/projects/TakesPage.tsx | 9+++++++++
Mumtool/docs/cli.md | 4++--
Mumtool/docs/report-video.md | 27+++++++++++++++++++++++++++
Mumtool/lib/report/takeCli.mjs | 37+++++++++++++++++++++++++++++++++----
Mumtool/lib/report/takeMaker.test.mjs | 27+++++++++++++++++++++++++++
Mumtool/report-to-video/fx.mjs | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/fx.test.mjs | 28++++++++++++++++++++++++++++
Mumtool/report-to-video/package.json | 1+
9 files changed, 224 insertions(+), 6 deletions(-)

diff --git a/umtool/components/projects/NewTakePanel.tsx b/umtool/components/projects/NewTakePanel.tsx @@ -14,6 +14,8 @@ import { JobProgress, type JobStepState } from "@/components/ui/job-progress"; // calls a model. export type MontageStyle = { name: string; label: string; summary: string }; +/** An effect preset (report-to-video/fx.mjs `fxPresetsFor`): a merge patch the patch box takes. */ +export type EffectPreset = { name: string; label: string; summary: string; patch: Record<string, unknown> }; type StepView = { label: string; argv: string[] }; type Ev = Record<string, unknown> & { ev: string; id?: string; phase?: string }; @@ -66,18 +68,21 @@ export default function NewTakePanel({ project, styles, stylesError, + effects = [], group: initialGroup, window: initialWindow = { at: 0, dur: 60 }, }: { project: string; styles: MontageStyle[]; stylesError?: string | null; + effects?: EffectPreset[]; group: string; window?: { at: number; dur: number }; }) { const router = useRouter(); const [ready, setReady] = useState(false); const [style, setStyle] = useState(""); + const [effect, setEffect] = useState(""); const [label, setLabel] = useState(""); const [labelTouched, setLabelTouched] = useState(false); const [group, setGroup] = useState(initialGroup); @@ -129,6 +134,7 @@ export default function NewTakePanel({ }, [job, router]); const picked = styles.find((s) => s.name === style) ?? null; + const pickedEffect = effects.find((x) => x.name === effect) ?? null; const { patch, error: patchError } = readPatch(patchText); const windowOf = () => (full ? "full" : { at: Number(at), dur: Number(dur) }); const windowBad = !full && !(Number(at) >= 0 && Number(dur) > 0); @@ -181,6 +187,28 @@ export default function NewTakePanel({ ))} </Select> </Field> + {effects.length ? ( + <Field label="Effect" hint={pickedEffect?.summary ?? "Fills the patch below; edit it there."}> + <Select + data-take-effect="" + value={effect} + disabled={!ready} + onChange={(e) => { + const next = effects.find((x) => x.name === e.target.value) ?? null; + setEffect(e.target.value); + setPatchText(next ? JSON.stringify(next.patch, null, 2) : ""); + if (!labelTouched) setLabel(next?.label ?? picked?.label ?? ""); + }} + > + <option value="">None</option> + {effects.map((x) => ( + <option key={x.name} value={x.name}> + {x.label} + </option> + ))} + </Select> + </Field> + ) : null} <Field label="Label"> <Input data-take-label="" diff --git a/umtool/components/projects/TakesPage.tsx b/umtool/components/projects/TakesPage.tsx @@ -7,6 +7,7 @@ import { listTakes, readVerdicts } from "@/lib/report/takes.mjs"; import { pieceHrefOfProject } from "@/lib/pieces/article"; import type { ProjectRef } from "@/lib/project-types"; import { hashText, lastGroup, loadMontageStyles } from "@/lib/report/takeMaker.mjs"; +import { fxPresetsFor } from "umtool-report-to-video/fx"; import NewTakePanel from "./NewTakePanel"; import TakesBench, { type Take, type TakeVerdict } from "./TakesBench"; @@ -27,6 +28,13 @@ export default async function TakesPage({ project }: { project: ProjectRef }) { readFile(path.join(/* turbopackIgnore: true */ project.dir, "video.manifest.json"), "utf8").catch(() => null), ]); const current = manifestText === null ? null : hashText(manifestText); + // The effect presets this cut can show (release 35: report-to-video/fx.mjs), from its own manifest. + let effects: ReturnType<typeof fxPresetsFor> = []; + try { + effects = manifestText === null ? [] : fxPresetsFor(JSON.parse(manifestText)); + } catch { + effects = []; + } const takes = (listing.takes as Take[]).map((t) => ({ ...t, stale: t.baseHash ? t.baseHash !== current : null })); const byId = new Map(takes.map((t) => [t.id, t])); const panel = @@ -35,6 +43,7 @@ export default async function TakesPage({ project }: { project: ProjectRef }) { project={project.id} styles={Object.entries(styles.styles).map(([name, s]) => ({ name, label: s.label, summary: s.summary }))} stylesError={styles.error} + effects={effects} group={lastGroup(takes)} /> ) : null; diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -39,9 +39,9 @@ Inbox cannot disagree about what is wrong with one. | `refresh <article> [--iteration N] [--no-fetch] [--yes] [--json]` · `refresh --check [<article>] [--force]` | the refresh's plan, `--yes` starts it; the daily check now ([refresh.md](refresh.md)) | | `schedule list \| show <id> [--json]` | the recurring reports, read-only ([recurring.md](recurring.md)) | | `notes …` | operator notes: list, read, reply, resolve ([notes.md](notes.md)) | -| `take <project> --id <id> --label L [--group G] [--kind similar\|different] [--summary S] [--style NAME] [--patch FILE \| --patch-json JSON \| --set path=value …] [--at S --dur S \| --full] [--quick] [--force] [--progress ndjson]` | one **take**: the manifest with a montage style's patch, then the take's own, rendered into `takes/<id>/` (the Takes page's New take); `--id <id> --rebuild` makes one again from its own `take.json` ([report-video.md](report-video.md#making-takes)) | +| `take <project> --id <id> --label L [--group G] [--kind similar\|different] [--summary S] [--style NAME] [--patch FILE \| --patch-json JSON \| --set path=value …] [--effect NAME] [--at S --dur S \| --full] [--quick] [--force] [--progress ndjson]` | one **take**: the manifest with a montage style's patch, then an overlay effect's (`--effect`, release 35), then the take's own, rendered into `takes/<id>/` (the Takes page's New take); `--id <id> --rebuild` makes one again from its own `take.json` ([report-video.md](report-video.md#making-takes)) | | `takes make <project> [--recipe FILE] [--only ID,ID] [--force]` · `takes make <project> --all-styles [--group G] [--at S --dur S \| --full]` | a recipe's takes, one at a time (default `takes/recipe.json`); every montage style, one take each (Make all styles); **exit 1** if any failed | -| `takes styles [--json]` · `takes pick <project> <take> [--anyway] [--json]` | the montage styles; **Use this take** — refused (exit 1) when the project changed since the take was made, until `--anyway` | +| `takes styles [--json]` · `takes effects <project> [--json]` · `takes pick <project> <take> [--anyway] [--json]` | the montage styles; the overlay effects the cut offers (`render.chrome.fx` presets: the Takes page's **Effect** list); **Use this take** — refused (exit 1) when the project changed since the take was made, until `--anyway` | | `rulings <project> [--json]` · `rulings <project> import [--dry-run] [--json]` · `rulings <project> set <clip\|key> keep\|cut\|not-him\|read-aloud [--reason R] [--match M]` · `rulings <project> clear <clip\|key>` | a montage's **clip rulings** (`montage-rulings.json`, the clip deck's): each clip and its ruling and the next render's kept clips; the earlier rulings in the seed's `edits.json`, once; one ruling set or cleared. A render leaves out every clip ruled cut, not-him or read-aloud ([report-video.md](report-video.md#ruling-the-clips)) | | `phrases "<phrase>" ["<phrase>" …] --channels a,b [--prefer c] [--exclude RE] [--words \| --regex] [--samples N] [--no-cache] [--json \| --full]` | the phrase finder's search ([tools.md](tools.md#the-phrase-finder-toolsphrases)): every phrase in one pass, each with its count once folded, by year, the preferred channel's share or Rumble's, speaker changes, sample contexts. Plain words become a tolerant pattern unless the phrase holds a regular expression's characters. `--json` the numbers, `--full` every instance; `--spec FILE --out FILE --progress` is the page's job form. **Exit 1** on a bad phrase | | `voice-match <project> [--reference auto\|rulings\|recordings] [--reference-video <channel>/<id> …] [--reference-channel <slug> …] [--instances FILE] [--span phrase\|cut] [--pad S] [--likely X --unlikely Y] [--out FILE] [--dry] [--json] [--progress ndjson]` | who is speaking, per montage clip: a local speaker-similarity score (TitaNet-small) against the host's voice → `<project>/voice-match.json` (the Cut tab's **Score the voices**); `--instances` also scores a phrase scan's instances not in the manifest; `--dry` prints the plan ([report-video.md](report-video.md#who-is-speaking-the-voice-match)) | diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -399,6 +399,33 @@ and the pipeline call it the deck (`render.chrome.layout: "deck"`), but "deck" is already the song kind's name in umtool, and one word meaning two things two pages apart is how somebody edits the wrong one. +### Effects (`render.chrome.fx`, release 35) + +Eight overlay effects drawn over the footage box of a deck cut — a kinetic +quote, a redaction reveal, an odometer, a timeline scrubber, a VHS glitch at a +cut between years, a THEN/NOW wipe, receipts (screenshots fanned in with a +marker on the cited line) and a zoom to detail. Every key, its defaults and +what it draws are the pipeline's README +([`render.chrome.fx`](../report-to-video/README.md#renderchromefx--the-effects-release-35)); +umtool's part is auditioning them as takes: + +- The Takes page's **New take** has an **Effect** list (`data-take-effect`): + one preset per effect this cut can show and **Everything**, from + `fxPresetsFor` (`report-to-video/fx.mjs`, pure: the same manifest, the same + presets). Picking one fills the patch box with its merge patch — the + effect under `render.chrome.fx`, the deck's engine and layout (a merge keeps + the deck's settings), and the cut's transition (0.4 s when it cuts hard, so + the THEN/NOW wipe has a crossfade to ride). Edit it there, or not. +- **THEN/NOW** pairs are suggested from the cut: neighbouring clips whose dates + are years apart, the widest gaps first, at most two. **Receipts** and + **Zoom** are offered only when a clip carries them (`fx.receipts`, + `fx.zoom`: screenshots beside the manifest, with the mark or focus box as + fractions of the shot) — an entry's `fx` draws nothing until its effect is + on, so a project can carry the screenshots while takes audition the effects. +- From a terminal: `umtool takes effects <project>` lists them, + `umtool take <project> --id fx-glitch --label "VHS glitch" --effect glitch --at 0 --dur 34 --quick` + makes one ([cli.md](cli.md)). + ## The three-stage window model A clip's window passes through three different notions of "where the cut is", and diff --git a/umtool/lib/report/takeCli.mjs b/umtool/lib/report/takeCli.mjs @@ -4,8 +4,9 @@ // // umtool take <project> --id <id> --label "<l>" [--group G] [--kind K] [--summary S] // [--style NAME] [--patch FILE | --patch-json JSON | --set path=value …] -// [--at S --dur S | --full] [--quick] [--force] [--progress ndjson] +// [--effect NAME] [--at S --dur S | --full] [--quick] [--force] [--progress ndjson] // umtool take <project> --id <id> --rebuild made again from its own take.json +// umtool takes effects <project> [--json] the effect presets this cut offers (report-to-video/fx.mjs) // umtool takes make <project> [--recipe FILE] [--only ID,ID] [--force] [--progress ndjson] // umtool takes make <project> --all-styles [--group G] [--at S --dur S | --full] [--force] // umtool takes styles [--json] @@ -28,17 +29,20 @@ import { pickTake, } from "./takeMaker.mjs"; import { TAKE_FILE, takesDirOf } from "./takes.mjs"; +import { fxPresetsFor } from "umtool-report-to-video/fx"; +import { mergePatch } from "umtool-report-to-video/montage-styles"; export const TAKE_USAGE = [ "usage: umtool take <project> --id <id> --label \"<label>\" [--group G] [--kind similar|different]", " [--summary S] [--style NAME] [--patch FILE | --patch-json JSON | --set path=value …]", - " [--at S --dur S | --full] [--quick] [--force] [--progress ndjson]", + " [--effect NAME] [--at S --dur S | --full] [--quick] [--force] [--progress ndjson]", " umtool take <project> --id <id> --rebuild made again from its own take.json", "", "A take is the project's manifest with a style's patch, then the take's own, applied (JSON merge", "patches), rendered into takes/<id>/. The window renders the entries it covers; --full the whole", `cut. Default window: --at ${DEFAULT_WINDOW.at} --dur ${DEFAULT_WINDOW.dur}. Nothing is fetched. --quick encodes`, "the render with x264 veryfast (the render only: the take's manifest, what a pick uses, keeps its own).", + "--effect NAME is one of `umtool takes effects <project>` (an overlay effect's patch, before --patch's).", ].join("\n"); export const TAKES_USAGE = [ @@ -49,6 +53,7 @@ export const TAKES_USAGE = [ ` one take per montage style (writes takes/${ALL_STYLES_RECIPE})`, " umtool takes styles [--json] the montage styles: name, label, summary", " umtool takes pick <project> <take> [--anyway] use this take: its manifest over the project's", + " umtool takes effects <project> [--json] the overlay effects this cut offers, for --effect", ].join("\n"); class CliError extends Error {} @@ -56,7 +61,7 @@ class CliError extends Error {} /** The flags of one command line. */ function parse(args) { const valued = new Set([ - "--id", "--label", "--group", "--kind", "--summary", "--style", "--patch", "--patch-json", "--set", + "--id", "--label", "--group", "--kind", "--summary", "--style", "--patch", "--patch-json", "--set", "--effect", "--at", "--dur", "--recipe", "--only", "--progress", ]); /** @type {Record<string, string[]>} */ @@ -126,6 +131,23 @@ async function patchOf(p) { return patch; } +/** The effect presets a project's manifest offers (report-to-video/fx.mjs `fxPresetsFor`). */ +async function effectsOf(project) { + const text = await readFile(path.join(project.dir, "video.manifest.json"), "utf8").catch(() => null); + if (text === null) throw new CliError(`${project.id} has no video.manifest.json`); + return fxPresetsFor(JSON.parse(text)); +} + +/** --effect NAME's patch, with --patch's (if any) merged over it. */ +async function withEffect(p, project, patch) { + const name = p.one("--effect"); + if (!name) return patch; + const effects = await effectsOf(project); + const fx = effects.find((x) => x.name === name); + if (!fx) throw new CliError(`unknown effect "${name}" — this cut offers ${effects.map((x) => x.name).join(", ")}`); + return patch ? mergePatch(fx.patch, patch) : fx.patch; +} + /** The output side: NDJSON on stdout under --progress ndjson, else lines. */ function reporter(p, log, err) { const ndjson = p.one("--progress") === "ndjson"; @@ -189,7 +211,7 @@ export async function takeCommand(args, { reportsRoot = REPORTS_ROOT, log = cons kind: p.one("--kind"), summary: p.one("--summary"), style: p.one("--style") ?? null, - patch: await patchOf(p), + patch: await withEffect(p, project, await patchOf(p)), window: windowOf(p), quick: p.has("--quick"), }; @@ -239,6 +261,13 @@ export async function takesCommand(args, { reportsRoot = REPORTS_ROOT, log = con if (skipped.length) err(`not the shape { label, summary, patch }: ${skipped.join(", ")}`); return error ? 1 : 0; } + if (sub === "effects") { + const project = await pickProject(rest[0], reportsRoot); + const effects = await effectsOf(project); + if (p.has("--json")) log(JSON.stringify({ effects }, null, 2)); + else for (const x of effects) log(`${x.name.padEnd(16)} ${x.label} — ${x.summary}`); + return 0; + } if (sub === "pick") { const project = await pickProject(rest[0], reportsRoot); const take = rest[1]; diff --git a/umtool/lib/report/takeMaker.test.mjs b/umtool/lib/report/takeMaker.test.mjs @@ -432,6 +432,33 @@ test("the CLI: umtool take with --set, umtool takes make with a recipe, umtool t } }); +test("the CLI: umtool takes effects lists the cut's effect presets; umtool take --effect applies one before --set", async () => { + const { root, dir, reportsRoot } = await project(); + const r = stubRender(); + const out = []; + const err = []; + const io = { reportsRoot, log: (s) => out.push(s), err: (s) => err.push(s), deps: { render: r.render, styles: STYLES, probe: async () => 1 } }; + try { + assert.equal(await takesCommand(["effects", "proj", "--json"], io), 0, err.join("\n")); + const { effects } = JSON.parse(out.join("\n")); + const names = effects.map((x) => x.name); + for (const n of ["kinetic-quote", "redaction", "odometer", "scrubber", "glitch", "everything"]) assert.ok(names.includes(n), n); + assert.ok(!names.includes("receipts") && !names.includes("zoom"), "no clip carries a screenshot"); + assert.equal(await takeCommand(["proj", "--id", "glitchy", "--label", "Glitch", "--effect", "glitch", "--set", "render.crf=31", "--full"], io), 0, err.join("\n")); + const doc = r.calls.at(-1).doc; + assert.deepEqual(doc.render.chrome.fx, { glitch: {} }); + assert.equal(doc.render.chrome.engine, "hyperframes"); + assert.equal(doc.render.crf, 31, "--set merges over the effect's patch"); + const t = JSON.parse(await readFile(path.join(dir, "takes", "glitchy", "take.json"), "utf8")); + assert.ok(t.changes.some((c) => c.startsWith("render.chrome")), t.changes.join("; ")); + err.length = 0; + assert.equal(await takeCommand(["proj", "--id", "x", "--label", "X", "--effect", "sparkle"], io), 2); + assert.match(err.join("\n"), /unknown effect "sparkle" — this cut offers kinetic-quote/); + } finally { + await rm(root, { recursive: true, force: true }); + } +}); + test("takeSteps: each button is one job running the CLI, checked before it starts", () => { const proj = { id: "reports/proj" }; const ctx = { styles: STYLES, existing: [{ id: "flash", window: "full" }], clipCount: 75 }; diff --git a/umtool/report-to-video/fx.mjs b/umtool/report-to-video/fx.mjs @@ -717,3 +717,72 @@ export function noNegZero(o) { } const defaultOf = (p) => (p === "scale" || p === "scaleX" || p === "scaleY" || p === "opacity" || p === "autoAlpha" ? 1 : 0); + +// --------------------------------------------------------------------------- +// Presets: what the Takes page's Effect list and `umtool take --effect` offer. +// --------------------------------------------------------------------------- + +/** + * THEN/NOW pairs a cut offers by itself: neighbouring clips whose dates are + * years apart, the widest gaps first, no clip in two pairs, at most `max`. + */ +export function fxSuggestPairs(manifest, max = 2) { + const tl = manifest?.timeline ?? []; + const cands = []; + for (let i = 1; i < tl.length; i += 1) { + const a = tl[i - 1], b = tl[i]; + if (a?.type !== "clip" || b?.type !== "clip") continue; + const da = fxClipDate(a, null), db = fxClipDate(b, null); + if (!da || !db || da.y === db.y) continue; + cands.push({ then: a.id, now: b.id, gap: Math.abs(fxDay(db) - fxDay(da)), i }); + } + cands.sort((x, y) => y.gap - x.gap || x.i - y.i); + const used = new Set(); + const out = []; + for (const c of cands) { + if (out.length >= max || used.has(c.then) || used.has(c.now)) continue; + used.add(c.then); + used.add(c.now); + out.push(c); + } + return out.sort((x, y) => x.i - y.i).map(({ then, now }) => ({ then, now })); +} + +/** + * The effect presets for one manifest, each a merge patch a take applies + * (`{render: {transition, chrome: {engine, layout, fx}}}`): one per effect the + * cut can show, and "everything" -- the line, the rail, the tears, the wipes, + * the receipts and the zoom together. The transition is the cut's own when it + * has one (0.4 s when it cuts hard), so the THEN/NOW wipe has a crossfade to + * ride; the deck's settings are left as they are (a merge patch keeps them). + * Pure, deterministic: the same manifest, the same presets. + * + * @returns {Array<{ name: string, label: string, summary: string, patch: Record<string, any> }>} + */ +export function fxPresetsFor(manifest) { + const tl = manifest?.timeline ?? []; + const t = Number(manifest?.render?.transition ?? 0); + const transition = t > 0 ? t : 0.4; + const patch = (fx) => ({ render: { transition, chrome: { engine: "hyperframes", layout: "deck", fx } } }); + const pairs = fxSuggestPairs(manifest); + const hasReceipts = tl.some((e) => Array.isArray(e?.fx?.receipts) && e.fx.receipts.length); + const hasZoom = tl.some((e) => isObj(e?.fx?.zoom)); + const out = [ + { name: "kinetic-quote", label: "Kinetic quote", summary: "Each clip's line word by word as it is said, the key phrase punched", fx: { kineticQuote: {} } }, + { name: "redaction", label: "Redaction reveal", summary: "Each clip's line under black bars that lift as it is said", fx: { redact: {} } }, + { name: "odometer", label: "Odometer", summary: "A counter that rolls up on each clip", fx: { odometer: {} } }, + { name: "scrubber", label: "Timeline scrubber", summary: "A date rail, the playhead sliding to each clip's day with its picture", fx: { scrubber: {} } }, + { name: "glitch", label: "VHS glitch", summary: "A tape tear and the new year at each cut between years", fx: { glitch: {} } }, + ]; + if (pairs.length) { + out.push({ name: "then-now", label: "THEN / NOW wipe", summary: `The cut from THEN to NOW wipes, the two dates on its edge (${pairs.map((p) => `${p.then} → ${p.now}`).join(", ")})`, fx: { thenNow: { pairs } } }); + } + if (hasReceipts) out.push({ name: "receipts", label: "Receipts", summary: "The clips' screenshots fan in and a marker swipes the cited line", fx: { receipts: {} } }); + if (hasZoom) out.push({ name: "zoom", label: "Zoom to detail", summary: "A screenshot pushed in on its detail", fx: { zoom: {} } }); + const all = { kineticQuote: {}, scrubber: {}, glitch: {} }; + if (pairs.length) all.thenNow = { pairs }; + if (hasReceipts) all.receipts = {}; + if (hasZoom) all.zoom = {}; + out.push({ name: "everything", label: "Everything", summary: `Together: ${Object.keys(all).map((k) => out.find((o) => o.fx[k])?.label).filter(Boolean).join(", ")}`, fx: all }); + return out.map(({ fx, ...p }) => ({ ...p, patch: patch(fx) })); +} diff --git a/umtool/report-to-video/fx.test.mjs b/umtool/report-to-video/fx.test.mjs @@ -326,3 +326,31 @@ test("the overlay lays the effects like the deck: whole cut, reinit off, rgba, s assert.ok(c.inputs.join(" ").includes("-reinit_filter 0 -framerate 30 -start_number 1 -i /o/chrome/fx-frames/frame_%06d.png")); assert.match(c.chain, /\[5:v\]format=rgba\[hfa1\];\[hf0\]\[hfa1\]overlay=x=173:y=2:format=yuv444:shortest=1/); }); + +test("fxSuggestPairs: neighbouring clips years apart, widest gaps first, none twice, in cut order", async () => { + const { fxSuggestPairs } = await import("./fx.mjs"); + const tl = [clip("a", "2019-01-01"), clip("b", "2019-06-01"), clip("c", "2024-01-01"), clip("d", "2025-01-01"), + { type: "card", id: "k", seconds: 3 }, clip("e", "2010-01-01")]; + // b→c (4.6 years) is the widest; c→d (1 year) would reuse c; a→b is the same year; the card breaks d→e. + assert.deepEqual(fxSuggestPairs({ timeline: tl }), [{ then: "b", now: "c" }]); + assert.deepEqual(fxSuggestPairs({ timeline: tl }, 1), [{ then: "b", now: "c" }]); + assert.deepEqual(fxSuggestPairs({ timeline: [clip("a", "2019-01-01"), clip("b", "2019-02-01")] }), []); +}); + +test("fxPresetsFor: one preset per effect the cut can show, each a patch the validators accept", async () => { + const { fxPresetsFor } = await import("./fx.mjs"); + const m = { render: render(undefined, { transition: 0 }), timeline: TIMELINE }; + const presets = fxPresetsFor(m); + assert.deepEqual(presets.map((p) => p.name), ["kinetic-quote", "redaction", "odometer", "scrubber", "glitch", "then-now", "receipts", "zoom", "everything"]); + for (const p of presets) { + assert.equal(p.patch.render.transition, 0.4, `${p.name}: a hard-cut project gets a crossfade to wipe on`); + const chrome = { ...m.render.chrome, ...p.patch.render.chrome }; + assert.deepEqual(validateChrome(chrome, { ...m.render, transition: 0.4 }), [], p.name); + assert.deepEqual(validateFxEntries({ render: { ...m.render, chrome }, timeline: TIMELINE }), [], p.name); + } + // Without screenshots on any clip there is no receipts or zoom preset. + const bare = TIMELINE.map(({ fx: _f, ...e }) => e); + assert.deepEqual(fxPresetsFor({ render: render(undefined), timeline: bare }).map((p) => p.name).filter((n) => n === "receipts" || n === "zoom"), []); + // The cut's own transition is kept. + assert.equal(fxPresetsFor({ render: render(undefined, { transition: 0.25 }), timeline: TIMELINE })[0].patch.render.transition, 0.25); +}); diff --git a/umtool/report-to-video/package.json b/umtool/report-to-video/package.json @@ -27,6 +27,7 @@ "./drafts-review": "./drafts-review.mjs", "./factcheck": "./factcheck.mjs", "./frames-cut": "./frames-cut.mjs", + "./fx": "./fx.mjs", "./ledger-totals": "./ledger-totals.mjs", "./montage": "./montage.mjs", "./montage-styles": "./montage-styles.mjs",