commit 8fe8fb2ac3ebfd2c716c4f103532e97707467e36
parent a8ca390467291c22f559665284e9c590afa05ce7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 23 Oct 2026 13:04:26 -0400
Merge lane/pacing-guard: a per-file Transcribe of audio on disk runs now on the video's own queue
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/editor/app/channels/[slug]/videos/[id]/videoActions.ts b/editor/app/channels/[slug]/videos/[id]/videoActions.ts
@@ -68,6 +68,7 @@ import {
} from "yt-dlp-transcript-common/controller/transcribeOne";
import { findVideoSourceUrl } from "yt-dlp-transcript-common/controller/undownloadedVideos";
import { fullAudioFirst } from "yt-dlp-transcript-common/controller/fullAudioFirst";
+import { fullAudioGate } from "yt-dlp-transcript-common/lib/fullAudioFirst-server";
import {
loadSavedVideo,
unpersistSavedVideo,
@@ -142,6 +143,30 @@ function videoQueueKey(config: ChannelConfig, override: string | undefined): str
return resolveQueueKey(downloadQueueKey(config), override);
}
+// A per-file Transcribe's queue. The row's queue field defaults to "" (now),
+// which the network guard refuses for transcribe-one: it MAY ask a platform
+// first (a corrupt full source's owed stored-URL download). Audio on disk that
+// owes no download asks nothing, so "now" runs it at once on the video's own
+// queue -- never behind hours of the platform's downloads -- and one that owes
+// a download waits the channel's platform queue, which spaces its jobs.
+async function transcribeOneQueueKey(
+ slug: string,
+ videoId: string,
+ config: ChannelConfig,
+ override: string | undefined,
+ salvage: boolean | undefined,
+): Promise<string> {
+ if (override === undefined || override.trim() !== "") return videoQueueKey(config, override);
+ const owed =
+ salvage === undefined
+ ? await fullAudioGate(videoDirOf(slug, videoId), {
+ handling: config.handling,
+ ...(config.storedUrlDownloads ? { mode: config.storedUrlDownloads } : {}),
+ })
+ : null;
+ return owed && !owed.exhausted ? downloadQueueKey(config) : `transcribe-one:${slug}:${videoId}`;
+}
+
function videoDirOf(slug: string, videoId: string): string {
return path.join(getPaths().channelsDir, slug, "data", videoId);
}
@@ -220,7 +245,7 @@ export async function transcribeOneAction(
const videoDir = videoDirOf(slug, videoId);
return runManagedFunction({
kind: "transcribe-one",
- queueKey: videoQueueKey(r.config, queueKey),
+ queueKey: await transcribeOneQueueKey(slug, videoId, r.config, queueKey, salvage),
paths,
channelSlug: slug,
videoId,