commit 520b2fd11322a838e6cb76318a62a30dfef7ccd2
parent b0fa50fae399c50d40c9aee60bf1d9c7095866d3
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 17 Oct 2026 17:12:06 -0400
umtool: takes — quick render, Make takes on the Cut tab, a picked take re-picks as a no-op; the e2e makes and picks a real take; docs
- `--quick` / quick render (on by default in the form): the render manifest gets x264 veryfast; the take's own manifest, which a pick copies, keeps its encode settings. take.json records `quick`.
- The Cut tab links **Make takes** when the project has no takes/ yet, so the first take is made without a terminal.
- Picking a take whose manifest already is the project's writes nothing and refuses nothing.
- e2e: takes-make-fixture (one clip, its window cached) and e2e/fixtures/montage-styles.e2e.mjs (E2E_UMTOOL_MONTAGE_STYLES); takes.spec makes a take from a style in the form (a real 3 s render, nothing fetched), uses it (the project's manifest equals the take's, the badge shows), makes a second through the route, is refused on a moved project until Use anyway, keeps one pick per group, and fits a phone.
- docs: cli.md (take, takes make/styles/pick), report-video.md "Making takes".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
14 files changed, 281 insertions(+), 30 deletions(-)
diff --git a/umtool/components/projects/NewTakePanel.tsx b/umtool/components/projects/NewTakePanel.tsx
@@ -86,6 +86,8 @@ export default function NewTakePanel({
const [dur, setDur] = useState(String(initialWindow.dur));
const [patchText, setPatchText] = useState("");
const [force, setForce] = useState(false);
+ // On by default: an audition compares cuts, and a quick encode is minutes sooner.
+ const [quick, setQuick] = useState(true);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const [job, setJob] = useState<JobView | null>(null);
@@ -157,7 +159,7 @@ export default function NewTakePanel({
className="grid gap-3 border-t border-seam px-3 py-3 sm:grid-cols-2"
onSubmit={(e) => {
e.preventDefault();
- void submit({ take: { label, group, style: style || null, patch, window: windowOf() } });
+ void submit({ take: { label, group, style: style || null, patch, window: windowOf(), quick } });
}}
>
<Field label="Style" hint={picked?.summary || (styles.length ? undefined : stylesError || "No montage styles are installed.")}>
@@ -258,10 +260,14 @@ export default function NewTakePanel({
data-action="make-all-styles"
disabled={!ready || busy || running || !styles.length || windowBad}
className={buttonVariants({ size: "sm" })}
- onClick={() => void submit({ allStyles: { group, window: windowOf() } })}
+ onClick={() => void submit({ allStyles: { group, window: windowOf(), quick } })}
>
Make all styles{styles.length ? ` (${styles.length})` : ""}
</button>
+ <label className="flex items-center gap-1 text-[12px] text-text-2" title="x264 veryfast for the preview; the take's manifest keeps its own encode">
+ <input type="checkbox" checked={quick} onChange={(e) => setQuick(e.target.checked)} data-take-quick="" disabled={!ready} />
+ quick render
+ </label>
<label className="flex items-center gap-1 text-[12px] text-text-2">
<input type="checkbox" checked={force} onChange={(e) => setForce(e.target.checked)} data-take-force="" disabled={!ready} />
make it again if it exists
diff --git a/umtool/components/projects/TakesBench.tsx b/umtool/components/projects/TakesBench.tsx
@@ -41,6 +41,8 @@ export type Take = {
style?: string | null;
window?: "full" | { at: number; dur: number } | null;
baseHash?: string | null;
+ /** Rendered with a quick encode (the render only). */
+ quick?: boolean;
/** The project's manifest is not the one it was made from (null: it does not say). */
stale?: boolean | null;
};
@@ -428,6 +430,7 @@ function TakeCard({
{t.seconds != null && `${t.seconds.toFixed(1)} s`}
{t.builtAt && !Number.isNaN(Date.parse(t.builtAt)) && ` · ${fmtAgo(Date.parse(t.builtAt))}`}
{windowWords && ` · ${windowWords}`}
+ {t.quick && " · quick"}
</span>
{verdict?.picked && (
<span data-take-picked="" className={badgeVariants({ variant: "on", size: "sm" })}>
diff --git a/umtool/components/projects/report/CutTab.tsx b/umtool/components/projects/report/CutTab.tsx
@@ -122,9 +122,9 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor
</span>
</div>
)}
- {/* Alternative renders of part of the cut, made elsewhere and judged
- on their own page. Only when there is a takes/ to look at. */}
- {takes.exists && (
+ {/* Alternative renders of part of the cut, judged on their own page --
+ where the first one is made, too (release 33's take maker). */}
+ {takes.exists ? (
<Link
href={takesHref(project.id)}
data-takes-link={takes.takes.length}
@@ -132,6 +132,10 @@ export default async function CutTab({ project, detail, search, tabHref }: Repor
>
Takes — {takes.takes.length}
</Link>
+ ) : (
+ <Link href={takesHref(project.id)} data-takes-make-link="" className={buttonVariants({ variant: "quiet", size: "sm" })}>
+ Make takes
+ </Link>
)}
</div>
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -39,6 +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)) |
+| `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` |
A project argument is an exact id, a directory, or a **unique** basename. Two
projects answering to one name is reported, never resolved by picking one.
@@ -47,7 +50,9 @@ projects answering to one name is reported, never resolved by picking one.
`REPORTS_DIR`, `SONG_REPORTS_DIR`, `SONG_DIR`, `CHANNELS_DIR`, `UMTOOL_INDEX_DIR`,
`UMTOOL_CACHE_DIR`, `UMTOOL_MEDIA_DIR`
-— which is how it is tested against the e2e fixture. The path defaults
+— which is how it is tested against the e2e fixture (which also sets
+`E2E_UMTOOL_MONTAGE_STYLES`, the montage styles module `take`/`takes` read in place of
+`report-to-video/montage-styles.mjs`). The path defaults
(`lib/paths.mjs`, `song/paths.mjs`):
| Variable | Default |
diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md
@@ -695,17 +695,22 @@ there too. No field is moved or rewritten.
## Takes: alternative renders, judged side by side
`/projects/<project>/takes` (a bench: [piece.md](piece.md#the-benches)), linked from the Cut tab as **Takes — N**
-when `takes/` exists.
-Something else renders the takes; umtool reads them and records the verdicts.
+when `takes/` exists, and as **Make takes** when it does not.
+umtool's take maker makes them (below), or something else does in the same shape; umtool reads
+them and records the verdicts.
```
takes/<id>/take.json id (== dir, [a-z0-9-]), group, order, label,
kind reference|similar|different, preview;
optional summary, changes[], seconds, builtAt
takes/<id>/preview.mp4 whatever `preview` names, inside the take dir
-takes/verdicts.json { "<id>": { verdict: like|maybe|no|null, note, at } }
+takes/verdicts.json { "<id>": { verdict: like|maybe|no|null, note, at, picked?: true } }
```
+The take maker also records, in take.json, `style`, `patch`, `window` (`"full"` or
+`{ at, dur }`), `quick`, `entries` (`{ ids, basis }`: what the window covered) and `baseHash` (sha256 of
+the project's `video.manifest.json` the take was made from); all optional, checked when present.
+
A take.json that fails validation is listed under **skipped** with the reason;
a directory with no take.json is not a take. A row whose verdict is null and
note empty is removed. A `verdicts.json` that does not parse is never
@@ -724,6 +729,62 @@ anyway**; a umtool job working in the project refuses. Its verdict row and the
notes on it are kept: the agent reads them back, and a verdict on a take that is
gone shows as missing.
+### Making takes
+
+On the Takes page, **New take**: a montage style (or none), a label (the style's, until typed
+over), a group (the newest take's), the window — from *S* s for *D* s (0 / 60 by default) or
+**Full cut** — an optional patch (a JSON object, checked before it is sent) and **quick render**
+(on by default: the render is encoded with x264 `veryfast`; the take's own manifest, which a pick
+uses, keeps its encode settings). **Make all
+styles** makes one take per style with that group and window. Each is one job on the app's
+runner, shown under the form with its log and **Stop**; the take appears when it is built.
+Nothing on the page calls a model. The same, from a terminal ([cli.md](cli.md)):
+
+```
+umtool take <project> --id flash --label "Flash" --style flash-count --at 0 --dur 60
+umtool take <project> --id crisp --label "Crisp" --set render.crf=34 --full
+umtool takes make <project> --recipe takes/recipe.json # or --all-styles
+umtool takes styles
+umtool takes pick <project> flash [--anyway]
+```
+
+A take (`lib/report/takeMaker.mjs`):
+
+1. reads the project's `video.manifest.json`, applies the style's patch
+ (`report-to-video/montage-styles.mjs`: `MONTAGE_STYLES[name].patch`) and then the take's own —
+ RFC 7386 JSON merge patches: objects merge, `null` removes a key, an array replaces whole;
+2. writes `takes/<id>/video.manifest.json`, the whole patched manifest, and `changes[]`: one plain
+ line per leaf the patches change (`render.montage.cut: flash`, `render.crf: 34 (was 30)`,
+ `render.montage.ramp: removed`) after `style: <label>`. No change at all is the `reference`
+ kind; otherwise `different` (or `--kind similar`);
+3. renders: build-video through the heavy slot (`queue-lock.mjs --heavy`), `--skip-fetch`
+ (nothing is fetched: the take's `out/clips-raw` and `out/narration` are links to the
+ project's, and the editor's corpus windows are found as for any build), `--no-xfade` unless
+ the take sets `render.transition`, `--no-chapters` for a window. The manifest it renders sits
+ beside the project's (`.take-<id>.render.json`, removed after) so its relative paths hold.
+ A **window** renders the entries [at, at + dur] touches — timed by the project's
+ `out/sourced/schedule.json` when it names every entry, else by each entry's own length (a
+ clip's cut, else `seconds`, else 4 s) — as a cut of its own, so every take of a group made with
+ one window covers the same entries;
+4. moves the render to `takes/<id>/preview.mp4` and writes take.json — only then; a take that
+ fails leaves no take.json (a work dir the listing ignores), and a failed **Rebuild** leaves the
+ old take whole.
+
+`--quick` (a recipe's or a take's `quick: true`) is that quick render. A take that exists is skipped unless forced (**make it again if it exists**, `--force`).
+**Rebuild** on a card (`--rebuild`) makes it again from its own take.json against the project's
+manifest as it is now. A recipe is `{ group, window, quick?, takes: [{ id, label, style?, patch?,
+summary?, kind?, quick? }] }` (a take's own `group`/`window`/`quick` win), run one take at a time, carrying on
+past a failure; Make all styles writes `takes/all-styles.recipe.json`.
+
+**Use this take** (`POST /api/report/takes/pick`, `umtool takes pick`) copies the take's
+`video.manifest.json` over the project's through the manifest writer (`replaceManifest`: the
+automatic snapshot `auto-before-pick-take` first, the generated-manifest guard, the drafted-mark
+rule), marks it **picked** in verdicts.json (one pick per group) and links the History tab's
+revisions; **Undo last edit** on the Cut tab takes it back. When the project's manifest is not
+the one the take was made from (its `baseHash`), the card says **The project changed since this
+take was made** and the pick waits for **Use anyway**. A take that does not record its base asks
+the same.
+
## Operator notes, timed notes and the generated-manifest guard
Notes on a project live in `<project>/notes.json` (shape and CLI:
diff --git a/umtool/e2e/fixtures/make-fixture.mjs b/umtool/e2e/fixtures/make-fixture.mjs
@@ -1960,6 +1960,23 @@ take("intro-a", { group: "opening", order: 5, label: "Cold open", kind: "similar
take("bad-kind", { group: "finale", order: 4, label: "Bad", kind: "maybe" });
mkdirSync(path.join(TAKES, "takes", "current", "out"), { recursive: true });
+// takes-make-fixture: a project the take MAKER makes takes of (takes.spec.ts:
+// New take -> the take appears -> Use this take). One clip, its window cached
+// in out/clips-raw (the take links it, never fetches), no takes/ yet. Its own
+// project, because the spec writes its manifest. The styles the form offers
+// are e2e/fixtures/montage-styles.e2e.mjs (E2E_UMTOOL_MONTAGE_STYLES).
+const TAKES_MAKE = writeProject(
+ "takes-make-fixture",
+ manifest("takes-make-fixture", "The Take Maker Fixture", { siteOrigin: "https://archive.example" }, [
+ { type: "clip", id: "m01", video: "vid1", start: 3, end: 6, cite: 3, section: 0, lock: true, quote: "and because" },
+ ]),
+);
+mkdirSync(path.join(TAKES_MAKE, "out", "clips-raw"), { recursive: true });
+copyFileSync(
+ path.join(REPORT, "out", "clips-raw", "vid1_0.00-9.00.mp4"),
+ path.join(TAKES_MAKE, "out", "clips-raw", "vid1_0.00-9.00.mp4"),
+);
+
// -- THE VIDEO-NOTES AND TIMELINE FIXTURES ------------------------------------
//
// video-notes-fixture is a GENERATED manifest (`generatedBy`) with a built cut
@@ -2083,6 +2100,7 @@ console.log(` onscreen-posts-fixture (writable, deck on, three posts,
console.log(` onscreen-feed-fixture (writable, posts feed, built by the spec)`);
console.log(` deliver-stop-fixture (writable: six confirmed clips to cut, for Stop and resume)`);
console.log(` takes-fixture (writable: takes/ with 4 takes over 2 groups, 1 skipped)`);
+console.log(` takes-make-fixture (writable: one clip, its window cached, no takes/ -- the take maker's)`);
console.log(` narration-fixture (writable: a narrated card, voiced by the editor stub's tone)`);
console.log(` narration-review-fixture (writable: two narrated cards, nothing judged)`);
console.log(` draft-review-fixture (writable: drafted on-screen, narration, teaser; an alternative), draft-review-build-fixture`);
diff --git a/umtool/e2e/fixtures/montage-styles.e2e.mjs b/umtool/e2e/fixtures/montage-styles.e2e.mjs
@@ -0,0 +1,16 @@
+// The montage styles the e2e's Takes page offers (E2E_UMTOOL_MONTAGE_STYLES,
+// set in playwright.config.ts): the shape of report-to-video/montage-styles.mjs,
+// with patches any manifest renders -- the suite tests the take maker, not a
+// style's look.
+export const MONTAGE_STYLES = {
+ "e2e-crisp": {
+ label: "Crisp",
+ summary: "A lower quality setting.",
+ patch: { render: { crf: 34 } },
+ },
+ "e2e-soft": {
+ label: "Soft",
+ summary: "A higher quality setting.",
+ patch: { render: { crf: 26 } },
+ },
+};
diff --git a/umtool/e2e/takes.spec.ts b/umtool/e2e/takes.spec.ts
@@ -1,5 +1,5 @@
import { test, expect } from "@playwright/test";
-import { readFileSync } from "node:fs";
+import { readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import * as urls from "./urls";
@@ -25,6 +25,8 @@ test("a project with no takes/ says so, and its page has no takes link", async (
await page.goto(urls.section("reports/report-fixture", "takes"));
await expect(page.locator("[data-takes-link]")).toHaveCount(0);
+ // ...but a way to make the first one.
+ await expect(page.locator("[data-takes-make-link]")).toHaveAttribute("href", urls.takesHref("reports/report-fixture"));
});
test("takes are grouped and ordered; the skipped one says why; a work dir is not a take", async ({ page }) => {
@@ -142,3 +144,94 @@ test("listen picks the one audio source; play all starts the group from zero", a
expect(await muted("ref")).toBe(false);
expect(await muted("slow")).toBe(true);
});
+
+// ---------------------------------------------------------------------------
+// The take maker (release 33), on takes-make-fixture: one clip, its window
+// cached, no takes/. The styles are e2e/fixtures/montage-styles.e2e.mjs. A
+// take is a real (tiny) render -- build-video over the cached window, nothing
+// fetched -- and a pick writes the project's manifest.
+// ---------------------------------------------------------------------------
+
+const MAKE_DIR = path.join(HERE, "..", ".e2e-song", "reports", "takes-make-fixture");
+const MAKE_PAGE = urls.takesHref("reports/takes-make-fixture");
+const readText = (rel: string) => readFileSync(path.join(MAKE_DIR, rel), "utf8");
+
+test("the take maker: New take with a style, the take appears, Use this take makes it the project's manifest", async ({ page, request }) => {
+ test.setTimeout(240_000);
+ await page.goto(MAKE_PAGE);
+ await expect(page.locator("[data-takes-empty]")).toContainText("No takes yet");
+
+ await page.locator("[data-action='new-take-open']").click();
+ const style = page.locator("[data-take-style]");
+ await expect(style).toBeEnabled();
+ await style.selectOption("e2e-crisp");
+ await expect(page.locator("[data-take-label]")).toHaveValue("Crisp");
+ await page.locator("[data-take-window='full']").check();
+ // A patch that is not a JSON object is refused before anything is sent.
+ await page.locator("[data-take-patch]").fill("[1, 2]");
+ await expect(page.locator("[data-action='make-take']")).toBeDisabled();
+ await page.locator("[data-take-patch]").fill("");
+ await page.locator("[data-action='make-take']").click();
+
+ await expect(page.locator("[data-take-job]")).toBeVisible();
+ const card = page.locator("[data-take='crisp']");
+ await expect(card).toBeVisible({ timeout: 180_000 });
+ await expect(card).toContainText("style: Crisp");
+ await expect(card).toContainText("render.crf: 34 (was 30)");
+ await expect(card).toHaveAttribute("data-kind", "different");
+ await expect(card.locator("video")).toHaveCount(1);
+ const made = JSON.parse(readText("takes/crisp/take.json"));
+ expect(made.style).toBe("e2e-crisp");
+ expect(made.window).toBe("full");
+ // Quick render is on by default: the render's encode, never the take's manifest.
+ expect(made.quick).toBe(true);
+ expect(JSON.parse(readText("takes/crisp/video.manifest.json")).render.preset).toBe("ultrafast");
+ expect(made.baseHash).toMatch(/^[0-9a-f]{64}$/);
+ expect(JSON.parse(readText("takes/crisp/video.manifest.json")).render.crf).toBe(34);
+
+ // Use this take: the project's manifest is the take's, the badge shows.
+ await card.locator("[data-action='pick']").click();
+ await expect(card.locator("[data-take-used]")).toBeVisible();
+ await expect(card.locator("[data-take-picked]")).toBeVisible();
+ expect(readText("video.manifest.json")).toBe(readText("takes/crisp/video.manifest.json"));
+ expect(JSON.parse(readText("takes/verdicts.json")).crisp.picked).toBe(true);
+
+ // A second take, by the route the form uses. It is made from the picked manifest.
+ const r = await request.post("/api/report/takes/make", {
+ data: { project: "reports/takes-make-fixture", take: { label: "Soft", style: "e2e-soft", window: "full" } },
+ });
+ expect(r.status()).toBe(200);
+ const { job } = (await r.json()) as { job: { id: string } };
+ await expect
+ .poll(async () => ((await (await request.get(`/api/report/takes/make?job=${job.id}`)).json()) as { state: string }).state, { timeout: 180_000 })
+ .toBe("done");
+
+ // The project moves on after the take was made: Use this take is refused until Use anyway.
+ const m = JSON.parse(readText("video.manifest.json"));
+ writeFileSync(path.join(MAKE_DIR, "video.manifest.json"), JSON.stringify({ ...m, title: "Moved on" }, null, 2) + "\n");
+ await page.reload();
+ const soft = page.locator("[data-take='soft']");
+ await soft.locator("[data-action='pick']").click();
+ await expect(soft.locator("[data-take-stale]")).toContainText("The project changed since this take was made");
+ expect(JSON.parse(readText("video.manifest.json")).title).toBe("Moved on");
+ await soft.locator("[data-action='pick-anyway']").click();
+ await expect(soft.locator("[data-take-picked]")).toBeVisible();
+ expect(readText("video.manifest.json")).toBe(readText("takes/soft/video.manifest.json"));
+ // One pick per group.
+ await page.reload();
+ await expect(page.locator("[data-take='crisp'] [data-take-picked]")).toHaveCount(0);
+ await expect(page.locator("[data-take='soft'] [data-take-picked]")).toBeVisible();
+});
+
+test("the Takes page with the New take form open fits a phone", async ({ page }) => {
+ await page.setViewportSize({ width: 390, height: 844 });
+ await page.goto(MAKE_PAGE);
+ await page.locator("[data-action='new-take-open']").click();
+ await expect(page.locator("[data-take-style]")).toBeVisible();
+ const { scroll, client } = await page.evaluate(() => ({
+ scroll: document.documentElement.scrollWidth,
+ client: document.documentElement.clientWidth,
+ }));
+ expect(scroll).toBeLessThanOrEqual(client);
+ await expect(page.locator("[data-action='pick']").first()).toBeVisible();
+});
diff --git a/umtool/lib/report/takeCli.mjs b/umtool/lib/report/takeCli.mjs
@@ -4,7 +4,7 @@
//
// 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] [--force] [--progress ndjson]
+// [--at S --dur S | --full] [--quick] [--force] [--progress ndjson]
// umtool take <project> --id <id> --rebuild made again from its own take.json
// 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]
@@ -31,19 +31,20 @@ import { TAKE_FILE, takesDirOf } from "./takes.mjs";
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] [--force] [--progress ndjson]",
+ " [--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.`,
+ `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).",
].join("\n");
export const TAKES_USAGE = [
"usage: umtool takes make <project> [--recipe FILE] [--only ID,ID] [--force] [--progress ndjson]",
` the recipe's takes, one at a time (default: takes/${RECIPE_FILE}); a take that`,
" exists is skipped unless --force",
- " umtool takes make <project> --all-styles [--group G] [--at S --dur S | --full] [--force]",
+ " umtool takes make <project> --all-styles [--group G] [--at S --dur S | --full] [--quick] [--force]",
` 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",
@@ -177,6 +178,7 @@ export async function takeCommand(args, { reportsRoot = REPORTS_ROOT, log = cons
style: prev.style ?? null,
patch: prev.patch ?? null,
window: prev.window ?? undefined,
+ quick: prev.quick === true,
};
} else {
spec = {
@@ -188,6 +190,7 @@ export async function takeCommand(args, { reportsRoot = REPORTS_ROOT, log = cons
style: p.one("--style") ?? null,
patch: await patchOf(p),
window: windowOf(p),
+ quick: p.has("--quick"),
};
}
const r = await makeTake(project.dir, spec, {
@@ -260,7 +263,7 @@ export async function takesCommand(args, { reportsRoot = REPORTS_ROOT, log = con
if (p.has("--recipe")) throw new CliError("--all-styles or --recipe, not both");
const loaded = deps?.styles ? { styles: /** @type {any} */ (deps.styles), error: null } : await loadMontageStyles();
if (loaded.error) throw new Error(loaded.error);
- recipe = allStylesRecipe(loaded.styles, { group: p.one("--group") ?? undefined, window: windowOf(p) });
+ recipe = allStylesRecipe(loaded.styles, { group: p.one("--group") ?? undefined, window: windowOf(p), quick: p.has("--quick") });
const file = path.join(takesDirOf(project.dir), ALL_STYLES_RECIPE);
await mkdir(takesDirOf(project.dir), { recursive: true });
await writeFile(file, JSON.stringify(recipe, null, 2) + "\n", "utf8");
diff --git a/umtool/lib/report/takeMaker.mjs b/umtool/lib/report/takeMaker.mjs
@@ -54,6 +54,12 @@ export const RECIPE_FILE = "recipe.json";
export const ALL_STYLES_RECIPE = "all-styles.recipe.json";
export const DEFAULT_GROUP = "takes";
export const DEFAULT_WINDOW = { at: 0, dur: 60 };
+/**
+ * A QUICK render: what the render manifest gets on top of the take, never the
+ * take's own manifest -- so a pick never carries an audition's encode setting
+ * into the deliverable. Every take of a group made quick is encoded alike.
+ */
+export const QUICK_RENDER = Object.freeze({ render: Object.freeze({ preset: "veryfast" }) });
/** The project's out/ entries a take's out/ links to: the fetched media and the synthesized voices. */
export const SHARED_OUT = ["clips-raw", "narration"];
/** Where a take's render manifest sits while it renders: beside the project's, so its relative paths hold. */
@@ -318,7 +324,7 @@ export function normalizeWindow(w) {
* @typedef {{
* id: string, label: string, group?: string, kind?: string, summary?: string,
* style?: string | null, patch?: Record<string, unknown> | null,
- * window?: "full" | { at: number, dur: number } | null, order?: number,
+ * window?: "full" | { at: number, dur: number } | null, order?: number, quick?: boolean,
* }} TakeSpec
*
* @typedef {{
@@ -352,6 +358,7 @@ export function checkSpec(spec) {
patch: isObj(spec.patch) ? spec.patch : null,
window: spec.window === "full" ? "full" : normalizeWindow(spec.window),
order: typeof spec.order === "number" && Number.isFinite(spec.order) ? spec.order : null,
+ quick: spec.quick === true,
};
}
@@ -437,6 +444,7 @@ export async function makeTake(projectDir, rawSpec, opts = {}) {
if (!ids.length) throw new Error(`${spec.id}: the patch removed every entry the window covers (${covered.ids.join(", ")})`);
renderDoc = windowManifest(manifest, ids);
}
+ if (spec.quick) renderDoc = /** @type {Record<string, any>} */ (mergePatch(renderDoc, QUICK_RENDER));
await mkdir(takeDir, { recursive: true });
const takeOut = path.join(takeDir, "out");
@@ -495,6 +503,7 @@ export async function makeTake(projectDir, rawSpec, opts = {}) {
style: spec.style,
patch: spec.patch,
window: spec.window,
+ ...(spec.quick ? { quick: true } : {}),
...(covered ? { entries: { ids: covered.ids, basis: covered.basis } } : {}),
baseHash: hashText(baseText),
};
@@ -524,27 +533,28 @@ async function moveFile(from, to) {
// ---------------------------------------------------------------------------
/**
- * A recipe, checked: `{ group?, window?, takes: [{ id, label, style?, patch?,
- * summary?, kind?, group?, window? }] }`. A take's own group and window win
- * over the recipe's. Ids are unique.
+ * A recipe, checked: `{ group?, window?, quick?, takes: [{ id, label, style?,
+ * patch?, summary?, kind?, group?, window?, quick? }] }`. A take's own group,
+ * window and quick win over the recipe's. Ids are unique.
*
* @param {unknown} raw
- * @returns {{ group: string, window: "full" | { at: number, dur: number }, takes: ReturnType<typeof checkSpec>[] }}
+ * @returns {{ group: string, window: "full" | { at: number, dur: number }, quick: boolean, takes: ReturnType<typeof checkSpec>[] }}
*/
export function parseRecipe(raw) {
if (!isObj(raw)) throw new Error("a recipe is an object");
const group = typeof raw.group === "string" && raw.group.trim() ? raw.group.trim() : DEFAULT_GROUP;
const window = raw.window === "full" ? "full" : normalizeWindow(raw.window);
+ const quick = raw.quick === true;
if (!Array.isArray(raw.takes) || !raw.takes.length) throw new Error("a recipe needs takes: [...]");
const seen = new Set();
const takes = raw.takes.map((t, i) => {
if (!isObj(t)) throw new Error(`takes[${i}] is not an object`);
- const spec = checkSpec({ group, window, ...t });
+ const spec = checkSpec({ group, window, quick, ...t });
if (seen.has(spec.id)) throw new Error(`take ${spec.id} is in the recipe twice`);
seen.add(spec.id);
return spec;
});
- return { group, window, takes };
+ return { group, window, quick, takes };
}
/**
@@ -586,15 +596,16 @@ export async function makeTakes(projectDir, recipe, opts = {}) {
* group and window. The take id is the style's name made into a take id.
*
* @param {Record<string, { label: string, summary: string }>} styles
- * @param {{ group?: string, window?: unknown }} [opts]
+ * @param {{ group?: string, window?: unknown, quick?: boolean }} [opts]
*/
-export function allStylesRecipe(styles, { group = DEFAULT_GROUP, window = DEFAULT_WINDOW } = {}) {
+export function allStylesRecipe(styles, { group = DEFAULT_GROUP, window = DEFAULT_WINDOW, quick = false } = {}) {
const names = Object.keys(styles);
if (!names.length) throw new Error("no montage styles are installed");
const used = new Set();
return {
group,
window,
+ ...(quick ? { quick: true } : {}),
takes: names.map((name) => {
const id = uniqueTakeId(name, used);
used.add(id);
@@ -665,12 +676,17 @@ export async function pickTake(project, takeId, { anyway = false, token = null,
if (text === null) throw new Error(`take ${takeId} has no ${MANIFEST} to use`);
const manifest = JSON.parse(text);
if (!isObj(manifest) || !Array.isArray(manifest.timeline)) throw new Error(`take ${takeId}'s ${MANIFEST} is not a manifest`);
- if (!anyway) {
+ // Already the project's manifest (picked before): nothing to write, nothing to refuse.
+ const current = await readFile(path.join(project.dir, MANIFEST), "utf8").catch(() => null);
+ const same = current === text;
+ if (!anyway && !same) {
const stale = await takeIsStale(project.dir, take);
if (stale === null) throw new TakeStale("This take does not record which manifest it was made from");
if (stale) throw new TakeStale("The project changed since this take was made");
}
- const { result, editNotes } = await withEditNotes(project, () => replaceManifest(project.dir, manifest, { token, op: "pick-take" }));
+ const { result, editNotes } = same
+ ? { result: { snapshot: null, token: null }, editNotes: null }
+ : await withEditNotes(project, () => replaceManifest(project.dir, manifest, { token, op: "pick-take" }));
const group = listing.takes.filter((t) => t.group === take.group).map((t) => t.id);
const { verdicts } = await setTakePicked(project.dir, takeId, group, { now });
return { take: takeId, group: take.group, snapshot: result.snapshot, token: result.token, editNotes, verdicts };
@@ -691,8 +707,8 @@ const windowArgs = (w) => (w === "full" ? ["--full"] : ["--at", String(w.at), "-
* What a Takes-page button asks for, as the steps of one job. Every argument
* is checked here first, so a bad request is a 400 and not a failed job.
*
- * { take: { id?, label, group?, style?, patch?, window?, summary?, kind? }, force? } New take
- * { allStyles: { group?, window? }, force? } Make all styles
+ * { take: { id?, label, group?, style?, patch?, window?, summary?, kind?, quick? }, force? } New take
+ * { allStyles: { group?, window?, quick? }, force? } Make all styles
* { rebuild: "<take id>" } Rebuild
*
* @param {{ id: string }} project
@@ -718,6 +734,7 @@ export function takeSteps(project, req, { styles, existing, clipCount }) {
const recipe = allStylesRecipe(styles, {
group: typeof req.allStyles.group === "string" && req.allStyles.group.trim() ? req.allStyles.group.trim() : DEFAULT_GROUP,
window: req.allStyles.window === "full" ? "full" : normalizeWindow(req.allStyles.window),
+ quick: req.allStyles.quick === true,
});
const group = ["--group", recipe.group];
return {
@@ -726,7 +743,7 @@ export function takeSteps(project, req, { styles, existing, clipCount }) {
steps: [{
...base,
label: `make ${recipe.takes.length} take(s), one per style`,
- argv: [...cli, "takes", "make", project.id, "--all-styles", ...group, ...windowArgs(recipe.window), ...force, "--progress", "ndjson"],
+ argv: [...cli, "takes", "make", project.id, "--all-styles", ...group, ...windowArgs(recipe.window), ...(recipe.quick ? ["--quick"] : []), ...force, "--progress", "ndjson"],
timeoutMs: recipe.takes.length * takeTimeoutMs(recipe.window === "full", clipCount),
}],
};
@@ -743,7 +760,7 @@ export function takeSteps(project, req, { styles, existing, clipCount }) {
...(spec.summary ? ["--summary", spec.summary] : []),
...(spec.style ? ["--style", spec.style] : []),
...(spec.patch ? ["--patch-json", JSON.stringify(spec.patch)] : []),
- ...windowArgs(spec.window), ...force, "--progress", "ndjson",
+ ...windowArgs(spec.window), ...(spec.quick ? ["--quick"] : []), ...force, "--progress", "ndjson",
];
return {
kind: `take ${project.id} ${spec.id}`,
diff --git a/umtool/lib/report/takeMaker.test.mjs b/umtool/lib/report/takeMaker.test.mjs
@@ -165,6 +165,8 @@ test("makeTake: the style's patch then the take's, rendered from beside the proj
assert.deepEqual(t.entries, { ids: ["s02", "s03"], basis: "estimate" });
assert.match(t.baseHash, /^[0-9a-f]{64}$/);
assert.equal(await takeIsStale(dir, t), false);
+ assert.equal(t.quick, undefined);
+ assert.equal(r.calls[0].doc.render.preset, undefined);
// The listing reads it back.
const listing = await listTakes(dir);
assert.deepEqual(listing.takes.map((x) => [x.id, x.style, x.baseHash === t.baseHash]), [["flash", "flash", true]]);
@@ -191,6 +193,15 @@ test("makeTake: no change is the reference; a transition turns crossfades on; fu
assert.equal(soft.kind, "similar");
assert.equal(soft.order, 2);
assert.deepEqual(soft.window, { at: 0, dur: 60 }, "the default window");
+ // Quick: the RENDER is encoded veryfast; the take's manifest -- what a pick uses -- is not touched.
+ await makeTake(dir, { id: "quick", label: "Quick", patch: { render: { crf: 33 } }, quick: true }, opts(r));
+ assert.equal(r.calls[2].doc.render.preset, "veryfast");
+ assert.equal(r.calls[2].doc.render.crf, 33);
+ const qm = JSON.parse(await readFile(path.join(dir, "takes", "quick", "video.manifest.json"), "utf8"));
+ assert.equal(qm.render.preset, undefined);
+ const qt = JSON.parse(await readFile(path.join(dir, "takes", "quick", "take.json"), "utf8"));
+ assert.equal(qt.quick, true);
+ assert.deepEqual(qt.changes, ["render.crf: 33 (was 30)"]);
} finally {
await rm(root, { recursive: true, force: true });
}
@@ -241,6 +252,7 @@ test("recipes: checked, made one at a time, existing takes skipped unless forced
assert.throws(() => parseRecipe({ takes: [{ id: "a", label: "A" }, { id: "a", label: "B" }] }), /twice/);
const parsed = parseRecipe({ group: "g", window: "full", takes: [{ id: "a", label: "A" }, { id: "b", label: "B", group: "own", window: { at: 1, dur: 2 } }] });
assert.deepEqual(parsed.takes.map((t) => [t.id, t.group, t.window]), [["a", "g", "full"], ["b", "own", { at: 1, dur: 2 }]]);
+ assert.deepEqual(parseRecipe({ quick: true, takes: [{ id: "a", label: "A" }, { id: "b", label: "B", quick: false }] }).takes.map((t) => t.quick), [true, false]);
const { root, dir } = await project();
const r = stubRender();
@@ -294,6 +306,10 @@ test("pickTake: the take's manifest over the project's, an undo point first, one
let v = await readVerdicts(dir);
assert.equal(v.flash.picked, true);
assert.equal(v.flash.verdict, "like");
+ // Picking it again is no write and no refusal: it already is the project's manifest.
+ const again = await pickTake(proj, "flash");
+ assert.equal(again.snapshot, null);
+ assert.equal(await readFile(path.join(dir, "video.manifest.json"), "utf8"), projectText);
// The other take was made from the manifest the pick replaced: refused, then used anyway.
await assert.rejects(pickTake(proj, "straight"), (e) => e instanceof TakeStale && /changed since this take was made/.test(e.message));
@@ -405,6 +421,7 @@ test("takeSteps: each button is one job running the CLI, checked before it start
assert.ok(takeSteps(proj, { take: { label: "Flash", style: "flash", id: "flash" }, force: true }, ctx).steps[0].argv.includes("--force"));
assert.throws(() => takeSteps(proj, { take: { label: "X", style: "nope" } }, ctx), /unknown style/);
assert.throws(() => takeSteps(proj, { take: { label: "" } }, ctx), /label/);
+ assert.ok(takeSteps(proj, { take: { label: "Q", quick: true } }, ctx).steps[0].argv.includes("--quick"));
const all = takeSteps(proj, { allStyles: { group: "m", window: "full" } }, ctx);
assert.deepEqual(all.takes, ["flash", "straight"]);
assert.deepEqual(all.steps[0].argv.slice(2), ["takes", "make", "reports/proj", "--all-styles", "--group", "m", "--full", "--progress", "ndjson"]);
diff --git a/umtool/lib/report/takes.mjs b/umtool/lib/report/takes.mjs
@@ -110,6 +110,7 @@ export function parseTake(dirName, raw) {
patch: isPlainObject(j.patch) ? /** @type {Record<string, unknown>} */ (j.patch) : null,
window,
baseHash: typeof j.baseHash === "string" && j.baseHash ? j.baseHash : null,
+ quick: j.quick === true,
},
};
}
diff --git a/umtool/lib/report/takes.test.mjs b/umtool/lib/report/takes.test.mjs
@@ -70,6 +70,7 @@ test("parseTake accepts the contract and fills the optional fields", () => {
patch: null,
window: null,
baseHash: null,
+ quick: false,
});
const min = parseTake("x", { id: "x", group: "g", order: 0, label: "X", kind: "reference", preview: "p.mp4" });
assert.ok("take" in min);
diff --git a/umtool/playwright.config.ts b/umtool/playwright.config.ts
@@ -22,6 +22,8 @@ import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs";
// `next dev` in .next-e2e, no rebuild per edit
// E2E_BUILD_CHECKED set below once the stamp was checked, so a
// worker's load of this config does not check again
+// E2E_UMTOOL_MONTAGE_STYLES set below on the app server: the montage styles
+// module the take maker reads (release 33)
// The ports are common/lib/ports.mjs's (offset per worktree by
// scripts/worktree.mjs), not test-only, and keep their names.
const PORT = portFor("UMTOOL_E2E_PORT");
@@ -158,6 +160,10 @@ export default defineConfig({
// takes a second (onscreen.spec.ts). Its review stills use the system
// chromium (CHROME, default /usr/bin/chromium), which is not stubbed.
`HYPERFRAMES_BIN=${FIXTURE}/bin/hyperframes ` +
+ // The montage styles the Takes page offers (release 33): a stub module of
+ // report-to-video/montage-styles.mjs's shape, so takes.spec makes a take
+ // with a style whatever the real styles do. Read by lib/report/takeMaker.mjs.
+ `E2E_UMTOOL_MONTAGE_STYLES=${path.join(path.dirname(fileURLToPath(import.meta.url)), "e2e", "fixtures", "montage-styles.e2e.mjs")} ` +
// Where a clip window is fetched FROM, and the shared secret it is asked
// with. Set here rather than in a step's env: jobView() echoes a step's
// env back to the browser, and this is a token.