// A PROJECT's REDACTION (umtool-report-to-video/post-redact.mjs): the corpus's // terms, its channels' post markup and the project's own `render.posts.redact`, // read from the channels tree the project's clip bench reads. What a take's // synthesized read, Play's "As published" and the post item route blank -- // and, for a read only, the project's pronunciation lexicon (`say`). import { readPostRedaction } from "umtool-report-to-video/post-redact-files"; import { channelsDirFor, hasShadowChannels } from "../projects/report.mjs"; import { readLexicon } from "./postSay.mjs"; /** * @param {string} dir the project's folder * @param {Record} manifest * @param {{ uncensored?: boolean, say?: boolean }} [o] the slur filter off (post-slurs.mjs), the redaction kept; `say: false` * leaves the lexicon out (a view of the card, which never reads it) */ export async function projectRedaction(dir, manifest, { uncensored = false, say: withSay = true } = {}) { const channelsDir = channelsDirFor(dir, manifest, { shadowExists: await hasShadowChannels(dir) }); const red = await readPostRedaction(channelsDir, manifest, { uncensored }); // The project's pronunciation lexicon (postSay.mjs): what spokenRead says in a word's place -- a read's only. const say = withSay ? await readLexicon(dir) : []; // A read's only: the video's ANONYMOUS HANDLES (post-anon.mjs anonymousHandles), said as their shown names. This // video's characters unread, or an anonymity that cannot be resolved, REFUSES the read (never the real handle said). const anon = withSay ? await readAnonymous(dir, manifest) : null; return say.length || anon ? { ...red, ...(say.length ? { say } : {}), ...(anon ? { anon } : {}) } : red; } /** The video's anonymous handles for a read: `{ : }`, or null with none. Throws when they cannot be known. */ export async function readAnonymous(dir, manifest) { const { readProjectCharacters } = await import("./castStore.mjs"); const { anonymousHandles } = await import("umtool-report-to-video/post-anon"); const read = await readProjectCharacters(dir); if (read.error) throw new Error(`this video's characters are not read (${read.error}): an anonymous author's handle could be said aloud -- fix narration/characters.json first`); const set = anonymousHandles(read.doc, manifest); // The set itself: its `postIds` too, so a status URL of an anonymous author's post is collapsed in a read. return set.size ? set : null; }