Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

recap/bin/build-filter.mjs: restore missing path imports (ROOT/REPO)

+13 -2
+13 -2
recap/bin/build-filter.mjs
··· 15 15 // 16 16 // Usage: node bin/build-filter.mjs <totalSec> (writes graph to stdout) 17 17 18 + import { resolve, dirname } from "node:path"; 19 + import { fileURLToPath } from "node:url"; 20 + 21 + const HERE = dirname(fileURLToPath(import.meta.url)); 22 + const ROOT = resolve(HERE, ".."); 23 + const REPO = resolve(ROOT, ".."); 18 24 const TOTAL = process.argv[2]; 19 25 if (!TOTAL) { 20 26 console.error("usage: build-filter.mjs <totalSec>"); ··· 37 43 // codec dance. fontsdir picks up the YWFT face shipped in the repo so 38 44 // the .ass `Style: YWFTProcessing` resolves. The .ass path is escaped 39 45 // for ffmpeg's filter parser (`:` and `\` need it inside subtitles=...). 40 - const ASS = `${ROOT}/out/subs.ass`.replace(/:/g, "\\:").replace(/\\/g, "/"); 41 - const FONTSDIR = `${REPO}/system/public/type/webfonts`.replace(/:/g, "\\:"); 46 + // Inside ffmpeg's `filter_complex_script`, the `subtitles=` argument 47 + // uses `:` as a filter-arg separator. Path colons must be escaped with 48 + // `\:`. Backslashes don't appear in Linux paths so we don't worry about 49 + // those. Single-quote the values for safety. 50 + const escFilter = (p) => p.replace(/:/g, "\\:"); 51 + const ASS = escFilter(`${ROOT}/out/subs.ass`); 52 + const FONTSDIR = escFilter(`${REPO}/system/public/type/webfonts`); 42 53 lines.push(`[v0]subtitles='${ASS}':fontsdir='${FONTSDIR}'[final]`); 43 54 44 55 process.stdout.write(lines.join(";\n") + "\n");