import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { getSettings } from "yt-dlp-transcript-common/lib/settings"; import { isGateHeld } from "yt-dlp-transcript-common/lib/pauseGates"; import { operationsForLane } from "yt-dlp-transcript-common/lib/operations"; import { loadSpeakersReadout } from "yt-dlp-transcript-common/controller/speakersReadout"; import { speakersReadoutLine } from "yt-dlp-transcript-common/lib/speakersReadout"; import { readRoute } from "../_read"; export const dynamic = "force-dynamic"; // GET /api/ops/speakers — `pnpm ops get speakers` // // The speakers readout, as the lane deck and /cleanup print it: `line` // ("waiting: X GB in N videos · freed this run: Y GB · about D days left"), // then the numbers it is made of — waiting (the audio held for the Speakers // lane that it WILL clear), neverClears (held there and never cleared by it), // freed this run (.speakers-run.json), the measured rate (seconds of engine per // audio-hour, from the sidecars' durationMs/audioSeconds), the audio-hours // left and the days at concurrency 1, voiceprinted and noFingerprintPossible // (diarized, the audio already gone) — and per channel, corpus disk first. // `lane` is the backfill lane's state: armed, held, the operations it // dispatches, its order, and the two capture settings. export async function GET(request: Request) { return readRoute(request, [], async () => { const settings = getSettings(); const readout = await loadSpeakersReadout(getPaths()); const policy = settings.autoQueue.backfill; return { line: speakersReadoutLine(readout), lane: { armed: policy.enabled, held: isGateHeld(settings, "backfill"), operations: operationsForLane("backfill", settings).map((o) => o.id), narrowedTo: policy.operations ?? null, order: policy.order ?? "listed", cleanAfterCapture: settings.diarization.cleanAfterCapture, requireVoiceprints: settings.diarization.requireVoiceprints, }, ...readout, }; }); }