commit 3044db1d3738a9ef5762002b5421160bb4141040
parent b6495d18033650fa5c271fc7fed7efcdbc3cbdac
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 11 Nov 2026 03:03:56 -0500
cleanup: clean after capture holds the audio of whole-recording channels (clips.wholeRecordingPlatforms, Rumble by default) unless diarization.cleanWholeRecordingAudio (default false) -- that audio is the cue-clock source of the recording's time map
On those platforms the cues are the transcription of audio.<ext> and every
clip is cut from another file of the recording through a time map fitted
against that audio (common/lib/recordingClock.mjs). Deleting it as each video
is captured leaves those recordings with no map to make later. The default is
the safe one; the operator rules. SETTINGS.md says why. Test: a Rumble channel
held, then cleaned with the setting on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat:
5 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/SETTINGS.md b/SETTINGS.md
@@ -778,6 +778,7 @@ Speaker diarization captured right after transcription, while the audio is still
| `cleanAfterCapture` | `false` | Delete a video's audio as soon as the Speakers lane has captured it.<br><br>When ON, a diarization unit that finishes with a complete set of voice fingerprints (diarization.json `voiceprints`) is followed at once by the per-video half of Clean audio, with every one of its gates: a transcript.json, outside the keep-latest window, not marked do-not-clean, and the availability check (a video gone upstream is pinned, not deleted). The bytes freed are logged and counted in the speakers readout. OFF by default: nothing deletes audio until the operator says so. |
| `requireVoiceprints` | `true` | Hold a video's audio until its diarization.json carries voice fingerprints.<br><br>A fingerprint is the one part of a diarization that cannot be made again once the audio is gone, so with this ON (the default) Clean audio skips a diarized video whose sidecar has none, saying "awaiting voice fingerprint", and the Speakers lane adds them from the existing turns. Applies only while diarization is enabled, like the diarization guard itself. |
| `cleanVerdictMaxAgeHours` | `24` | How old the channel's last listing may be for clean-after-capture to trust it.<br><br>Clean after capture asks NOTHING of the network: it reads the channel's availability verdict (availability-verdict.json, written by the quick availability check) — a video named in a listing younger than this is cleaned, one not named is held (maybe missing). With no fresh listing the video is held and ONE quick check of the channel is queued on its platform's queue, at most once per this many hours, never while the platform is held. The manual Clean audio sweep keeps its own live check. |
+| `cleanWholeRecordingAudio` | `false` | Let clean-after-capture delete the audio of channels on `clips.wholeRecordingPlatforms` (Rumble by default).<br><br>OFF by default, and the reason is the recording clock: on those platforms the cues are the transcription of audio.<ext>, and every clip is cut from another file of the recording through a time map fitted against that audio (common/lib/recordingClock.mjs). Deleting it as each video is captured leaves those recordings with no map to make later. The manual Clean audio sweep is unaffected. |
Default:
@@ -798,7 +799,8 @@ Default:
"maxAudioHours": 0,
"cleanAfterCapture": false,
"requireVoiceprints": true,
- "cleanVerdictMaxAgeHours": 24
+ "cleanVerdictMaxAgeHours": 24,
+ "cleanWholeRecordingAudio": false
}
```
diff --git a/common/controller/cleanAfterCapture.test.ts b/common/controller/cleanAfterCapture.test.ts
@@ -328,6 +328,25 @@ test("no source URL: the automatic clean holds; the channel's opt-in lets it thr
assert.equal(await exists(path.join(b, "audio.mp3")), false);
});
+// ---- whole-recording platforms ------------------------------------------------
+
+test("a whole-recording channel (Rumble): clean after capture holds its audio — the recording clock's source — unless cleanWholeRecordingAudio", async () => {
+ await settings({}, { verifyAvailabilityBeforeClean: false });
+ const { paths, video } = await corpus();
+ await writeFile(
+ path.join(paths.channelsDir, "ch", "config.json"),
+ JSON.stringify({ handling: "transcribe", name: "ch", url: "https://rumble.com/c/ch" }),
+ );
+ const v = await video("v1", { diarization: "voiceprints" });
+ const held = await cleanAudioForVideo({ channelSlug: "ch", paths, videoId: "v1", onLog: () => {}, checkDeps: NO_NETWORK });
+ assert.deepEqual(held, { outcome: "held", gate: "whole-recording", removedFiles: 0, bytesFreed: 0 });
+ assert.equal(await exists(path.join(v, "audio.mp3")), true);
+ assert.equal(defaultSiteSettings().diarization.cleanWholeRecordingAudio, false);
+
+ await settings({ cleanWholeRecordingAudio: true }, { verifyAvailabilityBeforeClean: false });
+ assert.equal((await cleanAudioForVideo({ channelSlug: "ch", paths, videoId: "v1", onLog: () => {}, checkDeps: NO_NETWORK })).outcome, "cleaned");
+});
+
test.after(() => rm(ROOT, { recursive: true, force: true }));
test("concurrency stays 1: one diarization at a time, one backfill unit at a time", () => {
diff --git a/common/controller/cleanAudioFromTranscribed.ts b/common/controller/cleanAudioFromTranscribed.ts
@@ -1,5 +1,7 @@
import { removeMediaFile } from "../lib/mediaTier-server";
import { isPermanentlyGone } from "../lib/availability";
+import { detectPlatform } from "../lib/platform";
+import { DEFAULT_CLIPS_SETTINGS } from "../lib/clipSettings";
import { resolveEffectiveAvailability } from "../lib/availability-server";
import { loadDoNotClean, setDoNotClean } from "../lib/doNotClean-server";
import {
@@ -96,7 +98,12 @@ export type AudioCleanGate =
// cleanAudioForVideo only (review B2): the channel has no source URL, so no
// check can vouch for anything — held unless its config sets
// cleanAfterCaptureUnverified. The manual sweep cleans these as before.
- | "no-source-url";
+ | "no-source-url"
+ // cleanAudioForVideo only: a channel on clips.wholeRecordingPlatforms
+ // (Rumble by default), whose audio.<ext> is the cue-clock source of the
+ // recording's time map (lib/recordingClock.mjs) — held unless
+ // diarization.cleanWholeRecordingAudio.
+ | "whole-recording";
export async function audioCleanGate(
videoDir: string,
@@ -353,6 +360,17 @@ export async function cleanAudioForVideo({
return held(gate);
}
if (signal?.aborted) return held(gate);
+ // THE CUE CLOCK (review). On a whole-recording platform the cues are the
+ // transcription of audio.<ext>, and every clip is cut from another file of
+ // the recording through a time map fitted against THAT audio
+ // (common/lib/recordingClock.mjs). Deleting it systematically leaves those
+ // recordings with no map to make later. Held by default; the operator rules.
+ const platform = config?.platform ?? detectPlatform(config?.url ?? "") ?? "";
+ const whole = getSettings().clips?.wholeRecordingPlatforms ?? DEFAULT_CLIPS_SETTINGS.wholeRecordingPlatforms;
+ if (whole.includes(platform) && !diarization.cleanWholeRecordingAudio) {
+ log(`Kept ${videoId}'s audio: ${platform} records whole — its audio is the recording clock's source (diarization.cleanWholeRecordingAudio).`);
+ return held("whole-recording");
+ }
// NO SOURCE, NO CHECK (review B2). verifyBeforeClean fails OPEN for a channel
// with no URL — right for a sweep the operator pressed, wrong for an
// automatic delete: an imported or hand-built channel's audio may be its only
diff --git a/common/lib/settingsSchema.ts b/common/lib/settingsSchema.ts
@@ -336,6 +336,7 @@ export type DiarizationSettings = {
cleanAfterCapture: boolean;
requireVoiceprints: boolean;
cleanVerdictMaxAgeHours: number;
+ cleanWholeRecordingAudio: boolean;
};
export const DIARIZATION_SETTINGS_FIELD_DOCS: FieldDocs<DiarizationSettings> = {
@@ -467,6 +468,15 @@ export const DIARIZATION_SETTINGS_FIELD_DOCS: FieldDocs<DiarizationSettings> = {
"video is held and ONE quick check of the channel is queued on its " +
"platform's queue, at most once per this many hours, never while the " +
"platform is held. The manual Clean audio sweep keeps its own live check.",
+ cleanWholeRecordingAudio:
+ "Let clean-after-capture delete the audio of channels on " +
+ "`clips.wholeRecordingPlatforms` (Rumble by default).\n\n" +
+ "OFF by default, and the reason is the recording clock: on those " +
+ "platforms the cues are the transcription of audio.<ext>, and every clip " +
+ "is cut from another file of the recording through a time map fitted " +
+ "against that audio (common/lib/recordingClock.mjs). Deleting it as each " +
+ "video is captured leaves those recordings with no map to make later. " +
+ "The manual Clean audio sweep is unaffected.",
};
// Configuration for the derived-corpus digest layer. Local-first by decision:
@@ -1593,6 +1603,7 @@ export function defaultDiarization(): DiarizationSettings {
cleanAfterCapture: false,
requireVoiceprints: true,
cleanVerdictMaxAgeHours: 24,
+ cleanWholeRecordingAudio: false,
};
}
@@ -1644,6 +1655,7 @@ export function sanitizeDiarization(value: unknown): DiarizationSettings {
r.cleanVerdictMaxAgeHours > 0
? r.cleanVerdictMaxAgeHours
: d.cleanVerdictMaxAgeHours,
+ cleanWholeRecordingAudio: r.cleanWholeRecordingAudio === true,
};
}
diff --git a/settings.json.example b/settings.json.example
@@ -186,7 +186,8 @@
"maxAudioHours": 0,
"cleanAfterCapture": false,
"requireVoiceprints": true,
- "cleanVerdictMaxAgeHours": 24
+ "cleanVerdictMaxAgeHours": 24,
+ "cleanWholeRecordingAudio": false
},
"backfill": {
"concurrency": 1,