import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { getSettings } from "yt-dlp-transcript-common/lib/settings"; import { COPIES_SCAN_BODY_KEYS, enqueueCopiesScan } from "yt-dlp-transcript-common/controller/copiesScan"; import { jobResponse, ops } from "../_lib"; export const dynamic = "force-dynamic"; // POST { group, dryRun? } -> { ok: true, jobId } // // The copies scan (lane cross-source-dupes, slice 1) as a `copies-scan` job // on its own queue: a source group's channels (settings.sourceGroups) paired // video by video — recorded dates at most `dateWindowDays` apart and runtimes // that agree, then the words where both copies have a cue file — into // `transcripts/copies/.json`, each pair confirmed (by text), metadata // only or partial, with its evidence. No media, no network. A scan that finds // what the file already says leaves it as it was. `dryRun: true` reads and // matches the same and writes nothing. Refused before any job for an unknown // group or one with fewer than two of its channels here. The log ends // `@@copies-scan {group, dryRun, unchanged, file?, channels, missing?, totals}`. // // AN ADAPTER: the refusals are the controller's (controller/copiesScan.ts). export async function POST(request: Request) { return ops(request, COPIES_SCAN_BODY_KEYS, async (body) => jobResponse(await enqueueCopiesScan(body, { paths: getPaths(), settings: getSettings() })), ); }