Archilyzer · Source

archilyzer

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

commit dec12d8b5aeb6934094476e09a3c12be01da0d98
parent 555dab16274a4ef597689065324aea33d89eaebf
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon,  2 Nov 2026 18:45:28 -0500

umtool: post items -- a take's window times them by the duration rule; context reads 1-4 s; a lone card as tall as its words

takeMaker estimatedSeconds: a post item is its rule's seconds (postItemSeconds), not a
card's 4 s -- a 50 s window over a posts reel rendered thirteen items, not five.

post-item.mjs: a parent's or a quoted post's reading is 1-4 s (it is context, not the
post: a two-parent reply read for 27 s). A card alone (text, a stack's reading) is as tall
as its words, centred in its box; a parent that is the subject's own wears the accent.

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

Diffstat:
Mumtool/lib/report/postReel.test.mjs | 9+++++++++
Mumtool/lib/report/takeMaker.mjs | 4+++-
Mumtool/report-to-video/post-item.mjs | 10++++++----
Mumtool/report-to-video/post-item.test.mjs | 4++--
4 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/umtool/lib/report/postReel.test.mjs b/umtool/lib/report/postReel.test.mjs @@ -139,3 +139,12 @@ test("a mixed cut's structural writes take a post item like a clip: move, remove assert.equal(j.dryRun, true); assert.deepEqual(j.entries.map((x) => x.id), ["p-100", "p-101", "p-104"]); }); + +test("a take's window times a post item by the duration rule, not a card's 4 s", async () => { + const { windowEntries } = await import("./takeMaker.mjs"); + const post = (id, words) => ({ type: "post", id, post: `subj-x/${id}`, platform: "x", date: "2026-10-30T00:00:00Z", text: Array.from({ length: words }, () => "w").join(" ") }); + // 42 words: 1 + 14 = 15 s each; a 20 s window from 0 touches the first two. + const tl = [post("a", 42), post("b", 42), post("c", 42), { type: "clip", id: "c01", video: "v", start: 0, end: 3 }]; + assert.deepEqual(windowEntries(tl, { at: 0, dur: 20 }).ids, ["a", "b"]); + assert.deepEqual(windowEntries(tl, { at: 44, dur: 2 }).ids, ["c", "c01"]); +}); diff --git a/umtool/lib/report/takeMaker.mjs b/umtool/lib/report/takeMaker.mjs @@ -48,6 +48,7 @@ import { link, lstat, mkdir, readFile, rename, rm, stat, symlink, unlink, writeF import path from "node:path"; import { pathToFileURL } from "node:url"; import { mergePatch } from "umtool-report-to-video/montage-styles"; +import { postItemSeconds } from "umtool-report-to-video/post-item"; import { applyMontageRulings, readMontageRulings, rulingsLines } from "umtool-report-to-video/montage-rulings"; import { markKeepFrames } from "umtool-report-to-video/prune-frames"; import { PIPELINE_DIR, RENDER_BUDGET, UMTOOL_DIR } from "./driver.mjs"; @@ -240,8 +241,9 @@ export async function loadMontageStyles({ file = montageStylesFile() } = {}) { // The window. // --------------------------------------------------------------------------- -/** An entry's length by the manifest's own numbers: a clip's cut, else `seconds`, else 4 s. */ +/** An entry's length by the manifest's own numbers: a clip's cut, a post item's rule (post-item.mjs), else `seconds`, else 4 s. */ export function estimatedSeconds(e) { + if (e?.type === "post") return postItemSeconds(e); if (e?.type === "clip") { const a = Number(e.cutStart ?? e.start); const b = Number(e.cutEnd ?? e.end); diff --git a/umtool/report-to-video/post-item.mjs b/umtool/report-to-video/post-item.mjs @@ -33,7 +33,7 @@ export const POST_MEDIA_LAYOUTS = Object.freeze(["sequence", "grid"]); * * reading = clamp(READ.lead + words / READ.wps, READ.min, READ.max) * + for each post it answers and the post it quotes: - * clamp(words / READ.wps, CONTEXT_READ.min, CONTEXT_READ.max) + * clamp(words / READ.wps, CONTEXT_READ.min, CONTEXT_READ.max) -- 1-4 s: context, not the post * media = a video: its trimmed length (end - start), its sound on; * a GIF: looped to at least GIF.min s (one pass when longer, at most GIF.max); * an image: IMAGE_SECONDS; a grid of 2-4 images: GRID.base + GRID.per × (n - 1) @@ -47,7 +47,7 @@ export const POST_MEDIA_LAYOUTS = Object.freeze(["sequence", "grid"]); * that long is shown at the size that fits, and `hold` gives it more. */ export const POST_READ = Object.freeze({ wps: 3, lead: 1, min: 3, max: 15 }); -export const POST_CONTEXT_READ = Object.freeze({ min: 1.5, max: 6 }); +export const POST_CONTEXT_READ = Object.freeze({ min: 1, max: 4 }); export const POST_IMAGE_SECONDS = 3.5; export const POST_GIF = Object.freeze({ min: 3, max: 10 }); export const POST_GRID = Object.freeze({ base: 3.5, per: 1 }); @@ -625,8 +625,9 @@ export function postCardHtml(entry, { width, height, palette = {}, fonts = {}, p for (let i = parents.length - 1; i >= 0; i -= 1) { const p = parents[i]; const r = red(`parents[${i}]`); + const subject = !r && subjectsOf(entry).some((h) => String(h).toLowerCase() === String(p.handle ?? "").replace(/^@/, "").toLowerCase()); ctx.push( - `<div class="parent" data-post-parent="${i}"${r ? ' data-redacted=""' : ""}>${avatarHtml(p, { redact: r, size: Math.round(44 * k) })}<div class="pbody"><div class="phead">${nameHtml(p, { redact: r })}<span class="pdate">${esc(cardDate(p.date).split(" · ")[0])}</span></div><div class="ptext">${wordsHtml(str(p.text) || (p.url ? "(not archived)" : ""), blurred)}</div></div></div>`, + `<div class="parent" data-post-parent="${i}"${r ? ' data-redacted=""' : ""}>${avatarHtml(p, { redact: r, size: Math.round(44 * k), accent: subject ? pal.accent : undefined })}<div class="pbody"><div class="phead">${nameHtml(p, { redact: r })}<span class="pdate">${esc(cardDate(p.date).split(" · ")[0])}</span></div><div class="ptext">${wordsHtml(str(p.text) || (p.url ? "(not archived)" : ""), blurred)}</div></div></div>`, ); } if (!parents.length && parentShotUrl) ctx.push(`<div class="pshot" data-post-parent-shot=""><img src="${esc(parentShotUrl)}" alt=""></div>`); @@ -641,7 +642,8 @@ export function postCardHtml(entry, { width, height, palette = {}, fonts = {}, p ? `<div class="repost" data-post-repost="">&#x21bb; ${esc(str(entry.repostedBy.author) || `@${entry.repostedBy.handle}`)} reposted</div>` : ""; const head = `<div class="head"${ownRed ? ' data-redacted=""' : ""}>${avatarHtml(own, { redact: ownRed, size: Math.round(64 * k), accent: ownRed ? undefined : pal.accent })}<div class="hwho">${nameHtml(own, { redact: ownRed, cls: "big" })}<div class="date">${esc(cardDate(entry.date))}</div></div><div class="mark">${esc(PLATFORM_NAME[entry.platform] ?? "")}</div></div>`; - const card = (box) => `<div class="card" data-post-card="${esc(entry.id)}" style="left:${box.x}px;top:${box.y}px;width:${box.width}px;height:${box.height}px">${repost}${ctx.length ? `<div class="context">${ctx.join("")}</div>` : ""}${head}<div class="words" data-post-words="" style="font-size:${size}px">${wordsHtml(cardText(entry), blurred)}</div>${quoted}${counts ? `<div class="counts" data-post-counts="">${counts}</div>` : ""}</div>`; + // A card alone (text, or a stack's reading) is as tall as its words, centred in its box; beside the attachments, the box's height. + const card = (box) => `<div class="card" data-post-card="${esc(entry.id)}" style="left:${box.x}px;${L.mode === "side" ? `top:${box.y}px;height:${box.height}px` : `top:${box.y + box.height / 2}px;transform:translateY(-50%);max-height:${box.height}px`};width:${box.width}px">${repost}${ctx.length ? `<div class="context">${ctx.join("")}</div>` : ""}${head}<div class="words" data-post-words="" style="font-size:${size}px">${wordsHtml(cardText(entry), blurred)}</div>${quoted}${counts ? `<div class="counts" data-post-counts="">${counts}</div>` : ""}</div>`; const stripHtml = L.strip ? `<div class="strip" data-post-strip="" style="left:${L.strip.x}px;top:${L.strip.y}px;width:${L.strip.width}px;height:${L.strip.height}px">${avatarHtml(own, { redact: ownRed, size: Math.round(56 * k), accent: ownRed ? undefined : pal.accent })}<div class="hwho">${nameHtml(own, { redact: ownRed, cls: "big" })}<div class="date">${esc(cardDate(entry.date))}</div></div><div class="sline">${wordsHtml(cardText(entry).split("\n")[0].slice(0, 140) + (cardText(entry).length > 140 ? "…" : ""), blurred)}</div></div>` : ""; diff --git a/umtool/report-to-video/post-item.test.mjs b/umtool/report-to-video/post-item.test.mjs @@ -42,8 +42,8 @@ test("the duration rule: reading time (words / wps + lead, clamped) plus the att assert.equal(readingSeconds(base({ text: Array.from({ length: 900 }, () => "w").join(" ") })), POST_READ.max); // A repost's "RT @x: " is its reposted line, not words to read. assert.equal(cardText(base({ text: "RT @ObviousRises: hello there", repostedBy: { handle: "ObviousRises" } })), "hello there"); - // A parent and a quote add their own reading, clamped 1.5–6. - assert.equal(readingSeconds(base({ parents: [{ text: "a" }], quoted: { text: Array.from({ length: 60 }, () => "q").join(" ") } })), 3 + 1.5 + 6); + // A parent and a quote add their own reading, clamped 1–4. + assert.equal(readingSeconds(base({ parents: [{ text: "a" }], quoted: { text: Array.from({ length: 60 }, () => "q").join(" ") } })), 3 + 1 + 4); // Attachments in sequence. assert.equal(mediaSeconds(video({ start: 1, end: 4 })), 3); assert.equal(mediaSeconds(image()), POST_IMAGE_SECONDS);