Archilyzer · Source

archilyzer

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

commit cdb2c0a345a65a809e0aa9b21aaa9d664ab4192e
parent 7980ea1ae4ccfd170608dbfc821668ed7808de02
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sun, 25 Oct 2026 00:58:52 -0400

Transcribe hand-off: tests, ops help, COMMANDS.md, changelog

- ops transcribe-one route test: a whisper-video frees platform:youtube once its
  download is done (a download queued behind it runs while the handed-off
  transcription waits for a paused worker pool); audio on disk lands on
  transcribe-one:<slug>:<id> with "file" or without; captions listed + no audio
  is redirected to the caption download, captions on disk refused, asr: true
  transcribes.
- jobs/handOff.ts unit test; `pnpm ops --wait` follows a handedOffTo.
- An English caption track on disk refuses an ASR ask without asr: true even
  when the metadata no longer lists it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
MCOMMANDS.md | 2+-
Acommon/jobs/handOff.test.ts | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/CHANGELOG.md | 1+
Aeditor/app/api/ops/transcribe-one/route.test.ts | 193+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/app/channels/[slug]/videos/[id]/videoActions.ts | 19++++++++++---------
Mscripts/archilyzer-ops.mjs | 11++++++++++-
6 files changed, 290 insertions(+), 11 deletions(-)

