Archilyzer · Source

archilyzer

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

commit e7b6125ecbba475cdf6fabf0a97e372f58e4f817
parent 3eb74e3bad96120b1f0457c6b5e23499da1a4b94
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 12 Nov 2026 20:49:08 -0500

umtool: the analysis item in the build, the schedule and the lint (render path, part 2)

build-video: an `analysis` entry is built as its own segment (buildAnalysisSegment)
-- its page composed and rendered (cached by its key), encoded with the named
clip's sound over [start, end] read from that clip's own source (fetchClipAligned,
its sync offset applied, levelled to the cut's loudness target, faded) or the
teaser's silence; an unchanged item is not encoded again (<id>.analysis.json).
--chrome-only rebuilds it from the cache. Its errors are among the build's
validators. deck.mjs: its length, the deck away over it, its title. lint: its
errors and warnings, and its QR measured. knobs.md's Modules section regenerated.
Every cut without an analysis item: the pin over every ~/reports cut and take
is identical to main.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/docs/knobs.md | 9+++++++++
Aumtool/report-to-video/analysis-build.test.mjs | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/analysis-plan.mjs | 15+++++++++++++++
Mumtool/report-to-video/build-video.mjs | 116++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Mumtool/report-to-video/deck.mjs | 9+++++++++
Mumtool/report-to-video/lint.mjs | 17+++++++++++++++++
Mumtool/report-to-video/modules/analysis.mjs | 19+++----------------
7 files changed, 235 insertions(+), 19 deletions(-)

diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -2386,6 +2386,7 @@ filter. A knob absent is its default, and a module whose knobs are all absent dr | [Counter](#counter) `counter` | A running tally of named series in the deck, each cell stepping as a mark's stamp lands. (drawn in the deck's page) | `render.chrome.deck.counter` | | [Claim checks](#claim-checks) `claims` | His explicit claims against the record on the rail: a count over a window, a goalpost moved. (drawn in the deck's page) | `render.chrome.deck.claims` | | [Section title](#section-title) `section-title` | The current section's name (the marker that opened it) on one quiet line under the rail. (drawn in the deck's page) | `render.chrome.deck.sectionTitle` | +| [Analysis item](#analysis-item) `analysis` | An ending built from the ledger: a chart of a named run of his weights, a pace table, a status row and one reading line, as its own segment. (a segment cut into the timeline) | -- | | [Teaser](#teaser) `teaser` | A full-frame card of lines popping in on the beat, inserted as its own segment. (a segment cut into the timeline) | -- | | [Intro](#intro) `intro` | The brand sting the cut opens with, a site's name swapped in on the chime. (a segment cut into the timeline) | `render.intro` | | [Blur](#blur) `blur` | A clip's picture blurred at its encode, a caption on it, the sound as recorded. (a filter on the footage) | `render.blur` | @@ -2516,6 +2517,14 @@ The current section's name on one quiet line centred under the rail (`render.chr | `deck.sectionTitle.fade` | 0–2 s: the old title out over its first half, the new in over the second (0: a cut) · default 0.4 | `umtool look <p> deck.sectionTitle.fade=0.6` | | `deck.sectionTitle.color` | `auto` (the subtitle's muted grey, lifted toward the deck's fg only as far as it needs to read at 4.5:1 at that opacity) · `section` (its section's colour, fitted to 4.5:1) · a `#hex` · a palette key (`fg`, `muted`, `accent`, `amber`, `dim`) · default `auto` | `umtool look <p> deck.sectionTitle.color=section` | +### Analysis item + +A timeline entry `{ type: "analysis", … }` (analysis-plan.mjs; [report-video.md](report-video.md#the-analysis-item)): a full-frame ending drawn from the LEDGER -- a chart of a named run of his weights (`series`: rows, or a span; a delta resolved against the run's start), a shaded `band`, `marks`, a `pace` table whose pounds and days are computed, `status` rows and ONE `reading` -- the line drawing in, the rows landing; with `audio` a clip's sound under it (its citation and QR on the page, its picture not), else silent for `seconds` (7, at most 8). Every figure traces to a ledger row; a bound ("< 300") is drawn hollow and a pace row ending on one says over/under. + +| Knob | Range · default | From a terminal | +|---|---|---| +| an `analysis` entry | `title`, `kicker`, `series`, `band`, `marks`, `pace`, `status`, `reading`, `footnote`, `mark`, `audio?`, `seconds?` | `umtool timeline <p> [--take <t>] add-analysis @<file>` · `set-analysis <id> @<file>` (or the JSON itself) | + ### Teaser A timeline entry `{ type: "teaser", lines, … }`: a full-frame card whose lines pop in on the beat, cut in as its own segment (deck.mjs `validateTeaser`; [report-video.md](report-video.md)). diff --git a/umtool/report-to-video/analysis-build.test.mjs b/umtool/report-to-video/analysis-build.test.mjs @@ -0,0 +1,69 @@ +// The analysis item in the build: its sound (the clip's span under it, or the teaser's silence), its encode, its +// length in the schedule, the deck away over it, its chapter -- and its errors among the build's validators. +import { test } from "node:test"; +import assert from "node:assert/strict"; + +import { analysisAudioGraph, analysisEncodeArgs, chapterTitle, teaserAudioGraph } from "./build-video.mjs"; +import { estimatedDuration, estimateSchedule, hidesDeck, resolveDeck } from "./deck.mjs"; +import { validatorErrors, lintManifest, qrsOf } from "./lint.mjs"; + +const render = { width: 1920, height: 1080, fps: 30, audioRate: 48000, audioChannels: 2, crf: 20, preset: "fast", audioBitrate: "192k" }; + +test("the sound: the clip's span laid on its clock, levelled, faded, padded to the item; silent: the teaser's silence", () => { + const g = analysisAudioGraph({ seconds: 14.5, render, audio: { clip: "c46" }, gain: -2.5 }); + assert.equal(g, "[1:a]aresample=async=1:min_hard_comp=0.01:first_pts=0,volume=-2.5dB,alimiter=limit=0.891:level=0:latency=1," + + "afade=t=in:d=0.3,afade=t=out:st=14.2:d=0.3,apad=whole_dur=14.5,aformat=sample_rates=48000:channel_layouts=stereo[ta]"); + assert.doesNotMatch(analysisAudioGraph({ seconds: 14.5, render, audio: { clip: "c46" } }), /volume=/); + assert.equal(analysisAudioGraph({ seconds: 7, render }), teaserAudioGraph([], { seconds: 7, render })); +}); + +test("the encode: the frames, then the clip's span as input 1, then the graph", () => { + const args = analysisEncodeArgs({ framesDir: "/f", seconds: 14.5, render, audio: "[1:a]anull[ta]", sound: { path: "/raw/c.mp4", from: 1.2, seconds: 14.5 }, outPath: "/o.mp4" }); + const i = args.indexOf("-i"); + const j = args.indexOf("-i", i + 1); + assert.equal(args[i + 1], "/f/frame_%06d.png"); + assert.deepEqual(args.slice(j - 4, j + 2), ["-ss", "1.200", "-t", "14.500", "-i", "/raw/c.mp4"]); + assert.ok(args.indexOf("-filter_complex") > j); + const silent = analysisEncodeArgs({ framesDir: "/f", seconds: 7, render, audio: "x[ta]", outPath: "/o.mp4" }); + assert.equal(silent.filter((a) => a === "-i").length, 1); +}); + +const SCHEMA = { kind: "measure", tracks: [{ key: "weight", role: "value" }] }; +const manifest = (extra = {}) => ({ + render: { ...render, chrome: { deck: {} } }, + ledgerSchema: SCHEMA, + ledger: [ + { id: "w1", scope: "weight", population: "current", date: "2026-09-01", value: 310 }, + { id: "w2", scope: "weight", population: "current", date: "2026-10-01", value: 300 }, + ], + timeline: [ + { type: "clip", id: "c1", video: "v1", start: 10, end: 40 }, + { type: "analysis", id: "an", title: "The run", series: { rows: ["w1", "w2"] }, reading: "It went down.", ...extra }, + ], + provenance: { siteOrigin: "https://example.pages.dev", channelSlug: "chan" }, +}); + +test("in the schedule: its length, full frame (the deck away), named by its title", async () => { + const m = manifest(); + const e = m.timeline[1]; + assert.equal(estimatedDuration(e, m.render), 7); + assert.equal(estimatedDuration({ ...e, audio: { clip: "c1", start: 12, end: 26.5 } }, m.render), 14.5); + assert.equal(hidesDeck(e, resolveDeck(m.render)), true); + const seg = estimateSchedule(m).segments.find((s) => s.id === "an"); + assert.equal(seg.title, "The run"); + assert.equal(seg.qrUrl, null); + assert.equal(await chapterTitle(e, 1, {}), "The run"); +}); + +test("the build's validators and the lint: its errors, its warnings, its code measured", () => { + assert.deepEqual(validatorErrors(manifest()).filter((x) => /analysis/.test(x)), []); + const bad = manifest({ series: { rows: ["w1", "w9"] }, seconds: 9 }); + const errs = validatorErrors(bad); + assert.ok(errs.some((x) => /series row w9 is not in the ledger/.test(x)), errs.join("\n")); + assert.ok(errs.some((x) => /held 9 s with no audio/.test(x))); + const heard = manifest({ audio: { clip: "c1", start: 12, end: 26.5 } }); + const { warnings } = lintManifest(heard, { whole: heard, exists: () => true }); + assert.ok(warnings.some((w) => /its words are heard twice/.test(w)), warnings.join("\n")); + const q = qrsOf(heard).find((x) => x.id === "an"); + assert.ok(q && /example\.pages\.dev/.test(q.url) && q.px === 225, JSON.stringify(q)); +}); diff --git a/umtool/report-to-video/analysis-plan.mjs b/umtool/report-to-video/analysis-plan.mjs @@ -83,6 +83,21 @@ export function analysisSeconds(entry) { /** The ledger a cut's analysis reads: the variant's whole measure record (selectVariant keeps it), else the ledger. */ export const analysisLedger = (manifest) => (Array.isArray(manifest?.measureLedger) ? manifest.measureLedger : manifest?.ledger ?? []); +/** The context an item's plan reads, from the cut's manifest. */ +export const analysisContext = (manifest) => ({ + ledger: analysisLedger(manifest), schema: manifest?.ledgerSchema ?? null, timeline: manifest?.timeline ?? [], render: manifest?.render ?? {}, +}); + +/** Every analysis entry's errors, as the build refuses them. */ +export function validateAnalysisEntries(manifest) { + return (manifest?.timeline ?? []).filter((e) => e?.type === "analysis").flatMap((e) => analysisProblems(e, analysisContext(manifest)).errors); +} + +/** Every analysis entry's warnings, as the lint says them. */ +export function analysisWarnings(manifest, { only = null } = {}) { + return (manifest?.timeline ?? []).filter((e) => e?.type === "analysis" && (!only || e.id === only)).flatMap((e) => analysisProblems(e, analysisContext(manifest)).warnings); +} + /** * The bound a pace row's figure is, from its two ends' qualifiers: the true change against the computed one. Ending * on "< v" (the weight was under v) the change is LESS than computed (more lost); starting on it, MORE (less lost); diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -152,6 +152,7 @@ import { } from "./sources.mjs"; // A clip whose media is a file beside the manifest (`src`, `cues`). import { clipLabel, createLocalMedia, hasLocalMedia, resolveManifestPath, validateLocalMedia } from "./local-media.mjs"; +import { analysisSeconds, validateAnalysisEntries } from "./analysis-plan.mjs"; import { blackoutEnable, validateVideoEntries, videoBlackouts, videoFit, videoLoudnessTarget, videoLead, videoMeasureFilter, videoSeconds, videoSegmentGraph, videoSegmentKey, videoSpan } from "./video-entry.mjs"; import { createPostChannelResolver, resolvePostLinks } from "./post-links.mjs"; import { ensureWriteDir } from "../lib/report/storage.mjs"; @@ -1205,7 +1206,7 @@ export function needsFetchMessage(missing) { // The timeline's vocabulary is OPEN; the build loop treats everything it has // no other branch for as a clip, and so does this. -const NON_CLIP_TYPES = new Set(["card", "teaser", "image", "scroll", "chart", "ledger", "intro", "post", "video"]); +const NON_CLIP_TYPES = new Set(["card", "teaser", "image", "scroll", "chart", "ledger", "intro", "post", "video", "analysis"]); const isClipEntry = (e) => !NON_CLIP_TYPES.has(e?.type); /** @@ -2993,6 +2994,101 @@ export async function buildTeaserSegment(entry, { manifestPath, render, outDir, return seg; } +// ---- the analysis item ------------------------------------------------------ +// An `analysis` entry (analysis-plan.mjs) is a full-frame page drawn from the +// ledger (chrome-analysis.mjs), composed and rendered once (cached by its page +// key, as a teaser is) and encoded here with its sound: with `audio`, the +// named clip's sound over [start, end] -- read from that clip's own source as +// its segment reads it (fetchClipAligned: the raw cache, on its clock, its +// sync offset applied), levelled to the cut's loudness target as a clip is, +// faded in and out -- its picture never shown; without, digital silence. Its +// record (`<id>.analysis.json`) keys the frames, the sound and the encode, so +// an unchanged item is not encoded again. + +/** The analysis sound's fades at its edges, in seconds. */ +export const ANALYSIS_AUDIO_FADE = 0.3; + +/** + * The analysis item's sound as one filtergraph fragment to `[ta]`: input 1 (the clip's span, `-ss`/`-t`) laid on its + * clock, its level gain (`gain`, dB, or null), faded in and out and padded to `seconds`; null `audio`: the teaser's + * silence (teaserAudioGraph with no hits). + */ +export function analysisAudioGraph({ seconds, render, audio = null, gain = null, fade = ANALYSIS_AUDIO_FADE }) { + if (!audio) return teaserAudioGraph([], { seconds, render }); + const layout = render.audioChannels === 1 ? "mono" : "stereo"; + const f = Math.min(fade, seconds / 4); + return `[1:a]${[ + AUDIO_ON_CLOCK, gain != null ? levelFilters(gain) : "", + `afade=t=in:d=${f}`, `afade=t=out:st=${Number((seconds - f).toFixed(3))}:d=${f}`, + `apad=whole_dur=${seconds}`, `aformat=sample_rates=${render.audioRate}:channel_layouts=${layout}`, + ].filter(Boolean).join(",")}[ta]`; +} + +/** The analysis segment's encode: its frames, the clip's span (`sound`: `{ path, from, seconds }`, raw-file seconds) or none. */ +export function analysisEncodeArgs({ framesDir, seconds, render, audio, sound = null, outPath }) { + const args = teaserEncodeArgs({ framesDir, seconds, render, audio, outPath }); + if (!sound) return args; + const at = args.indexOf("-filter_complex"); + return [...args.slice(0, at), "-ss", Math.max(0, sound.from).toFixed(3), "-t", sound.seconds.toFixed(3), "-i", sound.path, ...args.slice(at)]; +} + +/** + * Compose and render the analysis item (cached by compose-chrome's key), then encode its segment with its sound + * unless the one on disk was made from the same frames, sound and encode. `clipSource` gets the audio clip's source + * (`{ path, fetchStart }`), `meta` its record's metadata (the citation line); both null without audio. + */ +export async function buildAnalysisSegment(entry, { manifestPath, manifest, render, outDir, variant, clipSource = null, meta = null }) { + const { composeChrome } = await import("./compose-chrome.mjs"); + const t0 = Date.now(); + const r = await composeChrome({ + manifestPath, outDir, variant, region: "analysis", segment: entry.id, doRender: true, + fps: render.fps, workers: CHROME_WORKERS, quality: "high", format: "png-sequence", context: { meta }, + lease: createCapturePool({ budget: CHROME_WORKERS }).lease, + }); + EMIT("chrome", { + phase: r.cached ? "cached" : "render", region: "analysis", segment: entry.id, + frames: r.frameCount, key: r.key, dir: r.frames, seconds: Number(((Date.now() - t0) / 1000).toFixed(1)), + }); + const seconds = analysisSeconds(entry); + let sound = null; + let gain = null; + let soundKey = null; + if (entry.audio) { + const clip = (manifest.timeline ?? []).find((e) => e?.id === entry.audio.clip && e.type === "clip"); + if (!clip || !clipSource) throw new Error(`${entry.id}: its audio clip ${entry.audio.clip} is not a clip of the cut`); + const src = await clipSource(clip); + // The clip's sync offset (clip-audio.mjs): its sound read from that much earlier or later, as its segment reads it. + const off = (clipAudioOf(clip)?.offset ?? 0) / 1000; + const from = Number(entry.audio.start) - src.fetchStart - off; + sound = { path: src.path, from, seconds }; + if (loudnessTargetOf(render) != null) gain = (await montageLevel(src.path, Math.max(0, from), from + seconds, { target: loudnessTargetOf(render) })).gain; + const st = await stat(src.path); + soundKey = { file: path.basename(src.path), size: st.size, from: Number(from.toFixed(3)), gain }; + if (from < 0) EMIT("note", { id: entry.id, message: `${entry.id}: its audio starts ${(-from).toFixed(2)}s before ${path.basename(src.path)} — silence there` }); + } + const audio = analysisAudioGraph({ seconds, render, audio: sound ? entry.audio : null, gain }); + const key = createHash("sha256") + .update(JSON.stringify({ v: 1, frames: r.key, audio, sound: soundKey, encode: encodeArgs(render) })) + .digest("hex"); + const seg = path.join(outDir, "segments", `${entry.id}.mp4`); + const recPath = seg.replace(/\.mp4$/, ".analysis.json"); + const rec = await readFile(recPath, "utf8").then(JSON.parse, () => null); + if (rec?.key === key && (await exists(seg))) { + EMIT("note", { id: entry.id, message: `${entry.id}: analysis segment unchanged (key ${key.slice(0, 12)})` }); + return seg; + } + // Encoded beside it and renamed over it (a take's segment may be a hard link to another take's), as a teaser's is. + const tmp = tmpPathFor(path.join(path.dirname(seg), `.${entry.id}`), { ext: ".mp4" }); + try { + await execFileP(FFMPEG, analysisEncodeArgs({ framesDir: r.frames, seconds, render, audio, sound, outPath: tmp }), { maxBuffer: 1 << 26 }); + await rename(tmp, seg); + } finally { + await rm(tmp, { force: true }); + } + await replaceFile(recPath, JSON.stringify({ key, frames: r.key, sound: soundKey }) + "\n"); + return seg; +} + // ---- stills -------------------------------------------------------------- // An `image` entry is a screenshot in the cut: the receipts a clip cannot say // out loud -- a post, a thread, a DM -- shown for `seconds` and then gone. @@ -6076,6 +6172,7 @@ export async function chapterTitle(entry, index, provenance, { deck = false } = if (deck && entry.onscreen?.title) return entry.onscreen.title; // A teaser is named by its own words, with or without the deck. if (entry.type === "teaser") return teaserTitle(entry) || `Teaser ${index + 1}`; + if (entry.type === "analysis") return String(entry.title ?? "").trim() || `Analysis ${index + 1}`; // A still's chapter is the SAME line it burns into the header, for the reason // a clip's is: the chapter list and the picture are two views of one cut, and // a viewer jumping by chapter should land on the words they were shown. @@ -6697,7 +6794,7 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly ...validateFlipEntries(whole), ...validateNarration(whole), ...validateDrafted(whole), ...validatePublish(whole), ...validateStatsEntries(whole), ...validateMontage(whole), ...validateAssist(whole), ...validateFxEntries(whole, { schedule: false }), ...validateTransitionStyle(whole), ...validateLook(whole), ...validateClipAudioEntries(whole), ...validateClipBlurEntries(whole), ...validateFinaleEntries(whole), - ...validateGapEntries(whole), ...measureSettingsProblems(whole), + ...validateGapEntries(whole), ...measureSettingsProblems(whole), ...validateAnalysisEntries(whole), ]; if (errors.length) throw new Error(`manifest: ${errors.join("; ")}`); } @@ -7087,6 +7184,17 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly EMIT("card", { id: entry.id, i, n: entries.length }); return buildVideoEntrySegment(entry, render, outDir, manifestDir, D, manifest.timeline); } + // An analysis item (analysis-plan.mjs): its page's frames and, with `audio`, its clip's sound -- read from that + // clip's source as the clip's own segment reads it. Written through a rename, as a teaser's is. + if (entry.type === "analysis") { + EMIT("card", { id: entry.id, i, n: entries.length }); + const clip = entry.audio ? (manifest.timeline ?? []).find((e) => e?.id === entry.audio.clip && e.type === "clip") ?? null : null; + const meta = clip ? await clipMeta(clip, provenance) : null; + return buildAnalysisSegment(entry, { + manifestPath, manifest, render, outDir, variant, meta, + clipSource: clip ? (c) => fetchClipAligned(c, meta, render, dirs.local, o) : null, + }); + } if (entry.type !== "teaser" && entry.type !== "clip" && entry.type !== "post") { await detachSegmentFiles(path.join(outDir, "segments"), entry.id); } @@ -7326,7 +7434,7 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly // segments in, and writing one would write the other take's file). const missing = []; for (const [i, seg] of segs.entries()) { - if (entries[i].type === "teaser" || isIntro(entries[i]) || (await exists(seg))) continue; + if (entries[i].type === "teaser" || entries[i].type === "analysis" || isIntro(entries[i]) || (await exists(seg))) continue; if (opts.chromePreview) throw new Error(`${what} needs ${seg}, which is missing — run a full build first`); missing.push(i); } @@ -7368,6 +7476,8 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly } // So is the brand intro's (copied from its cache unless its key is the one recorded). for (const [i, e] of entries.entries()) if (isIntro(e)) await buildEntrySegment(e, i); + // And an analysis item's (drawn from the ledger; its audio clip's sound from the cache, never fetched). + for (const [i, e] of entries.entries()) if (e.type === "analysis") await buildEntrySegment(e, i, { ...opts, skipFetch: true }); await linkPosts(); const schedule = await writeChromeSchedule({ manifest, entries, segments: segs, D, outDir }); EMIT("chrome", { phase: "schedule", total: schedule.total, segments: schedule.segments.length }); diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs @@ -24,6 +24,7 @@ import { INTRO_SECONDS } from "yt-dlp-transcript-common/lib/report/intro.mjs"; import { attributionParts, deckSubtitle, deckSubtitleLines, deckSubtitleLinesParts, deckSubtitleParts, formatDeckDate, hms } from "./attribution.mjs"; import { panelEntry, postDeckText, postItemSeconds, postLayout } from "./post-item.mjs"; +import { analysisSeconds } from "./analysis-plan.mjs"; import { videoDip, videoEnter, videoHidesChrome, videoSeconds } from "./video-entry.mjs"; import { claimOf, marksOf, originalUrlAt, resolveFactcheck, roundStamps, stampSchedule, stampsWithFinale, rawMarksOf, tallyCells, tallyOf, validateFactcheck, @@ -1215,6 +1216,8 @@ export function estimatedDuration(entry, render = {}, D = transitionOf(render)) if (entry.type === "intro") return Number(entry.seconds ?? INTRO_SECONDS); // A teaser's dip makes its segment longer by the dissolve and the black (`teaserLead`). if (entry.type === "teaser") return teaserSeconds(entry, D, render.fps ?? 30); + // An analysis item (analysis-plan.mjs): its audio's span, else its silent seconds. + if (entry.type === "analysis") return analysisSeconds(entry); // A narrated card's `"auto"` is its words' length, estimated until a build measures it. if (hasNarration(entry)) return estimatedNarratedCardSeconds(entry, render); return Number(entry.seconds ?? 5); @@ -1266,6 +1269,8 @@ export function hidesDeck(entry, deck) { // A teaser that counts keeps the deck up over it (teaserCounts). if (entry.type === "teaser") return !teaserCounts(entry); if (entry.type === "intro") return true; + // An analysis item is the whole frame (analysis-plan.mjs): its page is its own ground. + if (entry.type === "analysis") return true; // A video entry is the whole frame, nothing over it -- unless it says `deck: "shown"`. if (entry.type === "video") return videoHidesChrome(entry); return deck.overCards === "hide" && CARD_TYPES.includes(entry.type); @@ -1325,6 +1330,10 @@ export function deckText(entry, meta, provenance, deck, multiChannel) { // so the deck says only what its `onscreen` says. if (!title && !teaserCounts(entry)) title = teaserTitle(entry); subtitle = ""; + } else if (entry.type === "analysis") { + // An analysis item: its title names it (the deck is not up over it). + if (!title) title = String(entry.title ?? "").trim(); + subtitle = ""; } else if (entry.type === "post") { // A post item: its day as the deck's date, its author and platform under it. const t = postDeckText(entry, (d) => formatDeckDate(d, deck.subtitle?.dateFormat ?? "long")); diff --git a/umtool/report-to-video/lint.mjs b/umtool/report-to-video/lint.mjs @@ -36,6 +36,10 @@ // - a `drafted` mark that is malformed or where no field may be drafted, and // a `publish` block that is not `{ youtube: { title, description } }` // (drafted.mjs `validateDrafted`, `validatePublish`); +// - an analysis item's refusals (analysis-plan.mjs), each naming its row: a +// row not in the ledger, a band outside the series, a pace end missing, an +// empty reading, an audio clip unknown or a span outside its window, held +// over 8 s without audio, a vertical cut; // - a narrated card whose `seconds` is a number shorter than its narration // needs (the lead, the words, the tail). The words' length is known once // the voice is synthesized: the build checks it then, and `--lint` reads @@ -51,6 +55,8 @@ // first tier, or any line's break: house style, not a fit. (A title's // first tier is held to the same 34 by the frame itself, TEASER_LIMITS.fit, // and validateTeasers refuses it.) +// - an analysis item's pace row ending on a bound (drawn over/under), a +// number typed into its words, its audio span heard twice in the cut; // - a QR under WARN_QR_PX_PER_MODULE_720P pixels per module at 720p: it // scans on a good screen with a steady hand, not reliably. // - a promise outcome's `stampNote` (a ledger row's words under its stamp on the promise clock) longer than @@ -110,6 +116,8 @@ import { validateTransitionStyle } from "./transition.mjs"; import { validateLook } from "./look.mjs"; // The stacked vertical deck (vertical-deck.mjs): what it leaves out, and a twocrop band drawn past its source's pixels. import { stackedLeftOut } from "./modules/index.mjs"; +import { analysisSource, analysisWarnings, validateAnalysisEntries } from "./modules/analysis.mjs"; +import { ANALYSIS_BOX } from "./chrome-analysis.mjs"; import { verticalOn, verticalRender } from "./vertical.mjs"; import { ENLARGE_WARN, STACKED_QR_SHARE, STACKED_QR_SMALL_SHARE, clipTwoCrop, stackedOn, twoCropEnlargement } from "./vertical-deck.mjs"; import { roomWindowWarnings } from "./room.mjs"; @@ -186,6 +194,11 @@ export function qrsOf(manifest, { only = null, metaOf = null } = {}) { // A basic-mode cut is the footage alone (basic.mjs): it draws no code, so none is measured -- nor counted as built // from the origin (originQrsOf, the Inbox's Blocking siteOrigin card: a quick clip on no public site raises none). if (basicOn(render)) return out; + // An analysis item's code (chrome-analysis.mjs): its audio clip's, drawn on its own page whatever the chrome. + for (const e of timeline) { + const src = e.type === "analysis" ? analysisSource(e, manifest) : null; + if (src?.url) out.push({ where: `timeline ${e.id} (the analysis item's QR)`, id: e.id, source: "entry", url: src.url, px: Math.round((ANALYSIS_BOX.qr * (Number(render.width) || 1920)) / 1280) }); + } if (deckOn(render)) { const d = resolveDeck(render); if (d.qr?.show) { @@ -337,6 +350,8 @@ export function validatorErrors(whole) { ...validateTransitionStyle(whole), // Release 36: render.captions, render.loudness and a clip's vertical crop. ...validateLook(whole), + // An analysis item (analysis-plan.mjs): its rows in the ledger, its band, pace, audio and length. + ...validateAnalysisEntries(whole), // The deck finale: each entry's `layout` and the one run (finale.mjs). ...validateFinaleEntries(whole), // A clip's blurred picture and the cut's render.blur (clip-blur.mjs). @@ -462,6 +477,8 @@ export function lintManifest(manifest, { warnings.push(...stackedLintWarnings(manifest, { only })); // A promise outcome's own stamp words (a ledger row's `stampNote`) longer than the stamp's line holds. if (!only) warnings.push(...stampNoteWarnings(whole)); + // An analysis item: a bound pace row, a number typed into words, its audio heard twice (analysis-plan.mjs). + warnings.push(...analysisWarnings(manifest, { only })); for (const { where, src } of imageSrcsOf(manifest, { only })) { if (path.isAbsolute(src) || src.startsWith("~")) { diff --git a/umtool/report-to-video/modules/analysis.mjs b/umtool/report-to-video/modules/analysis.mjs @@ -4,26 +4,13 @@ // (`{ type: "analysis" }`, analysis-plan.mjs). chrome-analysis.mjs writes the // page; the build encodes its frames into segments/<id>.mp4 with the sound of // the clip it names under it, or silence (build-video's buildAnalysisSegment). -import { analysisLedger, analysisProblems, analysisSeconds } from "../analysis-plan.mjs"; +import { analysisContext, analysisProblems, analysisSeconds, validateAnalysisEntries } from "../analysis-plan.mjs"; import { attributionParts } from "../attribution.mjs"; import { deckQrUrl, resolveDeck } from "../deck.mjs"; import { defineModule } from "./contract.mjs"; import { instrumentFonts } from "./instruments-shared.mjs"; -/** The context an item's plan reads, from the cut's manifest. */ -export const analysisContext = (manifest) => ({ - ledger: analysisLedger(manifest), schema: manifest?.ledgerSchema ?? null, timeline: manifest?.timeline ?? [], render: manifest?.render ?? {}, -}); - -/** Every analysis entry's errors, as the build refuses them. */ -export function validateAnalysisEntries(manifest) { - return (manifest?.timeline ?? []).filter((e) => e?.type === "analysis").flatMap((e) => analysisProblems(e, analysisContext(manifest)).errors); -} - -/** Every analysis entry's warnings, as the lint says them. */ -export function analysisWarnings(manifest, { only = null } = {}) { - return (manifest?.timeline ?? []).filter((e) => e?.type === "analysis" && (!only || e.id === only)).flatMap((e) => analysisProblems(e, analysisContext(manifest)).warnings); -} +export { analysisContext, analysisWarnings, validateAnalysisEntries } from "../analysis-plan.mjs"; /** * The audio clip's citation parts and QR link: the clip at the audio's start -- with the source's metadata when the @@ -55,7 +42,7 @@ export default defineModule({ heading: "Analysis item", intro: "A timeline entry `{ type: \"analysis\", … }` (analysis-plan.mjs; [report-video.md](report-video.md#the-analysis-item)): a full-frame ending drawn from the LEDGER -- a chart of a named run of his weights (`series`: rows, or a span; a delta resolved against the run's start), a shaded `band`, `marks`, a `pace` table whose pounds and days are computed, `status` rows and ONE `reading` -- the line drawing in, the rows landing; with `audio` a clip's sound under it (its citation and QR on the page, its picture not), else silent for `seconds` (7, at most 8). Every figure traces to a ledger row; a bound (\"< 300\") is drawn hollow and a pace row ending on one says over/under.", rows: [ - ["an `analysis` entry", "`title`, `kicker`, `series`, `band`, `marks`, `pace`, `status`, `reading`, `footnote`, `mark`, `audio?`, `seconds?`", "`umtool timeline <p> [--take <t>] add-analysis <json|@file>` · `set-analysis <id> <json|@file>`"], + ["an `analysis` entry", "`title`, `kicker`, `series`, `band`, `marks`, `pace`, `status`, `reading`, `footnote`, `mark`, `audio?`, `seconds?`", "`umtool timeline <p> [--take <t>] add-analysis @<file>` · `set-analysis <id> @<file>` (or the JSON itself)"], ], }, region: "analysis",