// THE CAPS YELLED (operator, 4 Nov: "I feel like allcaps needs to be yelled more"; p-2116771656329019498, "the moment // that THEY have your Dox ITS ALREADY TOO LATE"): a read's scripts are drafted with his ALL-CAPS words lowercased (a // stock voice spells a caps word out letter by letter), so the read says them flat. This raises them on the read // that is there -- no TTS: the words he wrote in caps found in the read's word timings, and the voice over each // run of them lifted the way a voice is raised, not turned up: louder (+5.5 dB), a presence lift (~3.2 kHz), // compressed and gently saturated, crossfaded in and out over 50 ms. Its timings are untouched (the yell changes // no length), so beeps, captions, zooms and slams keep their place. // // umtool posts reread

--yell-caps [--yell-gain 5.5] [--yell-style raise|shout|loud] [--dry-run] [--json] // umtool posts yell

[--all | ] [--yell-gain …] [--yell-style …] [--dry-run] [--json] // // WHICH WORDS: a word of the read whose SOURCE word -- in his post, or in the piece a part reads (the post he // answers, the quote, a linked post) -- is ALL CAPS with two letters or more, its script word aligned to it // (word-zoom.mjs alignWords). Left flat: an acronym or initialism (YELL_ACRONYMS; any caps word with no vowel reads // as letters: DM, KF, TV, BS), and a slur the cut masks (post-slurs.mjs: beeped anyway). A run of caps words is one // span (a gap under YELL_MERGE between two merges them). // // LOUDNESS: the raised voice is limited (nothing clips) and the take's loudness kept within YELL_LUFS_MAX of the one // it came from -- over it, the lift is lowered until it fits (an all-caps post keeps the timbre, not the level). // // STORED: a derived take, `source: {kind: "take", from}`, `steps: [{op: "yell", spans, params: {gain, style}}]`, // picked in one write (undoable). It chains with the tempo and the re-join (postReread.mjs) in either order; a yell // on a yelled take re-yells the take before it (never twice). // // Plain ESM: the CLI runs it under bare node. import { execFile } from "node:child_process"; import { promisify } from "node:util"; import { isNarrated, pickedTake, scriptParts, takeIdOf, takeSourceOf } from "umtool-report-to-video/post-narration"; import { partRoles } from "umtool-report-to-video/post-thread"; import { cutSlurs } from "umtool-report-to-video/post-redact-files"; import { scriptTokens, slurMatches } from "umtool-report-to-video/post-slurs"; import { alignWords, normWord } from "umtool-report-to-video/word-zoom"; import { readManifest } from "../projects/report.mjs"; import { RereadError, lastLocalStep, writeDerivedTake } from "./postReread.mjs"; const execFileP = promisify(execFile); const FFMPEG = () => process.env.FFMPEG_BIN ?? "ffmpeg"; const fin = (v) => typeof v === "number" && Number.isFinite(v); const r3 = (v) => Math.round(v * 1000) / 1000; const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v); export class YellError extends Error { constructor(message) { super(message); this.name = "YellError"; } } export const YELL_USAGE = [ "usage: umtool posts reread --yell-caps [--yell-gain 5.5] [--yell-style raise|shout|loud] [--dry-run] [--json]", " umtool posts yell [--all | …] [--yell-gain 5.5] [--yell-style raise|shout|loud] [--dry-run] [--json]", " THE CAPS YELLED (no TTS): the words he wrote in ALL CAPS (his post, or the piece a part reads) found in the read's", " word timings and raised -- louder, a presence lift, compressed and gently saturated, 50 ms in and out -- as a new", " take, picked (one undo point per item). Acronyms (FBI, DM, KF, TV, … and any caps word with no vowel) and slurs the", " cut masks are left flat. Its timings are kept (beeps, captions, zooms, slams stay right); its loudness within 1 LU", " of the take it came from. Needs the take's word timings (umtool posts narrate

