Archilyzer · Source

archilyzer

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

commit 89e108f7f0094ecefca837d14d23d0119fe40943
parent 47057dd76a29dc6ed0a2ca9df8b51bf3995787f6
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 20 Nov 2026 14:00:49 -0500

umtool: the deck's source line says when its source is gone

`deck.subtitle.status: "end"` (or `status` named in `deck.subtitle.parts`)
puts the source status after the line's last part: "now private", "now
members-only", "now deleted", with "(public when streamed)" or "(was public)"
when the stamp has the evidence. The words are one table
(report-to-video/source-status.mjs). The part never shrinks, takes a quiet
accent, rides the second of two lines and the finale's copy, and reaches the
live preview. A clip's `sourceStatus: false` hides it.

Read from the stamp alone, never the corpus or the network. Default off; with
the switch off, or on with no stamp, the schedule and the deck page are main's
byte for byte (pinned by hash); the build notes a missing or stale stamp.

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

Diffstat:
Mumtool/docs/knobs.md | 47+++++++++++++++++++++++++++++++++++++++++++++--
Mumtool/lib/report/onscreen.mjs | 4+++-
Mumtool/report-to-video/attribution.mjs | 15++++++++++++---
Mumtool/report-to-video/build-video.mjs | 8++++++++
Mumtool/report-to-video/chrome-deck.mjs | 22+++++++++++++++++++++-
Mumtool/report-to-video/chrome-finale.mjs | 5+++--
Aumtool/report-to-video/deck-source-status.test.mjs | 170+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/deck.mjs | 14+++++++++++---
Mumtool/report-to-video/modules/settings.mjs | 10++++++++--
Mumtool/report-to-video/modules/subtitle.mjs | 9++++++---
10 files changed, 287 insertions(+), 17 deletions(-)

diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -187,6 +187,48 @@ site.test** / **Link its YouTube page**, the citeUrl through the window writer clip whose record names no `webpage_url` is a row without a fix. A clip with its own media (`src`) is not judged. +## Source status on the source line + +A stream a streamer later privates, deletes or puts behind a membership cannot be opened by a viewer, and the clip's +source line says so: `Synth Channel · Mar 1, 2031 · 35:00 · now members-only (public when streamed)`. + +| the source now | what the records prove about its first state | the part reads | +|---|---|---| +| private · members-only · deleted | public, seen while the stream was live | `now private (public when streamed)` · `now members-only (…)` · `now deleted (…)` | +| the same | public, seen at another time | `now private (was public)` … | +| the same | nothing | `now private` · `now members-only` · `now deleted` | +| public · unlisted · age-gated or behind a login · an error · no record | — | nothing: the line is what it always was | + +The words are one table (`umtool/report-to-video/source-status.mjs` `SOURCE_STATUS_WORDS`). "Was public" is said only +on EVIDENCE (`common/lib/sourceStatus.mjs`): metadata.info.json's own `availability: "public"` (an earlier value of it +rebuilt from metadata.history.json), or an availability.json history entry of `public` written by a check or a +one-video fetch. "When streamed": that metadata was saved while `live_status` was `is_live`, or the check fell inside +the stream's span. NOT evidence: a backfill's `public` alone (it reads a missing field as public), a live recording +(it may have used a member's cookies), a download without cookies (public or unlisted). + +| | In umtool | From a terminal | +|---|---|---| +| draw it (default off: a cut without it draws the page it always did) | Build, **Look**: **Subtitle**, Source status | `umtool look <p> deck.subtitle.status=end` (or name `status` in `deck.subtitle.parts`) | +| stamp what became of each source | — | `umtool source-status <p> refresh [--dry-run]`; `umtool source-status <p>` prints it | +| hide it on one clip (a clip whose `citeUrl` cites a public mirror) | — | the clip's `"sourceStatus": false` | + +A render reads ONLY the manifest's `sourceStatus` stamp: never the corpus, never the network. `refresh` reads each +recording's records in the project's channels tree, then the corpus (read only), else the published archive's +record (`state`; the archive does not publish the first state, so no parenthesis). It writes the stamp, one undo +point, only when a status changed. With the switch on and no stamp, the line is unchanged and the build says once +that `refresh` has not been run; a status older than 14 days is a build note and is listed, never a refusal. +The status is the recording the clip is CUT from, not the one its `citeUrl` opens. + +Retrofit an old project: the switch (or a look preset that sets it), `refresh`, a retake. With the deck on only the +deck's page and the final pass are redrawn; no clip segment is re-encoded. Surfaces: the 16:9 deck, its finale copy +(the title still last, the status before it), the live preview and Present. Not yet: the stacked vertical deck, the +end card's source list, the shorts/desktop tag, `umtool export`'s Sources list, the share line. + +**The ledger cards can disagree.** A stacked ledger card's "source private" / "members only" comes from the build's +own `yt-dlp --simulate` probe (`out/availability.json`, render-cards.mjs `SOURCE_TAG`), a looser reading taken at +build; the source line comes from the archive's records via the stamp. Until the two share the stamp, a card and a +line about one recording can say different things. + ## Gaps inside a clip A clip may leave seconds out of its middle: you suggest one long clip and cut a gap or two out of it, rather than @@ -2887,7 +2929,7 @@ filter. A knob absent is its default, and a module whose knobs are all absent dr | Module | What it is | Its home | |---|---|---| | [Deck (the shell)](#deck-the-shell) `shell` | The panel at the foot of the frame: each clip's title, and the band the subtitle, QR, rail and counter draw in. (a page over the whole cut) | `render.chrome.deck` | -| [Subtitle](#subtitle) `subtitle` | Each clip's source line under its title: the channel, the source's title, the date, the clock. (drawn in the deck's page) | `render.chrome.deck.subtitle` | +| [Subtitle](#subtitle) `subtitle` | Each clip's source line under its title: the channel, the source's title, the date, the clock, and (when on) what became of the source. (drawn in the deck's page) | `render.chrome.deck.subtitle` | | [QR](#qr) `qr` | Each clip's code in the deck, to the archive at the clip or to the record itself. (drawn in the deck's page) | `render.chrome.deck.qr` | | [Rail](#rail) `rail` | The deck's pip track: a pip per clip, the marker, the fuse, and the markers' flags. (drawn in the deck's page) | `render.chrome.deck.pip` | | [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` | @@ -2960,9 +3002,10 @@ The source line under each clip's title, in the deck. The automatic line is set | Knob | Range · default | From a terminal | |---|---|---| -| `deck.subtitle.parts` | `auto` · a list of distinct `channel` `title` `date` `clock` · default `auto` | `umtool look <p> deck.subtitle='{"parts":["channel","date","clock"]}'` | +| `deck.subtitle.parts` | `auto` · a list of distinct `channel` `title` `date` `clock` `status` · default `auto` | `umtool look <p> deck.subtitle='{"parts":["channel","date","clock"]}'` | | `deck.subtitle.dateFormat` | `long` (24 Oct 2020) · `iso` · default `long` | `umtool look <p> deck.subtitle='{"dateFormat":"iso"}'` | | `deck.subtitle.lines` | `1` · `2`: the source's title on a line of its own (a size up; it shrinks to 70 % before it ellipsizes), the other parts under it. The deck grows by that line (39 px at the default title size) and the footage must still fit above it: with full-width footage that needs `footageScale` at most about 0.78 · default `1` | `umtool look <p> deck.subtitle.lines=2 deck.footageScale=0.78` | +| `deck.subtitle.status` | `off` · `end`: the SOURCE STATUS after the last part (or name `status` in `parts` to place it) -- `now private` / `now members-only` / `now deleted`, with `(public when streamed)` or `(was public)` only when the archive's records prove it; nothing for a public, unlisted or age-gated source. Read from the manifest's `sourceStatus` stamp alone (`umtool source-status <p> refresh`; never the network at render) · default `off` | `umtool look <p> deck.subtitle.status=end` then `umtool source-status <p> refresh` | | `deck.subtitle.head` | `auto` (the source's title) · a list of distinct parts for the first of two lines; the rest of `parts` take the second · default `auto` | `umtool look <p> deck.subtitle.head='["channel","title"]'` | ### QR diff --git a/umtool/lib/report/onscreen.mjs b/umtool/lib/report/onscreen.mjs @@ -45,6 +45,7 @@ import { transitionOf, } from "umtool-report-to-video/deck"; import { marksOf, rawMarksOf, roundStamps, stampSchedule } from "umtool-report-to-video/factcheck"; +import { clipSourceStatus, subtitleStatusOn } from "umtool-report-to-video/source-status"; import { setMarks } from "./knobs.mjs"; import { channelsDirFor, @@ -277,7 +278,8 @@ export function previewSchedule({ variantManifest, built, draft, metas, postsDra segments: claimed.map((s, i) => { const e = patchedEntries[i]; const meta = metas[i] ?? null; - const { title, subtitle, subtitleParts, subtitleLines, subtitleLinesParts } = deckText(e, meta, provenance, deck, built.multiChannel); + const status = subtitleStatusOn(deck.subtitle) ? clipSourceStatus(e, variantManifest.sourceStatus, provenance) : ""; + const { title, subtitle, subtitleParts, subtitleLines, subtitleLinesParts } = deckText(e, meta, provenance, deck, built.multiChannel, status); const keepBuilt = e.type === "clip" && e.onscreen?.subtitle === undefined && !meta; // A two-line subtitle's lines, and the line's parts by token, go with the subtitle they were cut from. const { subtitleLines: builtLines, subtitleParts: builtParts, subtitleLinesParts: builtLinesParts, ...seg } = s; diff --git a/umtool/report-to-video/attribution.mjs b/umtool/report-to-video/attribution.mjs @@ -179,7 +179,9 @@ export function deckSubtitle(parts, opts = {}, multiChannel = false) { * empty ones dropped): what `deckSubtitle` joins, kept apart so the page can * set each part by WHAT it is -- the date and the clock never give way, the * title gives way first -- rather than by where it stands in the line - * (chrome-deck.mjs subtitleMarkup). Tokens: channel, title, date, clock. + * (chrome-deck.mjs subtitleMarkup). Tokens: channel, title, date, clock, + * status (source-status.mjs: "now private (public when streamed)", from the + * manifest's stamp; drawn only when `parts.status` carries words). * * @returns {Array<[string, string]>} */ @@ -187,16 +189,23 @@ export function deckSubtitleParts(parts, opts = {}, multiChannel = false) { return subtitleValues(parts, opts, multiChannel); } -/** The subtitle's parts as `[token, text]`, in order, the empty ones dropped. */ +/** + * The subtitle's parts as `[token, text]`, in order, the empty ones dropped. + * `opts.status: "end"` puts the source status after the last part, whatever + * `parts` is; named in `parts`, it stands where it is named. Empty (a public + * source, no stamp, the switch off): dropped, so the line is what it was. + */ function subtitleValues(parts, opts, multiChannel) { - const want = !opts.parts || opts.parts === "auto" + const base = !opts.parts || opts.parts === "auto" ? (multiChannel ? ["channel", "title", "date"] : ["title", "date"]) : opts.parts; + const want = opts.status === "end" && !base.includes("status") ? [...base, "status"] : base; const value = { channel: () => parts.channel, title: () => parts.title, date: () => formatDeckDate(parts.date, opts.dateFormat ?? "long"), clock: () => (parts.at === null || parts.at === undefined ? "" : hms(parts.at)), + status: () => parts.status ?? "", }; return want .map((k) => [k, String(value[k]?.() ?? "").trim()]) diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -128,6 +128,7 @@ // // Requires: yt-dlp, ffmpeg/ffprobe, ImageMagick with Pango. +import { sourceStatusNotes, subtitleStatusOn, validateSourceStatus } from "./source-status.mjs"; import { localRecordingFetchRefusal } from "./local-recording.mjs"; import { presetManifest } from "./presets.mjs"; // The basic output mode (render.mode "basic"): the footage alone, cut and spliced in basic.mjs. @@ -6402,6 +6403,11 @@ export async function writeChromeSchedule({ manifest, entries, segments, D, outD // What the record says to a deck claim's `claim` (it does not contradict // him, a stamp with no date): notes, the operator's to weigh. for (const message of claimRecordNotes(doc)) EMIT("note", { message }); + // The source status (source-status.mjs): drawn from the stamp alone; what the + // stamp lacks or how old it is, said here, never a refusal. + if (subtitleStatusOn(resolveDeck(manifest.render ?? {}).subtitle)) { + for (const message of sourceStatusNotes({ ...manifest, timeline: entries })) EMIT("note", { message }); + } return doc; } @@ -6463,6 +6469,7 @@ export async function measureChromeSchedule({ manifest, entries, segments, D, du // upload dates. A manifest without posts writes the schedule it always did. return deckSchedule({ entries, durs, D, render, provenance, metas, posts: manifest.posts ?? [], frameScan: manifest.frameScan ?? null, + sourceStatus: manifest.sourceStatus ?? null, ...(fx ? { fxWords: fx.words, fxClock: fx.clock } : {}), ...(chat ? { chat } : {}), ...(clipClock ? { clipClock } : {}), @@ -6977,6 +6984,7 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly ...validateStatsEntries(whole), ...validateMontage(whole), ...validateAssist(whole), ...validateFxEntries(whole, { schedule: false }), ...validateTransitionStyle(whole), ...validateLook(whole), ...validateClipAudioEntries(whole), ...validateClipBlurEntries(whole), ...validateFinaleEntries(whole), ...validateGapEntries(whole), ...measureSettingsProblems(whole), ...validateAnalysisEntries(whole), ...validateClipKit(whole), ...validatePromo(whole), ...validateZooms(whole), ...validateCensor(whole), + ...validateSourceStatus(whole), ]; if (errors.length) throw new Error(`manifest: ${errors.join("; ")}`); } diff --git a/umtool/report-to-video/chrome-deck.mjs b/umtool/report-to-video/chrome-deck.mjs @@ -694,6 +694,25 @@ export function subtitlePartsCss(sel) { } /** + * Does any segment's automatic line carry the source status (deck.mjs deckText's + * `subtitleParts` / `subtitleLinesParts`, token `status`)? Only then do the pages + * add its rule, so a cut without one draws the page it always did. + */ +export function scheduleHasStatus(schedule) { + const has = (parts) => Array.isArray(parts) && parts.some((p) => Array.isArray(p) && p[0] === "status"); + return (schedule?.segments ?? []).some((s) => has(s.subtitleParts) || (Array.isArray(s.subtitleLinesParts) && s.subtitleLinesParts.some(has))); +} + +/** + * The source status part's rule (`sels` the lines it stands in): the line's own + * size and weight, a quiet accent; never shrinks (a `.part` is `flex: none` + * unless it is the title or the channel), never ellipsized. + */ +export function statusPartCss(sels, pal) { + return sels.map((sel) => `${sel} .part[data-p="status"]`).join(", ") + ` { color: ${mix(pal.muted, pal.accent, 0.55)}; }`; +} + +/** * The deck composition's HTML. * * `fonts` = `{ regular, bold }` asset-relative paths (DeckSans / DeckSansBold), @@ -1009,7 +1028,8 @@ export function deckHtml(schedule, render, opts = {}) { font-size: ${t.subtitleSize}px; line-height: ${t.subtitleBox}px; letter-spacing: 0.005em; color: ${pal.muted}; } ${subtitlePartsCss(".deck-sub")} - .deck-sub .sep { color: ${pal.accent}; padding: 0 0.42em; font-family: 'DeckSansBold', sans-serif; } + .deck-sub .sep { color: ${pal.accent}; padding: 0 0.42em; font-family: 'DeckSansBold', sans-serif; }${scheduleHasStatus(schedule) ? ` + ${statusPartCss([".deck-sub"], pal)}` : ""} .blade { position: absolute; right: 0; top: ${Math.round(t.titleBox * 0.14)}px; width: 4px; height: ${Math.round(t.titleBox * 0.72)}px; border-radius: 2px; background: ${pal.accent}; box-shadow: 0 0 14px 2px ${rgba(pal.accent, 0.55)}; } diff --git a/umtool/report-to-video/chrome-finale.mjs b/umtool/report-to-video/chrome-finale.mjs @@ -24,7 +24,7 @@ // The timeline is cues, each stating its from (chrome-deck.mjs says why). import { cueTime, cueTimeAfter, finaleRail, pageDuration, resolveDeck } from "./deck.mjs"; import { finaleClaimsMarkup } from "./chrome-claims.mjs"; -import { mix, rgba, shapeCss, subtitleMarkup, subtitlePartsCss, subtitleTokens } from "./chrome-deck.mjs"; +import { mix, rgba, scheduleHasStatus, shapeCss, statusPartCss, subtitleMarkup, subtitlePartsCss, subtitleTokens } from "./chrome-deck.mjs"; import { resolveFactcheck, tallyCells, tallyFinals, tallyOf } from "./factcheck.mjs"; import { settleFirstFrame } from "./cue-start.mjs"; import { resolveCounter } from "./counter.mjs"; @@ -527,7 +527,8 @@ export function finaleHtml(schedule, render, window, opts = {}) { .dtt { font-family: 'DeckSansBold', sans-serif; font-size: ${L.foot.text.titleSize}px; line-height: ${L.foot.text.titleBox}px; letter-spacing: -0.012em; } .dts { display: flex; font-size: ${L.foot.text.subtitleSize}px; line-height: ${L.foot.text.subtitleBox}px; color: ${pal.muted}; } .dts .sep { color: ${pal.accent}; padding: 0 0.42em; font-family: 'DeckSansBold', sans-serif; } - ${subtitlePartsCss(".dts")} + ${subtitlePartsCss(".dts")}${scheduleHasStatus(schedule) ? ` + ${statusPartCss([".dts", ".cs"], pal)}` : ""} .drule { width: ${Math.round(L.foot.text.titleSize * 1.5)}px; height: 4px; border-radius: 2px; background: ${pal.accent}; } .hole { position: absolute; transform-origin: 0 0; box-shadow: 0 0 0 ${HOLE_REACH}px ${pal.bg}; } .ground { position: absolute; inset: 0; background: ${pal.bg}; } diff --git a/umtool/report-to-video/deck-source-status.test.mjs b/umtool/report-to-video/deck-source-status.test.mjs @@ -0,0 +1,170 @@ +// The source status on the deck's source line (lane source-status): the words from +// one table, the part placed by the switch or by `parts`, read from the manifest's +// stamp alone -- and a cut with the switch off, or on with no stamp, draws the +// schedule and the deck page it always did, byte for byte. +// +// Run with: node --test umtool/report-to-video/deck-source-status.test.mjs + +import assert from "node:assert/strict"; +import { createHash } from "node:crypto"; +import test from "node:test"; + +import { deckSubtitleLinesParts, deckSubtitleParts } from "./attribution.mjs"; +import { deckHtml, scheduleHasStatus, subtitleMarkup } from "./chrome-deck.mjs"; +import { titleLastParts } from "./chrome-finale.mjs"; +import { estimateSchedule } from "./deck.mjs"; +import { validateSubtitleSettings } from "./modules/settings.mjs"; +import { + SOURCE_STATUS_WORDS, clipSourceStatus, sourceStatusNotes, sourceStatusText, validateSourceStatus, +} from "./source-status.mjs"; + +const PALETTE = { bg: "#12101a", fg: "#f4f1ea", muted: "#9a93ad", accent: "#a97bff", amber: "#ffc860" }; +const FONTS = { regular: "assets/DeckSans.ttf", bold: "assets/DeckSansBold.ttf" }; + +const clip = (id, video, start, extra = {}) => ({ id, type: "clip", video, start, end: start + 10, cite: start + 2, quote: "a synthetic line", ...extra }); + +/** A synthetic cut: four clips of one made-up channel. */ +function manifest({ subtitle = null, stamp = undefined, timeline = null } = {}) { + return { + title: "Synthetic cut", + provenance: { channelSlug: "synth-channel", channel: "Synth Channel", siteOrigin: "https://archive.example.test" }, + render: { + width: 1920, height: 1080, fps: 30, transition: 0.5, palette: PALETTE, + chrome: { engine: "hyperframes", layout: "deck", deck: subtitle ? { subtitle } : {} }, + }, + timeline: timeline ?? [ + clip("c01", "synthvid001", 600, { onscreen: { title: "The first moment" } }), + clip("c02", "synthvid002", 1200, { onscreen: { title: "The second moment" } }), + clip("c03", "synthvid003", 1800, { onscreen: { title: "The third moment" } }), + clip("c04", "synthvid004", 2400, { onscreen: { title: "The fourth moment" } }), + ], + ...(stamp !== undefined ? { sourceStatus: stamp } : {}), + }; +} +const META = (n) => ({ title: `Synthetic stream ${n}`, uploadDate: "20310301", channel: "Synth Channel", webpageUrl: `https://video.example.test/${n}` }); +const METAS = [META(1), META(2), META(3), META(4)]; + +const STAMP = { + refreshedAt: "2031-03-02T00:00:00.000Z", + sources: { + "synth-channel/synthvid001": { now: "members_only", since: "2031-03-01T20:00:00Z", asOf: "2031-03-01T20:00:00Z", first: "public", firstAt: "2031-03-01T10:05:00Z", firstWhen: "live", from: "corpus", evidence: [] }, + "synth-channel/synthvid002": { now: "private", since: null, asOf: "2031-03-01T20:00:00Z", first: "public", firstAt: "2031-02-01T00:00:00Z", firstWhen: "other", from: "corpus", evidence: [] }, + "synth-channel/synthvid003": { now: "deleted", since: null, asOf: "2031-03-01T20:00:00Z", first: null, firstAt: null, firstWhen: null, from: "archive", evidence: [] }, + "synth-channel/synthvid004": { now: "public", since: null, asOf: "2031-03-01T20:00:00Z", first: null, firstAt: null, firstWhen: null, from: "corpus", evidence: [] }, + }, +}; + +const scheduleOf = (m) => estimateSchedule(m, { metas: METAS }); +const pageOf = (m) => deckHtml(scheduleOf(m), m.render, { fonts: FONTS }); +const sha = (s) => createHash("sha256").update(s).digest("hex"); +const seg = (s, id) => s.segments.find((x) => x.id === id); + +// THE BYTES MAIN DRAWS for this cut (no switch, no stamp), computed from main's +// own modules at the lane's base (bbe528138) with this lane's changes stashed. +const MAIN_SCHEDULE_SHA = "c70ee12800800ea78e724d4633b43893abcfb2beea4a86a7681a5b6d7f295f51"; +const MAIN_PAGE_SHA = "19cc5f822e220de5db9131fbe0cac60c8368aa8c801f7b28449577337e8ba093"; + +test("the words: one table, each state with and without its parenthesis", () => { + const w = (now, first = null, firstWhen = null) => sourceStatusText({ now, first, firstWhen }); + assert.equal(w("private", "public", "live"), "now private (public when streamed)"); + assert.equal(w("private", "public", "other"), "now private (was public)"); + assert.equal(w("private"), "now private"); + assert.equal(w("members_only", "public", "live"), "now members-only (public when streamed)"); + assert.equal(w("members_only", "public", "other"), "now members-only (was public)"); + assert.equal(w("members_only"), "now members-only"); + assert.equal(w("deleted", "public", "live"), "now deleted (public when streamed)"); + assert.equal(w("deleted", "public", "other"), "now deleted (was public)"); + assert.equal(w("deleted"), "now deleted"); + for (const quiet of ["public", "unlisted", "needs_auth", "error", "maybe_missing", null]) assert.equal(w(quiet, "public", "live"), "", `${quiet} draws nothing`); + assert.equal(sourceStatusText(null), ""); + // Every string the part can draw is in the table. + assert.deepEqual(Object.keys(SOURCE_STATUS_WORDS.now).sort(), ["deleted", "members_only", "private"]); +}); + +test("a clip's words from the stamp: hidden per clip, none for a src clip or an unstamped source", () => { + const prov = { channelSlug: "synth-channel" }; + assert.equal(clipSourceStatus(clip("a", "synthvid002", 0), STAMP, prov), "now private (was public)"); + assert.equal(clipSourceStatus(clip("a", "synthvid002", 0, { sourceStatus: false }), STAMP, prov), ""); + assert.equal(clipSourceStatus(clip("a", "synthvid002", 0, { src: "clips/own.mp4" }), STAMP, prov), ""); + assert.equal(clipSourceStatus(clip("a", "synthvid009", 0), STAMP, prov), ""); + assert.equal(clipSourceStatus(clip("a", "synthvid002", 0, { channel: "other-synth" }), STAMP, prov), ""); + assert.equal(clipSourceStatus(clip("a", "synthvid002", 0), null, prov), ""); +}); + +test("the subtitle parts: status after the last with the switch, where named in parts, on the second of two lines", () => { + const parts = { channel: "Synth Channel", title: "Synthetic stream", date: "2031-03-01", at: 2100, status: "now private (public when streamed)" }; + assert.deepEqual(deckSubtitleParts(parts, { parts: ["channel", "date", "clock"], status: "end" }).map(([k]) => k), ["channel", "date", "clock", "status"]); + assert.deepEqual(deckSubtitleParts(parts, { parts: ["channel", "status", "date"] }).map(([k]) => k), ["channel", "status", "date"]); + // Off: the part is not drawn even with words; on with no words: dropped. + assert.deepEqual(deckSubtitleParts(parts, {}).map(([k]) => k), ["title", "date"]); + assert.deepEqual(deckSubtitleParts({ ...parts, status: "" }, { status: "end" }).map(([k]) => k), ["title", "date"]); + const [one, two] = deckSubtitleLinesParts(parts, { parts: ["channel", "title", "date", "clock"], status: "end", lines: 2 }); + assert.deepEqual(one.map(([k]) => k), ["title"]); + assert.deepEqual(two.map(([k]) => k), ["channel", "date", "clock", "status"]); +}); + +test("the schedule: each clip's line ends in its status; a public source's line is the line it was", () => { + const s = scheduleOf(manifest({ subtitle: { parts: ["channel", "date", "clock"], status: "end" }, stamp: STAMP })); + assert.equal(seg(s, "c01").subtitle, "Synth Channel · Mar 1, 2031 · 10:02 · now members-only (public when streamed)"); + assert.deepEqual(seg(s, "c01").subtitleParts.at(-1), ["status", "now members-only (public when streamed)"]); + assert.equal(seg(s, "c02").subtitle, "Synth Channel · Mar 1, 2031 · 20:02 · now private (was public)"); + assert.equal(seg(s, "c03").subtitle, "Synth Channel · Mar 1, 2031 · 30:02 · now deleted"); + assert.equal(seg(s, "c04").subtitle, "Synth Channel · Mar 1, 2031 · 40:02"); + assert.ok(seg(s, "c04").subtitleParts.every(([k]) => k !== "status")); + // The page: the part by token, its quiet accent only because one is drawn. + assert.ok(scheduleHasStatus(s)); + const html = deckHtml(s, manifest().render, { fonts: FONTS }); + assert.match(html, /<span class="part" data-p="status">now members-only \(public when streamed\)<\/span>/); + assert.match(html, /\.deck-sub \.part\[data-p="status"\] \{ color: /); + assert.equal(subtitleMarkup("a · b", [["title", "a"], ["status", "b"]]), '<span class="part" data-p="title">a</span><span class="sep">·</span><span class="part" data-p="status">b</span>'); +}); + +test("BYTE FOR BYTE: the switch off, or on with no stamp, draws main's schedule and page", () => { + const base = manifest({ subtitle: { parts: ["channel", "date", "clock"] } }); + const baseSchedule = JSON.stringify(scheduleOf(base), null, 2); + const basePage = pageOf(base); + assert.equal(sha(baseSchedule), MAIN_SCHEDULE_SHA, "the schedule main writes"); + assert.equal(sha(basePage), MAIN_PAGE_SHA, "the deck page main draws"); + for (const [why, m] of [ + ["the switch on, no stamp", manifest({ subtitle: { parts: ["channel", "date", "clock"], status: "end" } })], + ["a stamp, the switch off", manifest({ subtitle: { parts: ["channel", "date", "clock"] }, stamp: STAMP })], + ["a stamp, the switch off explicitly", manifest({ subtitle: { parts: ["channel", "date", "clock"], status: "off" }, stamp: STAMP })], + ]) { + const s = scheduleOf(m); + assert.equal(JSON.stringify(s, null, 2), baseSchedule, `${why}: the schedule`); + assert.equal(scheduleHasStatus(s), false); + // The page reads render.chrome.deck; the switch alone may not change a byte of it. + assert.equal(deckHtml(s, m.render, { fonts: FONTS }), basePage, `${why}: the page`); + } +}); + +test("the finale's copy of the line keeps the title last, the status before it", () => { + const tok = [["channel", "Synth Channel"], ["title", "Synthetic stream"], ["date", "Mar 1, 2031"], ["status", "now private"]]; + const line = tok.map(([, v]) => v).join(" · "); + assert.deepEqual(titleLastParts(line, tok).map(([k]) => k), ["channel", "date", "status", "title"]); +}); + +test("the build's notes: once that refresh has not been run, and a status older than 14 days", () => { + const on = manifest({ subtitle: { status: "end" } }); + assert.deepEqual(sourceStatusNotes(on, { now: Date.parse("2031-03-03T00:00:00Z") }).length, 1); + assert.match(sourceStatusNotes(on)[0], /source-status <p> refresh` has not been run/); + const stamped = manifest({ subtitle: { status: "end" }, stamp: STAMP }); + assert.deepEqual(sourceStatusNotes(stamped, { now: Date.parse("2031-03-10T00:00:00Z") }), []); + const late = sourceStatusNotes(stamped, { now: Date.parse("2031-03-20T00:00:00Z") }); + assert.equal(late.length, 1); + assert.match(late[0], /older than 14 days: synth-channel\/synthvid001 \(2031-03-01\)/); + const partial = manifest({ subtitle: { status: "end" }, stamp: { ...STAMP, sources: { "synth-channel/synthvid001": STAMP.sources["synth-channel/synthvid001"] } } }); + assert.match(sourceStatusNotes(partial, { now: Date.parse("2031-03-03T00:00:00Z") })[0], /3 source\(s\) not in the stamp/); +}); + +test("validation: the switch's values, the status token, the stamp's shape, a clip's hide", () => { + const v = (subtitle) => validateSubtitleSettings({ subtitle }, { where: "deck" }); + assert.deepEqual(v({ status: "end" }), []); + assert.deepEqual(v({ parts: ["channel", "status"] }), []); + assert.match(v({ status: "on" })[0], /subtitle\.status must be "off" or "end"/); + assert.deepEqual(validateSourceStatus(manifest({ stamp: STAMP })), []); + assert.deepEqual(validateSourceStatus(manifest()), []); + assert.match(validateSourceStatus(manifest({ stamp: { sources: {} } }))[0], /refreshedAt/); + assert.match(validateSourceStatus(manifest({ stamp: { refreshedAt: STAMP.refreshedAt, sources: { "a/b": { now: "private", first: "public" } } } }))[0], /firstWhen/); + assert.match(validateSourceStatus(manifest({ timeline: [clip("c01", "synthvid001", 0, { sourceStatus: true })] }))[0], /may only be false/); +}); diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs @@ -22,6 +22,7 @@ import { measureOn, measureSlice } from "./measure-slice.mjs"; import { COMPOSITION_PARAMS } from "yt-dlp-transcript-common/lib/report/fxParams.mjs"; import { INTRO_SECONDS } from "yt-dlp-transcript-common/lib/report/intro.mjs"; +import { clipSourceStatus, subtitleStatusOn } from "./source-status.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"; @@ -1301,7 +1302,7 @@ const sameTitle = (a, b) => titleKey(a) === titleKey(b); * `onscreen.title` that only repeats its source's title (sameTitle) is * dropped when the two lines show that title. */ -export function deckText(entry, meta, provenance, deck, multiChannel) { +export function deckText(entry, meta, provenance, deck, multiChannel, status = "") { const o = entry.onscreen ?? {}; let title = o.title ?? ""; let subtitle = o.subtitle; @@ -1314,7 +1315,9 @@ export function deckText(entry, meta, provenance, deck, multiChannel) { const two = deck.subtitle?.lines === 2; if (subtitle === undefined) { if (entry.type === "clip") { - const parts = attributionParts(entry, meta ?? {}, provenance); + // The source status (source-status.mjs), when the deck draws it and the + // stamp names a state: else no key, and the parts are what they were. + const parts = { ...attributionParts(entry, meta ?? {}, provenance), ...(status ? { status } : {}) }; subtitle = deckSubtitle(parts, deck.subtitle, multiChannel); subtitleParts = deckSubtitleParts(parts, deck.subtitle, multiChannel); if (two) subtitleLines = deckSubtitleLines(parts, deck.subtitle, multiChannel); @@ -1409,8 +1412,12 @@ export function deckQrUrl(entry, provenance = {}, { links = DECK_DEFAULTS.qr.lin export function deckSchedule({ entries, durs, D, render, provenance = {}, metas = [], estimated = false, posts = [], frameScan = null, fxWords = null, fxClock = null, clipClock = null, clipGaps = null, chat = null, measure = null, + sourceStatus = null, }) { const deck = resolveDeck(render); + // The source status on a clip's line (source-status.mjs): the manifest's stamp + // alone, and only when the subtitle draws it. + const statusOf = subtitleStatusOn(deck.subtitle) ? (e) => clipSourceStatus(e, sourceStatus, provenance) : () => ""; // A clip's gaps (gaps.mjs) on its segment: its cut record's as built // (`clipGaps`), else its own. A source second after one plays that much // earlier in the cut; only a segment with any carries `gaps`, so a cut @@ -1532,7 +1539,7 @@ export function deckSchedule({ multiChannel, ...(feed ? { layout: "feed" } : {}), segments: entries.map((e, i) => { - const { title, subtitle, subtitleParts, subtitleLines, subtitleLinesParts } = deckText(e, metas[i] ?? null, provenance, deck, multiChannel); + const { title, subtitle, subtitleParts, subtitleLines, subtitleLinesParts } = deckText(e, metas[i] ?? null, provenance, deck, multiChannel, statusOf(e)); return { id: e.id, type: e.type, @@ -2257,6 +2264,7 @@ export function estimateSchedule(manifest, { metas = [], noXfade = false } = {}) metas, estimated: true, frameScan: manifest.frameScan ?? null, + sourceStatus: manifest.sourceStatus ?? null, // A measure ledger's slice, timed by the quotes (no words in an estimate). ...(manifest.ledgerSchema ? { measure: { ledgerSchema: manifest.ledgerSchema, ledger: manifest.measureLedger ?? manifest.ledger ?? [] } } : {}), }); diff --git a/umtool/report-to-video/modules/settings.mjs b/umtool/report-to-video/modules/settings.mjs @@ -121,7 +121,10 @@ export const MARKER_DEFAULT_COLOR = "amber"; export const QR_LINKS = Object.freeze(["site", "original"]); /** Subtitle tokens a `subtitle.parts` array may name. "auto" picks from these. */ -export const SUBTITLE_TOKENS = Object.freeze(["channel", "title", "date", "clock"]); +export const SUBTITLE_TOKENS = Object.freeze(["channel", "title", "date", "clock", "status"]); + +/** `subtitle.status`: "off" (default) or "end" -- the source status after the last part (source-status.mjs). */ +export { SUBTITLE_STATUS_MODES } from "../source-status.mjs"; /** How many lines the subtitle takes (`subtitle.lines`). */ export const SUBTITLE_LINES = Object.freeze([1, 2]); @@ -342,7 +345,10 @@ export function validateSectionTitleSettings(v, { where: w }) { export function validateSubtitleSettings(d, { where: w }) { const errors = []; const tokens = (v) => Array.isArray(v) && v.length > 0 && v.every((p) => SUBTITLE_TOKENS.includes(p)) && new Set(v).size === v.length; - sub(d, "subtitle", ["parts", "dateFormat", "lines", "head"], w, errors, (s) => { + sub(d, "subtitle", ["parts", "dateFormat", "lines", "head", "status"], w, errors, (s) => { + if (s.status !== undefined && !["off", "end"].includes(s.status)) { + errors.push(`${w}.subtitle.status must be "off" or "end" (the source status after the last part)`); + } if (s.parts !== undefined && s.parts !== "auto") { if (!tokens(s.parts)) { errors.push(`${w}.subtitle.parts must be "auto" or a list of distinct ${SUBTITLE_TOKENS.join("/")}`); diff --git a/umtool/report-to-video/modules/subtitle.mjs b/umtool/report-to-video/modules/subtitle.mjs @@ -18,27 +18,30 @@ export default defineModule({ // Its form in the stacked vertical deck (vertical-deck.mjs). vertical: { slot: "inline" }, title: "Subtitle", - summary: "Each clip's source line under its title: the channel, the source's title, the date, the clock.", + summary: "Each clip's source line under its title: the channel, the source's title, the date, the clock, and (when on) what became of the source.", configKey: "render.chrome.deck.subtitle", defaults: DECK_DEFAULTS.subtitle, validate: settingsOf("subtitle").validate, resolve: (render) => ({ ...DECK_DEFAULTS.subtitle, ...(render?.chrome?.deck?.subtitle ?? {}) }), ui: [ { key: "parts", type: "list", options: ["auto", ...SUBTITLE_TOKENS], label: "Parts", default: "auto", - help: "\"auto\", or the parts in order: channel, title, date, clock" }, + help: "\"auto\", or the parts in order: channel, title, date, clock, status" }, { key: "dateFormat", type: "enum", options: ["long", "iso"], label: "Date format", default: "long" }, { key: "lines", type: "number", min: SUBTITLE_LINES[0], max: SUBTITLE_LINES[SUBTITLE_LINES.length - 1], step: 1, label: "Lines", default: 1, help: "2: the source's title on a line of its own (it shrinks to fit before it ellipsizes), the channel, date and clock under it; the deck grows by that line" }, { key: "head", type: "list", options: ["auto", ...SUBTITLE_TOKENS], label: "First line", default: "auto", when: { lines: 2 }, help: "\"auto\" (the source's title), or the parts on the first line; the rest of the parts go on the second" }, + { key: "status", type: "enum", options: ["off", "end"], label: "Source status", default: "off", + help: "end: \"now private (public when streamed)\" after the last part, for a source a viewer can no longer watch -- from the stamp `umtool source-status <p> refresh` writes" }, ], docs: { heading: "Subtitle", intro: "The source line under each clip's title, in the deck. The automatic line is set by what each part IS, wherever it stands: when it runs long the title gives way first (an ellipsis at its end), a channel ellipsizes only past 40 % of the line, and the date and the clock always show whole -- so `[channel, title, date, clock]` never reads \"… · Oct … · 1:08:48\" (the schedule's `subtitleParts`, chrome-deck.mjs subtitleMarkup; the finale's copy of the line too). An entry's typed `onscreen.subtitle` has no parts to name: its middle parts give way, its first and last show whole.", rows: [ - ["`deck.subtitle.parts`", "`auto` · a list of distinct `channel` `title` `date` `clock` · default `auto`", "`umtool look <p> deck.subtitle='{\"parts\":[\"channel\",\"date\",\"clock\"]}'`"], + ["`deck.subtitle.parts`", "`auto` · a list of distinct `channel` `title` `date` `clock` `status` · default `auto`", "`umtool look <p> deck.subtitle='{\"parts\":[\"channel\",\"date\",\"clock\"]}'`"], ["`deck.subtitle.dateFormat`", "`long` (24 Oct 2020) · `iso` · default `long`", "`umtool look <p> deck.subtitle='{\"dateFormat\":\"iso\"}'`"], ["`deck.subtitle.lines`", "`1` · `2`: the source's title on a line of its own (a size up; it shrinks to 70 % before it ellipsizes), the other parts under it. The deck grows by that line (39 px at the default title size) and the footage must still fit above it: with full-width footage that needs `footageScale` at most about 0.78 · default `1`", "`umtool look <p> deck.subtitle.lines=2 deck.footageScale=0.78`"], + ["`deck.subtitle.status`", "`off` · `end`: the SOURCE STATUS after the last part (or name `status` in `parts` to place it) -- `now private` / `now members-only` / `now deleted`, with `(public when streamed)` or `(was public)` only when the archive's records prove it; nothing for a public, unlisted or age-gated source. Read from the manifest's `sourceStatus` stamp alone (`umtool source-status <p> refresh`; never the network at render) · default `off`", "`umtool look <p> deck.subtitle.status=end` then `umtool source-status <p> refresh`"], ["`deck.subtitle.head`", "`auto` (the source's title) · a list of distinct parts for the first of two lines; the rest of `parts` take the second · default `auto`", "`umtool look <p> deck.subtitle.head='[\"channel\",\"title\"]'`"], ], },