diff --git a/COMMANDS.md b/COMMANDS.md @@ -156,7 +156,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `dismiss-service` | — | | | `rerun-service-jobs` | — | | | `workers` | workers switches transcription workers as /workers does: {"op": "enable" \| "disable" \| "drain", "ids": \[...\]} — the live pool; a restart restores the launch default. An unknown id is named; the others still apply. | `pnpm ops workers --json '{"op":"disable","ids":["parakeet-cpu"]}'` | -| `transcribe-one` | transcribe-one transcribes one video: {"slug", "id", "file"?}. With "file" (an audio file in its dir) that file; without, the video page's Transcribe — the audio on disk, or downloaded first through the channel's managed path. A job; --wait follows it. "salvage": true decodes a damaged file with error tolerance and transcribes what decodes, on the recording's clock, its gaps recorded (the transcript is listed as salvaged); a corrupt-full-source video is salvaged unless "salvage": false — once its full audio was tried: when its record stores an Odysee media URL, that URL is downloaded first, up to 2 times (20 min apart), and the salvage follows only if neither download is clean. "storedUrl": "only" \| "fallback" \| "never" downloads missing audio from the media URL the record stores (Odysee's CDN), read in ranges as its player reads it — no page request with "only", the page first with "fallback" — through the audio check; one new file per platform per 20 min. Absent = the channel's storedUrlDownloads. "whilePaused": true runs this one transcription during a pause-all on a worker the pause alone switched off; the pause stays on (the video page's "Transcribe now (workers paused)"). | | +| `transcribe-one` | transcribe-one transcribes one video: {"slug", "id", "file"?}. With "file" (an audio file in its dir) that file; without, the video page's Transcribe — the audio on disk, or downloaded first through the channel's managed path. Only a download waits on the platform's queue: the transcription runs as a transcribe-one job on the video's own queue (transcribe-one:&lt;slug&gt;:&lt;id&gt;), at once when nothing is downloaded, else handed off by the whisper-video once the audio is down. A job; --wait follows it through the hand-off to the end of the transcription. "queueKey" names another queue. A youtube-handling video with no audio whose metadata lists English captions has those fetched instead ({"instead": "captions", "message"}, the job the caption download), one with an English caption track on disk is refused; "asr": true transcribes it anyway (no "file"). "salvage": true decodes a damaged file with error tolerance and transcribes what decodes, on the recording's clock, its gaps recorded (the transcript is listed as salvaged); a corrupt-full-source video is salvaged unless "salvage": false — once its full audio was tried: when its record stores an Odysee media URL, that URL is downloaded first, up to 2 times (20 min apart), and the salvage follows only if neither download is clean. "storedUrl": "only" \| "fallback" \| "never" downloads missing audio from the media URL the record stores (Odysee's CDN), read in ranges as its player reads it — no page request with "only", the page first with "fallback" — through the audio check; one new file per platform per 20 min. Absent = the channel's storedUrlDownloads. "whilePaused": true runs this one transcription during a pause-all on a worker the pause alone switched off; the pause stays on (the video page's "Transcribe now (workers paused)"). | | | `delete-file` | delete-file deletes one file of one video, as its Files list does: {"slug", "id", "file"}. A tiered media file goes with its bytes on the media drive (never a bare link); refused while that drive is not answering. No undo. | | | `do-not-clean` | do-not-clean sets one video's "Do not clean" marker: {"slug", "id", "keep"?: true}; "keep": false removes it. (keep-videos is the bulk form.) | | | `cleanup` | cleanup runs one of a channel's cleanup sweeps as a job: {"slug", "sweep": "transcribed" (audio of transcribed videos — the /cleanup total) \| "extra-formats" \| "wrong-format" \| "failed-transcriptions" (clears the list; deletes nothing)}. Do-not-clean videos are skipped; `get cleanup <slug>` says what each would reclaim. | `pnpm ops cleanup --json '{"slug":"x","sweep":"transcribed"}' --wait` | diff --git a/common/jobs/handOff.test.ts b/common/jobs/handOff.test.ts @@ -0,0 +1,75 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { handOffSlot, type StartedJob } from "./handOff"; +import type { JobDoneResult } from "./streamCommand"; + +// A started job whose log is `lines` and whose `done` settles when `finish` +// is called. +function fakeJob(jobId: string, lines: string[]) { + let finish!: (status: JobDoneResult["status"]) => void; + const done = new Promise<JobDoneResult>((res) => { + finish = (status) => res({ status, jobId }); + }); + let cancelled = false; + const stream = new ReadableStream<string>({ + start(c) { + for (const l of lines) c.enqueue(l); + c.close(); + }, + cancel() { + cancelled = true; + }, + }); + const job: StartedJob = { ok: true, jobId, stream, done }; + return { job, finish, wasCancelled: () => cancelled }; +} + +async function readAll(stream: ReadableStream<string>): Promise<string> { + const reader = stream.getReader(); + let out = ""; + for (;;) { + const { value, done } = await reader.read(); + if (done) return out; + out += value; + } +} + +test("the caller reads both jobs' logs as one, and done settles with the second", async () => { + const slot = handOffSlot(); + const parent = fakeJob("w1", ["downloading\n", "handed off\n"]); + const child = fakeJob("t1", ["Transcribe v done\n"]); + const wrapped = slot.wrap(parent.job); + assert.equal(wrapped.jobId, "w1"); + slot.set(child.job); + parent.finish("done"); + assert.equal(await readAll(wrapped.stream), "downloading\nhanded off\nTranscribe v done\n"); + let settled = false; + const d = wrapped.done.then((r) => { + settled = true; + return r; + }); + await new Promise((r) => setTimeout(r, 10)); + assert.equal(settled, false, "the download is done, the work is not"); + child.finish("failed"); + assert.deepEqual(await d, { status: "failed", jobId: "t1" }); +}); + +test("a first job that fails, or hands nothing off, is the whole answer", async () => { + const slot = handOffSlot(); + const parent = fakeJob("w2", ["no url\n"]); + const wrapped = slot.wrap(parent.job); + parent.finish("failed"); + assert.equal(await readAll(wrapped.stream), "no url\n"); + assert.deepEqual(await wrapped.done, { status: "failed", jobId: "w2" }); +}); + +test("a consumer that goes away cancels the second stream too, even before it exists", async () => { + const slot = handOffSlot(); + const parent = fakeJob("w3", ["downloading\n"]); + const wrapped = slot.wrap(parent.job); + await wrapped.stream.cancel(); + assert.equal(parent.wasCancelled(), true); + const child = fakeJob("t3", ["long log\n"]); + slot.set(child.job); + assert.equal(child.wasCancelled(), true, "an unread transcription log is not buffered"); +}); diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **A Transcribe holds the platform's queue only while it downloads.** The video page's Audio + Whisper and `pnpm ops transcribe-one` used to keep YouTube's (or any platform's) download queue for the whole transcription, so nothing else downloaded on that platform while it waited for a worker and transcribed. Now the audio download runs on the platform's queue and the transcription runs as its own job on the video's queue (`transcribe-one:<slug>:<id>`); with the audio already on disk it starts there at once. The run panel and `pnpm ops … --wait` follow both jobs to the end of the transcription, and the first job's log names the second. `pnpm ops transcribe-one` with `"file"` now runs on the video's own queue unless a download is owed, takes `"queueKey"`, and for a YouTube video whose captions are listed and that has no audio fetches the captions instead (says so, and refuses when the captions are already on disk) unless `"asr": true` is passed. Needs a restart of the editor. - **A report video can set a subject's own claims against the record on its timeline.** A count claim (`“less than ten” in a year`) draws a band over the dates it is about on the on-screen panel's timeline, dims the rest of the timeline, lights each clip that carries the counter's stamps in date order with its count under it, and counts up to the total under his words in the panel (`19 seizures on camera`). With a **per** (a day, a week, a month) it lights every span that holds that many or more instead (`12 in a day`, `4 in a week`). A goalpost (`“3–5 weeks”` → `“6–8 weeks”`) draws a hollow bracket over the dates each deadline implies; when he moves it, the old one stays dashed and a copy of it moves to the new dates, off the timeline's end with the dates written when they are past its last clip. The finale's large timeline shows every claim at the end. A stamp can be dated by the day the event happened rather than the clip's day (**happened** in the clip editor's Marks). In umtool: the On-screen section's **claim checks** (beside the markers), with **use the playhead** and the build's own checks shown as each field is typed. From a terminal: `umtool look <project> deck.claims='[…]'` and `umtool set <project> <clip> claim.eventDate=2026-09-22`. When the record does not contradict a claim the build prints a note. A video without claims builds exactly as before. Needs a restart of umtool and a rebuild of the video. - **umtool plays a whole report video, or one take of it, in the browser without rendering it, and takes timecoded notes as it plays.** The Cut tab's **Play the cut** (and **Play** beside each take on the takes page) opens `/projects/<project>/play`: every clip plays in order from its fetched window, with the on-screen panel, the tally, the stamps, the markers and the finale drawn over it as the live preview draws them, on one clock across the whole cut, the next clip loaded behind the one playing. A take plays the project's video as it is now with the take's changes, including a take with its own clip list and one a recipe names that was never rendered; **Blurred clips: uncensored** on a take plays its clips as recorded. Under the picture, the **reel strip** shows the whole cut at once: a cell per clip or card as wide as it plays, shaded by the recording's date, hatched when its media is not fetched, the sections' boundaries with their first date, the counter (the tally) drawn as a staircase with its total at the end and at the playhead, and each note as a pin; click or drag on it to move through the cut. Under the strip, **Now** shows what the clip on screen says with the spoken line lit, and which clip comes next. Space plays and pauses, J K L go back, pause and play (L again is faster, at the voice's own pitch), ← and → move 5 seconds, N and P move between clips, [ and ] between notes, and ? lists the keys. A line under the picture lists what it does not do: each crossfade is a hard cut at its middle, cards and teasers are placeholders with their heading, edges are not snapped to silence, and the sound is the recording's. A clip with nothing fetched says "No media for this clip — fetch it" and the video plays on. M (or **Note at 09:44**) saves a note at that second of the cut, naming the clip on screen, its second in the recording, the take, and what it asks for (Trim, Cut, Move, Fact, Look or Other); playback pauses while you write and goes on when it is saved (**Pause while I write**). The notes list in cut order (open, all or resolved), a timecode plays from there, `umtool notes <project>` prints each with where it was taken and what it asks for, and **Send to the assistant** on a note (or **Send N open notes to the assistant**) asks the video assistant, whose reply lands on the note and whose edits wait for **Apply all**. With no assistant configured the button says why. Needs a restart of umtool. - **A download over a copy already saved keeps both, and flags them for a check.** An import, an attach or a live recording that was as long as a later download used to make that download be thrown away, so asking for a 720p copy of a stream already held as a 360p capture (`pnpm ops persist-videos` with `"format": "video_720"`) downloaded it and then discarded it. Now no copy is deleted. **Persist source video**, `persist-videos` and a whole-recording fetch make the download the copy everything uses; any other download keeps the saved copy in use unless it is longer. The other copy stays beside it in the saved-video store as `source-media.alt-<height>p-<date>.<ext>`, which no reader takes for the source, and the log says so: "Kept both copies: the download (720p, 4696.5 s) is now the active source; the landed one (360p, 4696.6 s) stays as source-media.alt-360p-20261023172312.mp4. Flagged for a check." A pinned video stays pinned, and `"replace": "above-height"` keeps the taller copy beside the new one rather than removing it. /saved-videos lists every video with two copies, with both copies' height, length and origin, and counts both in its sizes; `pnpm ops get saved-alternates [<slug>]` lists the same. The keep-latest prune leaves such a video alone. Needs a restart of the editor. diff --git a/editor/app/api/ops/transcribe-one/route.test.ts b/editor/app/api/ops/transcribe-one/route.test.ts @@ -0,0 +1,193 @@ +import test from "node:test"; +import assert from "node:assert/strict"; +import { mkdir, readFile, stat, writeFile } from "node:fs/promises"; +import path from "node:path"; +import { callPost, setupOpsCorpus } from "../_testCorpus"; + +// Run with: +// pnpm -C editor exec tsx --test "app/api/ops/transcribe-one/route.test.ts" +// +// `pnpm ops transcribe-one` against a temp corpus, the fake yt-dlp and the +// fake whisper (e2e/fixtures/bin) — nothing here asks a real platform: +// +// - the whisper-video HANDS OFF: once its audio download is done, the +// platform's queue is free — a download queued behind it runs while the +// transcription it handed off still waits for a worker; +// - with audio on disk the job is a transcribe-one on the video's own queue +// (`transcribe-one:<slug>:<id>`), "file" or not; +// - a youtube-handling video with English captions listed and no audio has +// its captions fetched instead; "asr": true transcribes it anyway. + +const corpus = await setupOpsCorpus(null); +const SLUG = "handoff-yt"; +await corpus.writeSettings({ minFreeDiskGB: 0, pacing: { jobGapSeconds: { youtube: 0, default: 0 } } }); +await corpus.writeChannelConfig(SLUG, { + handling: "youtube", + platform: "youtube", + url: "https://www.youtube.com/@handoff", + audioFormat: "mp3", +}); + +type Post = Parameters<typeof callPost>[0]; +const POST = (await import("./route")).POST as Post; +const { downloadVideoPipelineAction } = await import("../../../channels/[slug]/videos/[id]/videoActions"); +const { getRegistry } = await import("yt-dlp-transcript-common/jobs/registry"); +const { getWorkerPool } = await import("yt-dlp-transcript-common/jobs/workerPool"); +test.after(async () => { + getWorkerPool().resumeAll(); + await corpus.cleanup(); +}); + +const dataDir = (id: string) => path.join(corpus.transcripts, "channels", SLUG, "data", id); +const exists = (p: string) => stat(p).then(() => true, () => false); + +async function video(id: string, meta: Record<string, unknown> = {}, files: Record<string, string> = {}) { + const dir = dataDir(id); + await mkdir(dir, { recursive: true }); + await writeFile( + path.join(dir, "metadata.info.json"), + JSON.stringify({ id, title: id, webpage_url: `https://www.youtube.com/watch?v=${id}`, ...meta }), + ); + for (const [name, text] of Object.entries(files)) await writeFile(path.join(dir, name), text); +} + +const job = (id: string) => { + const r = getRegistry().get(id); + if (!r) throw new Error(`no job ${id} in the registry`); + return r; +}; + +async function until(what: string, ok: () => boolean | Promise<boolean>, ms = 30_000): Promise<void> { + const end = Date.now() + ms; + while (!(await ok())) { + if (Date.now() > end) throw new Error(`timed out waiting for ${what}`); + await new Promise((r) => setTimeout(r, 50)); + } +} + +const ended = (id: string) => ["done", "failed", "cancelled"].includes(job(id).status); +const logOf = (id: string) => readFile(job(id).logPath, "utf8").catch(() => ""); + +test("a whisper-video frees platform:youtube once its download is done; a download behind it runs while the transcription waits for a worker", async () => { + await video("handoffAAAA"); + await video("behindBBBBB"); + // The one GPU worker is busy elsewhere: the transcription parks on it. + getWorkerPool().pauseAll(); + try { + const res = await callPost(POST, { slug: SLUG, id: "handoffAAAA" }); + assert.equal(res.status, 200, JSON.stringify(res.body)); + const w = String(res.body.jobId); + assert.equal(job(w).kind, "whisper-video"); + assert.equal(job(w).queueKey, "platform:youtube"); + + // Queued behind it, on the same platform queue. + const d = await downloadVideoPipelineAction(SLUG, "behindBBBBB"); + if (!d.ok) throw new Error(d.error); + void d.stream.cancel(); + assert.equal(job(d.jobId).queueKey, "platform:youtube"); + + await until("the download behind it to end", () => ended(d.jobId)); + assert.equal(job(d.jobId).status, "done", await logOf(d.jobId)); + assert.equal(job(w).status, "done", await logOf(w)); + assert.ok(await exists(path.join(dataDir("handoffAAAA"), "audio.mp3")), "the audio is down"); + + // The transcription: its own job, on the video's own queue, still waiting. + const t = job(w).handedOffTo; + assert.ok(t, "the whisper-video names the job it handed off to"); + assert.equal(job(t).kind, "transcribe-one"); + assert.equal(job(t).queueKey, `transcribe-one:${SLUG}:handoffAAAA`); + assert.ok(!ended(t), `the transcription is still waiting for a worker (${job(t).status})`); + assert.ok(!(await exists(path.join(dataDir("handoffAAAA"), "transcript.json")))); + assert.match(await logOf(w), /Transcription handed off to transcribe-one job \S+ \(queue transcribe-one:handoff-yt:handoffAAAA\); platform:youtube is free/); + // The sidecar says it too, for a caller that reads it after the registry forgot. + const meta = JSON.parse(await readFile(path.join(corpus.transcripts, ".jobs", `${w}.meta.json`), "utf8")); + assert.equal(meta.handedOffTo, t); + // And researchRuns' jobOf (find-clips, research proposals) follows it. + const { jobOfPaths } = await import("yt-dlp-transcript-common/controller/researchRuns"); + const state = await jobOfPaths({ jobsDir: path.join(corpus.transcripts, ".jobs") })(w); + assert.deepEqual({ status: state?.status, via: state?.via }, { status: "running", via: t }); + + getWorkerPool().resumeAll(); + await until("the transcription to end", () => ended(t)); + assert.equal(job(t).status, "done", await logOf(t)); + assert.ok(await exists(path.join(dataDir("handoffAAAA"), "transcript.json"))); + } finally { + getWorkerPool().resumeAll(); + } +}); + +test("with audio on disk the job is a transcribe-one on the video's own queue, with \"file\" or without", async () => { + await video("ondiskCCCCC", {}, { "audio.mp3": "fake audio\n" }); + const withFile = await callPost(POST, { slug: SLUG, id: "ondiskCCCCC", file: "audio.mp3" }); + assert.equal(withFile.status, 200, JSON.stringify(withFile.body)); + const a = String(withFile.body.jobId); + assert.equal(job(a).kind, "transcribe-one"); + assert.equal(job(a).queueKey, `transcribe-one:${SLUG}:ondiskCCCCC`); + await until("the file's transcription", () => ended(a)); + assert.equal(job(a).status, "done", await logOf(a)); + + await video("ondiskDDDDD", {}, { "audio.mp3": "fake audio\n" }); + const without = await callPost(POST, { slug: SLUG, id: "ondiskDDDDD" }); + assert.equal(without.status, 200, JSON.stringify(without.body)); + const b = String(without.body.jobId); + assert.equal(job(b).kind, "transcribe-one", "no whisper-video: nothing to download"); + assert.equal(job(b).queueKey, `transcribe-one:${SLUG}:ondiskDDDDD`); + await until("the transcription", () => ended(b)); + assert.equal(job(b).status, "done", await logOf(b)); + assert.match(await logOf(b), /Audio already on disk for ondiskDDDDD; skipping download\./); + assert.ok(await exists(path.join(dataDir("ondiskDDDDD"), "transcript.json"))); + + // A named queue is the caller's. + await video("ondiskEEEEE", {}, { "audio.mp3": "fake audio\n" }); + const named = await callPost(POST, { slug: SLUG, id: "ondiskEEEEE", file: "audio.mp3", queueKey: "my-queue" }); + assert.equal(named.status, 200, JSON.stringify(named.body)); + assert.equal(job(String(named.body.jobId)).queueKey, "my-queue"); + await until("the named-queue transcription", () => ended(String(named.body.jobId))); +}); + +test("English captions listed and no audio: the captions are fetched instead; asr: true transcribes it anyway", async () => { + const captions = { automatic_captions: { en: [{ ext: "vtt", url: "https://example.invalid/en.vtt" }] } }; + await video("captionFFFF", captions); + const res = await callPost(POST, { slug: SLUG, id: "captionFFFF" }); + assert.equal(res.status, 200, JSON.stringify(res.body)); + assert.equal(res.body.instead, "captions"); + assert.equal( + res.body.message, + "captionFFFF has YouTube captions; fetching those instead — pass asr: true to transcribe it anyway.", + ); + const d = String(res.body.jobId); + assert.equal(job(d).kind, "download-one-pipeline"); + assert.equal(job(d).queueKey, "platform:youtube"); + await until("the caption download", () => ended(d)); + assert.equal(job(d).status, "done", await logOf(d)); + assert.match(await logOf(d), /^captionFFFF has YouTube captions; fetching those instead/); + assert.ok(await exists(path.join(dataDir("captionFFFF"), "transcript.en.vtt")), "the captions are on disk"); + assert.ok(!(await exists(path.join(dataDir("captionFFFF"), "audio.mp3"))), "no audio was fetched"); + + // Asked again with the captions on disk: refused, nothing queued. + const before = (await corpus.listJobIds()).length; + const again = await callPost(POST, { slug: SLUG, id: "captionFFFF" }); + assert.equal(again.status, 400); + assert.match(String(again.body.error), /captionFFFF already has YouTube captions on disk \(transcript\.en\.vtt\); pass asr: true/); + assert.equal((await corpus.listJobIds()).length, before); + + // asr: true: the audio, then the transcription. + await video("captionGGGG", captions); + const asr = await callPost(POST, { slug: SLUG, id: "captionGGGG", asr: true }); + assert.equal(asr.status, 200, JSON.stringify(asr.body)); + assert.equal(asr.body.instead, undefined); + const w = String(asr.body.jobId); + assert.equal(job(w).kind, "whisper-video"); + await until("the audio download", () => ended(w)); + assert.equal(job(w).status, "done", await logOf(w)); + const t = job(w).handedOffTo; + assert.ok(t); + await until("the transcription", () => ended(t)); + assert.equal(job(t).status, "done", await logOf(t)); + assert.ok(await exists(path.join(dataDir("captionGGGG"), "transcript.json"))); + + // "asr" is a boolean, checked at the door. + const bad = await callPost(POST, { slug: SLUG, id: "captionGGGG", asr: "yes" }); + assert.equal(bad.status, 400); + assert.match(String(bad.body.error), /"asr" must be a boolean/); +}); diff --git a/editor/app/channels/[slug]/videos/[id]/videoActions.ts b/editor/app/channels/[slug]/videos/[id]/videoActions.ts @@ -689,8 +689,9 @@ function namedTranscribeQueue(config: ChannelConfig, override: string | undefine // // CAPTIONS FIRST: a youtube-handling video with no audio on disk whose // metadata lists English captions (lib/listedCaptions-server.ts) has those -// fetched instead — the designated pipeline's caption download — unless `asr` -// is true; with an English caption track already on disk it is refused. +// fetched instead — the designated pipeline's caption download — and one +// with an English caption track already on disk is refused, unless `asr` is +// true. export async function whisperVideoAction( slug: string, videoId: string, @@ -724,15 +725,15 @@ export async function whisperVideoAction( const audioOnDisk = firstEntries.some(isRealAudioFile); if (!audioOnDisk && asr !== true && r.config.handling === "youtube") { + const onDisk = englishVttsByPreference(firstEntries); + if (onDisk.length > 0) { + return { + ok: false, + error: `${videoId} already has YouTube captions on disk (${onDisk[0]}); pass asr: true to transcribe it anyway.`, + }; + } const listed = (await readListedCaptionTracks(videoDir)) ?? []; if (listed.some(isEnglishCaptionTrack)) { - const onDisk = englishVttsByPreference(firstEntries); - if (onDisk.length > 0) { - return { - ok: false, - error: `${videoId} already has YouTube captions on disk (${onDisk[0]}); pass asr: true to transcribe it anyway.`, - }; - } const message = `${videoId} has YouTube captions; fetching those instead — pass asr: true to transcribe it anyway.`; const dl = await queuePipelineDownload({ slug, diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs @@ -1088,7 +1088,16 @@ export function usage() { 'transcribe-one transcribes one video: {"slug", "id", "file"?}. With "file"', ' (an audio file in its dir) that file; without, the video page\'s', ' Transcribe — the audio on disk, or downloaded first through the channel\'s', - ' managed path. A job; --wait follows it. "salvage": true decodes a damaged', + ' managed path. Only a download waits on the platform\'s queue: the', + ' transcription runs as a transcribe-one job on the video\'s own queue', + ' (transcribe-one:<slug>:<id>), at once when nothing is downloaded, else', + ' handed off by the whisper-video once the audio is down. A job; --wait', + ' follows it through the hand-off to the end of the transcription.', + ' "queueKey" names another queue. A youtube-handling video with no audio', + ' whose metadata lists English captions has those fetched instead', + ' ({"instead": "captions", "message"}, the job the caption download), one', + ' with an English caption track on disk is refused; "asr": true', + ' transcribes it anyway (no "file"). "salvage": true decodes a damaged', ' file with error tolerance and transcribes what decodes, on the', ' recording\'s clock, its gaps recorded (the transcript is listed as', ' salvaged); a corrupt-full-source video is salvaged unless "salvage": false',