--words). --dry-run lists", " each item's caps words, those it skips and why, and the items with no word timings. Chains with --tempo-for.", ].join("\n"); /** Caps words left flat: acronyms and initialisms (a caps word with no vowel is one by rule: YELL_LETTERS). */ export const YELL_ACRONYMS = Object.freeze(new Set([ "FBI", "CIA", "NSA", "DOJ", "IRS", "TOS", "TOU", "USA", "US", "UK", "EU", "UN", "NYC", "LA", "DC", "DM", "DMS", "PM", "PMS", "KF", "OK", "OKAY", "LOL", "LMAO", "LMFAO", "ROFL", "OMG", "WTF", "IDK", "IIRC", "IMO", "IMHO", "TBH", "BTW", "FYI", "ATM", "ASAP", "ETA", "AKA", "FAQ", "ID", "IDS", "IQ", "AI", "TV", "IRL", "VR", "AR", "PC", "BS", "CEO", "CEOS", "YT", "TTS", "ASMR", "NSFW", "SFW", "POV", "RIP", "MR", "MRS", "MS", "DR", "ST", "JR", "SR", "PR", "HR", "PS", "PSA", "OP", "GG", "FPS", "RPG", "MMO", "NPC", "NPCS", "AMA", "URL", "TIL", "LGBT", "LGBTQ", "TLDR", "DIY", "VPN", "IP", "ISP", "API", "AM", "ET", "PST", "EST", "UTC", "GMT", "OBS", "VOD", "VODS", "DLC", "NFT", "NFTS", "VTUBER", "VTUBERS", "VTUBING", "EN", "JP", "ENVTUBER", "MOD", "MODS", "QRT", "RT", "QT", "OG", "GOAT", "NGL", "SMH", "JK", "TFW", "MFW", "AFAIK", "ICYMI", "IG", "FB", "X", "XD", "UWU", "OWO", "ADHD", "OCD", "PTSD", "HIV", "AIDS", "COVID", "NASA", "NATO", "DNA", "GPS", "USB", "CD", "DVD", "HD", "UHD", "PDF", "JPG", "PNG", "GIF", "HTML", "IOS", "MAGA", "GOP", "POTUS", "SCOTUS", "BLM", "ACAB", "AOC", "DEI", "ESG", "CRT", "SJW", "SJWS", "TERF", "TERFS", "IRA", "LLC", "INC", "LTD", "CO", ])); /** The ramp in and out of a raised span, seconds (≥ 40 ms: never a click). */ export const YELL_RAMP = 0.05; /** Two caps spans closer than this are one (a run read as one). */ export const YELL_MERGE = 0.35; /** A span starts this much before its first word's timing (the transcription's starts run late). */ export const YELL_PAD = Object.freeze({ before: 0.03, after: 0.04 }); /** The take's loudness may rise at most this much over the take it came from, LU. */ export const YELL_LUFS_MAX = 1; /** The styles: the lift (dB) and how the raised voice is shaped. */ export const YELL_STYLES = Object.freeze({ // presence/body: EQ lifts (dB) at ~3.2 kHz and ~1.1 kHz; ratio: the compressor's; drive: dB pushed into a tanh // saturation (and taken back after it). The lift (`gain`) is MEASURED: the raised spans come out that much louder. raise: Object.freeze({ gain: 5.5, presence: 3, body: 1.5, ratio: 2.5, drive: 3 }), shout: Object.freeze({ gain: 7, presence: 4.5, body: 2, ratio: 4, drive: 6 }), loud: Object.freeze({ gain: 5.5, presence: 0, body: 0, ratio: 1, drive: 0 }), }); export const YELL_GAIN = Object.freeze([1, 9]); const VOWEL_RE = /[AEIOUY]/; const letters = (w) => String(w ?? "").replace(/['’]S$/i, "").replace(/[^\p{L}]/gu, ""); /** Is a source word ALL CAPS, two letters or more (I'LL, ISN'T count; "I" and "10X" do not)? */ export function isCapsWord(raw) { const L = letters(raw); return L.length >= 2 && L === L.toUpperCase() && L !== L.toLowerCase(); } /** Why a caps word is left flat (acronym / letters), or null when it is yelled. */ export function acronymWhy(raw) { const L = letters(raw).toUpperCase(); if (YELL_ACRONYMS.has(L)) return "acronym"; if (!VOWEL_RE.test(L)) return "letters"; return null; } /** The source texts a read's words come from: his post, the posts it answers, the quote, a linked post. */ export function sourcePieces(entry) { const out = []; const add = (where, v) => typeof v === "string" && v.trim() && out.push({ where, text: v }); add("post", entry?.text); (Array.isArray(entry?.parents) ? entry.parents : []).forEach((p, i) => add(`parent:${i}`, p?.text)); if (isObj(entry?.quoted)) add("quoted", entry.quoted.text); (Array.isArray(entry?.links) ? entry.links : []).forEach((l, i) => add(`linked:${i}`, l?.text)); return out; } /** * THE CAPS of a read, pure: `{ yell: [{ k, w, src, where }], skip: [{ k, w, src, where, why }], words: boolean, * error? }` -- `k` the script token's index (= the take's word index), `src` the source word in caps. `slurs` the * cut's resolved slur filter (post-redact-files.mjs cutSlurs): a slur's word is skipped (it is beeped anyway). * * @param {Record} entry * @param {Record} take * @param {Record | null} [slurs] */ export function capsOfRead(entry, take, slurs = null) { const script = typeof take?.script === "string" ? take.script : String(entry?.narration?.script ?? ""); const toks = scriptTokens(script); const hits = slurs ? slurMatches(script, slurs) : []; // Each script word's piece (the role of the part reading it: post-thread.mjs partRoles), when the parts tile the // script: a piece's caps are looked for only in the words that read it -- never a word of his own that happens to // match a caps word of the post he answers. const roles = partRoles(entry, take); const partTexts = Array.isArray(take?.parts) && take.parts.length ? take.parts.map((x) => x?.text) : scriptParts(script).map((x) => x.text); const counts = partTexts.map((x) => scriptTokens(String(x ?? "")).length); const roleOfTok = counts.reduce((a, b) => a + b, 0) === toks.length && roles.length === counts.length ? counts.flatMap((n, i) => Array(n).fill(roles[i]?.role ?? null)) : null; const found = new Map(); for (const piece of sourcePieces(entry)) { const src = (piece.text.match(/\S+/g) ?? []).filter((w) => normWord(w)); if (!src.some(isCapsWord)) continue; const idx = toks.map((_, k) => k).filter((k) => !roleOfTok || roleOfTok[k] === piece.where || (roleOfTok[k] === null && piece.where === "post")); if (!idx.length) continue; const map = alignWords(idx.map((k) => toks[k].w), src); map.forEach((j, i) => { const k = idx[i]; if (j < 0 || !isCapsWord(src[j]) || found.has(k)) return; // Read in place: a neighbour aligned to its neighbour too (a lone match across unrelated words is not one). if (!(map[i - 1] === j - 1 || map[i + 1] === j + 1 || src.length === 1)) return; found.set(k, { k, w: toks[k].w, src: src[j].replace(/^[^\p{L}\p{N}]+|[^\p{L}\p{N}]+$/gu, ""), where: piece.where }); }); } const yell = []; const skip = []; for (const c of [...found.values()].sort((a, b) => a.k - b.k)) { const t = toks[c.k]; const why = hits.some((h) => t.end > h.start && t.start < h.end) ? "slur" : acronymWhy(c.src); (why ? skip : yell).push(why ? { ...c, why } : c); } const words = Array.isArray(take?.words) ? take.words : []; const out = { yell, skip, words: words.length > 0, tokens: toks.length }; if (yell.length && !words.length) return { ...out, error: `its take ${take?.file ?? ""} has no word timings to find its caps by (umtool posts narrate

${entry?.id ?? ""} --words)` }; if (yell.length && words.length !== toks.length) return { ...out, error: `its take ${take?.file ?? ""}'s word timings are not of its script (${words.length} timed, ${toks.length} in the script)` }; return out; } /** The take seconds a read's caps are raised over, pure: each yelled word's timing padded, runs merged. */ export function yellSpans(words, ks, { merge = YELL_MERGE } = {}) { const spans = ks .map((k) => words[k]) .filter((w) => w && fin(w.start) && fin(w.end)) .map((w) => [Math.max(0, w.start - YELL_PAD.before), Math.max(w.start, w.end) + YELL_PAD.after]) .sort((a, b) => a[0] - b[0]); const out = []; for (const s of spans) { const last = out[out.length - 1]; if (last && s[0] - last[1] < merge) last[1] = Math.max(last[1], s[1]); else out.push([...s]); } return out.map(([a, b]) => [r3(a), r3(b)]); } /** * THE YELL's PLAN, pure: the take it raises (`take`: the picked one; on a take made by a yell, the one before it), * its caps and spans, the steps -- the parts, words and script unchanged. Throws YellError when there is nothing to * yell, no timings to find them by, or a yell further up the chain. * * @param {Record} entry * @param {{ slurs?: Record | null, gain?: number, style?: string }} [o] */ export function yellPlan(entry, { slurs = null, gain = undefined, style = "raise" } = {}) { const picked = pickedTake(entry); if (!picked) throw new YellError(`${entry?.id ?? "?"} has no take to yell`); if (!YELL_STYLES[style]) throw new YellError(`--yell-style ${style}: ${Object.keys(YELL_STYLES).join(", ")}`); const g = gain === undefined || gain === null ? YELL_STYLES[style].gain : Number(gain); if (!(fin(g) && g >= YELL_GAIN[0] && g <= YELL_GAIN[1])) throw new YellError(`--yell-gain ${gain}: ${YELL_GAIN.join("–")} dB`); const takes = entry.narration.takes; const up = lastLocalStep(takes, picked, ["yell"]); let take = picked; if (up) { if (!up.from) throw new YellError(`${entry.id}'s picked take is yelled already, and the take it came from is gone`); take = { ...up.from, index: takes.indexOf(up.from) }; } // A yell further up its chain (yelled, then re-timed): never raised twice. for (let cur = take, i = 0; cur && i < 20; i += 1) { if ((cur.steps ?? []).some((st) => st?.op === "yell")) throw new YellError(`${entry.id}'s picked take was made from a yelled one (${takeIdOf(cur)}): pick the take before the yell, then yell and re-time again`); const src = takeSourceOf(cur); cur = src.kind === "take" ? takes.find((x) => takeIdOf(x) === src.from) : null; } const caps = capsOfRead(entry, take, slurs); if (caps.error) throw new YellError(`${entry.id}: ${caps.error}`); if (!caps.yell.length) throw new YellError(`${entry.id}: no word of its read is in caps in what it reads${caps.skip.length ? ` (left flat: ${caps.skip.map((s) => `${s.src} (${s.why})`).join(", ")})` : ""}`); const spans = yellSpans(take.words, caps.yell.map((c) => c.k)); return { take, picked, caps, spans, style, gain: g, parts: take.parts, words: take.words, script: typeof take.script === "string" ? take.script : entry.narration.script, seconds: take.seconds, steps: [{ op: "yell", spans, params: { gain: g, style }, ranAt: new Date().toISOString() }], }; } /** The envelope over the spans at time t (an ffmpeg expression): 0 outside, 1 inside, YELL_RAMP in and out. */ export function yellEnvelope(spans, ramp = YELL_RAMP) { const r = ramp.toFixed(3); const one = ([a, b]) => `clip(min((t-${(a - ramp).toFixed(3)})/${r},(${(b + ramp).toFixed(3)}-t)/${r}),0,1)`; // Sums of disjoint trapezoids, each term gated to its own window. return `clip(${spans.map((s) => `between(t,${(s[0] - ramp).toFixed(3)},${(s[1] + ramp).toFixed(3)})*${one(s)}`).join("+")},0,1)`; } /** The envelope's step: the voice is gained in frames this many samples long (2.7 ms at 24 kHz: a 50 ms ramp is ~18 steps). */ export const YELL_FRAME = 64; /** * The ffmpeg arguments that raise `plan.spans` of `src` into `out`: the voice split, one branch shaped as a raised * voice (presence, body, compression, the lift with its measured make-up `plan.trim`, a gentle tanh saturation, * limited under 0 dBFS -- its latency compensated), the two crossfaded by the spans' envelope (gained in * YELL_FRAME-sample frames). Its length is the source's. */ export function yellArgs(src, out, plan, { rate = 48000, layout = "mono" } = {}) { const st = YELL_STYLES[plan.style] ?? YELL_STYLES.raise; const E = yellEnvelope(plan.spans); const lift = Math.round((plan.gain + (fin(plan.trim) ? plan.trim : 0)) * 100) / 100; const shape = [ st.presence ? `equalizer=f=3200:t=o:w=1.3:g=${st.presence}` : null, st.body ? `equalizer=f=1100:t=o:w=1:g=${st.body}` : null, st.ratio > 1 ? `acompressor=threshold=0.063:ratio=${st.ratio}:attack=5:release=90:makeup=1` : null, `volume=${lift + (st.drive || 0)}dB`, st.drive ? `asoftclip=type=tanh,volume=-${st.drive}dB` : null, "alimiter=limit=0.94:attack=2:release=40:level=false:latency=1", ].filter(Boolean).join(","); const fc = [ `[0:a]aformat=sample_fmts=fltp:sample_rates=${rate}:channel_layouts=${layout},asetnsamples=n=${YELL_FRAME}:p=0,asplit=2[yd][yw]`, `[yw]${shape},asetnsamples=n=${YELL_FRAME}:p=0,volume=volume='${E}':eval=frame[ywet]`, `[yd]volume=volume='1-(${E})':eval=frame[ydry]`, `[ydry][ywet]amix=inputs=2:normalize=0:duration=first,atrim=end_sample=${Math.round(Number(plan.seconds) * rate)}[out]`, ].join(";"); return ["-nostdin", "-hide_banner", "-loglevel", "error", "-y", "-i", src, "-filter_complex", fc, "-map", "[out]", "-c:a", "pcm_s16le", out]; } /** The RMS (dB) of a file over `spans` joined (ffmpeg astats), or null. */ export async function spansRms(file, spans) { const cut = spans.map(([a, b], i) => `[0:a]atrim=start=${a}:end=${b},asetpts=PTS-STARTPTS[s${i}]`); const fc = `${cut.join(";")};${spans.map((_, i) => `[s${i}]`).join("")}concat=n=${spans.length}:v=0:a=1,astats=measure_perchannel=none:measure_overall=RMS_level[o]`; try { const { stderr } = await execFileP(FFMPEG(), ["-nostdin", "-hide_banner", "-nostats", "-i", file, "-filter_complex", fc, "-map", "[o]", "-f", "null", "-"], { maxBuffer: 1 << 24 }); const v = Number(/RMS level dB:\s*(-?[\d.]+)/.exec(String(stderr))?.[1]); return fin(v) ? v : null; } catch { return null; } } /** * @typedef {{ slurs?: Record | null, gain?: number, style?: string, dryRun?: boolean, measure?: (file: string) => Promise<{ seconds: number|null, lufs: number|null }> }} YellOpts */ /** * YELL post item `e`'s caps (yellPlan's options): the file written, its lift MEASURED over the spans and the make-up * set so they come out `gain` dB louder (made again once), its loudness held within YELL_LUFS_MAX of the take it came * from (the lift lowered and the file re-made when over), the take added and picked in one write. * * @param {{ id: string, dir: string }} project * @param {Record} e * @param {YellOpts} [o] */ export async function yellTake(project, e, { slurs = null, gain = undefined, style = "raise", dryRun = false, measure = undefined } = {}) { const plan = yellPlan(e, { slurs, gain, style }); if (dryRun) return { plan }; const measureOf = measure ?? (await import("./postNarrationCli.mjs")).measureTake; const path = await import("node:path"); const srcFile = path.join(project.dir, ...String(plan.take.file).split("/")); const baseLufs = fin(plan.take.lufs) ? plan.take.lufs : (await measureOf(srcFile)).lufs; const before = await spansRms(srcFile, plan.spans); const { take, result } = await writeDerivedTake(project, e, plan, { op: "yell", verb: "yell", measure: measureOf, argsOf: (src, out, fmt) => { plan.fmt = fmt; plan.src = src; return yellArgs(src, out, plan, fmt); }, after: async (abs, m) => { const remake = async () => { await execFileP(FFMPEG(), yellArgs(plan.src, abs, plan, plan.fmt), { maxBuffer: 1 << 24 }); return measureOf(abs); }; let cur = m; // The lift as heard: the compressor and the saturation take some back -- made up once, by what was measured. let lifted = fin(before) ? await spansRms(abs, plan.spans) : null; if (fin(before) && fin(lifted) && Math.abs(lifted - before - plan.gain) > 0.4) { plan.trim = Math.round(Math.min(12, Math.max(-6, plan.gain - (lifted - before))) * 10) / 10; cur = await remake(); lifted = await spansRms(abs, plan.spans); } // Over the loudness: the lift lowered by the excess (three times at most), the file made again. for (let i = 0; i < 3 && fin(cur.lufs) && fin(baseLufs) && cur.lufs - baseLufs > YELL_LUFS_MAX && plan.gain > YELL_GAIN[0]; i += 1) { plan.gain = Math.max(YELL_GAIN[0], Math.round((plan.gain - 1.6 * (cur.lufs - baseLufs - YELL_LUFS_MAX + 0.15)) * 10) / 10); cur = await remake(); lifted = fin(before) ? await spansRms(abs, plan.spans) : null; } plan.steps[0].params = { gain: plan.gain, style: plan.style, ...(fin(plan.trim) ? { trim: plan.trim } : {}) }; plan.lufs = { base: baseLufs, after: cur.lufs }; plan.lift = fin(before) && fin(lifted) ? Math.round((lifted - before) * 10) / 10 : null; return cur; }, }); return { plan, take, result }; } const capsLine = (c) => c.yell.map((x) => x.src).join(" "); const skipLine = (c) => c.skip.map((x) => `${x.src} (${x.why})`).join(", "); /** One item's dry-run row, pure: `{ id, yell, skip, needsWords, error? }`, or null for an item with no caps read. */ export function yellRow(e, slurs) { if (e?.type !== "post" || !isNarrated(e)) return null; const t = pickedTake(e); const caps = capsOfRead(e, t, slurs); if (!caps.yell.length && !caps.skip.length) return null; return { id: e.id, take: takeIdOf(t), yell: caps.yell.map((x) => x.src), skip: caps.skip.map((x) => ({ w: x.src, why: x.why })), needsWords: !!caps.yell.length && !caps.words, ...(caps.error ? { error: caps.error } : {}), spans: !caps.error && caps.yell.length ? yellSpans(t.words, caps.yell.map((x) => x.k)).length : 0 }; } /** `umtool posts reread

--yell-caps` (and each item of `posts yell`). */ export async function yellCommand(project, manifest, items, { gain = undefined, style = "raise", dryRun = false, json = false, out = (s) => console.log(s) } = {}) { const slurs = cutSlurs(manifest); const rows = []; for (const e of items) { if (dryRun) { const row = yellRow(e, slurs) ?? { id: e.id, yell: [], skip: [], needsWords: false }; rows.push(row); continue; } try { const r = await yellTake(project, e, { slurs, gain, style }); rows.push({ id: e.id, yell: r.plan.caps.yell.map((x) => x.src), skip: r.plan.caps.skip.map((x) => ({ w: x.src, why: x.why })), spans: r.plan.spans, gain: r.plan.gain, lift: r.plan.lift ?? null, lufs: r.plan.lufs ?? null, take: r.take.file, from: takeIdOf(r.plan.take), token: r.result?.token ?? null }); } catch (err) { if (items.length === 1 || !(err instanceof YellError || err instanceof RereadError)) throw err; rows.push({ id: e.id, error: err.message }); } } if (json) { out(JSON.stringify({ ok: true, dryRun, items: rows }, null, 2)); return 0; } for (const r of rows) { if (r.error && !r.yell?.length) out(`${r.id}: ${r.error}`); else if (dryRun) out(`${r.id}: ${r.yell.length ? `would yell ${r.yell.join(" ")}` : "nothing to yell"}${r.skip.length ? `; flat: ${r.skip.map((s) => `${s.w} (${s.why})`).join(", ")}` : ""}${r.needsWords ? " -- NEEDS WORD TIMINGS (posts narrate --words)" : r.error ? ` -- ${r.error}` : ""}`); else out(`${r.id}: yelled ${r.yell.join(" ")} (${r.spans.length} span(s), +${r.gain} dB asked${r.lift !== null && r.lift !== undefined ? `, +${r.lift} dB measured` : ""}${r.lufs ? `, ${r.lufs.base} → ${r.lufs.after} LUFS` : ""})${r.skip.length ? `; flat: ${r.skip.map((s) => `${s.w} (${s.why})`).join(", ")}` : ""}\n ${r.take} -- picked, from ${r.from} (one undo point: umtool timeline ${project.id} undo)`); } return 0; } /** `umtool posts yell

[--all | ]`. */ export async function yellBatchCommand(project, { ids = [], all = false, gain = undefined, style = "raise", dryRun = false, json = false, out = (s) => console.log(s) } = {}) { const manifest = await readManifest(project.dir); if (!manifest) throw new YellError(`${project.id} has no manifest`); const tl = (manifest.timeline ?? []).filter((x) => x?.type === "post"); let items; if (ids.length) { items = ids.map((ref) => tl.find((x) => x.id === ref || x.id === `p-${ref}` || String(x.post ?? "").split("/")[1] === ref) ?? (() => { throw new YellError(`no post item ${ref} in ${project.id}`); })()); } else if (all || dryRun) { // Every narrated item whose read has a caps word to yell (a dry run lists the ones it would skip too). const slurs = cutSlurs(manifest); items = tl.filter((e) => { const row = yellRow(e, slurs); return !!row && (dryRun || row.yell.length > 0); }); } else throw new YellError("name the items, or --all (every narrated item with a caps word); --dry-run lists them"); if (!items.length) { out(json ? JSON.stringify({ ok: true, dryRun, items: [] }) : "no narrated item reads a caps word"); return 0; } return yellCommand(project, manifest, items, { gain, style, dryRun, json, out }); } export { capsLine, skipLine };