commit 4de99c54c9b007a916f83e70b1554cebcbb47334
parent 4738ceb46039f988aa00e96d06a1a1448b5b9e21
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 11 Nov 2026 09:46:03 -0500
local media: two review nits -- a bounded warn-once set, a guarded re-read
The warn-once set for invalid local_recording metadata is capped at 1000 ids;
the index's re-read of a local record's metadata turns a read or parse error
into its own skip reason instead of the generic per-record failure.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/common/controller/buildIndex.ts b/common/controller/buildIndex.ts
@@ -1113,7 +1113,9 @@ export async function buildIndex({
// from the metadata itself, since a fresh normalized summary does not
// carry it (lib/transcripts-server.ts, platformFromMetadata).
if (summary.platform === "local") {
- const problem = localRecordingProblem(JSON.parse(await readFile(s.metaPath, "utf8")));
+ const problem = await readFile(s.metaPath, "utf8")
+ .then((raw) => localRecordingProblem(JSON.parse(raw)))
+ .catch((e: unknown) => `unreadable metadata: ${(e as Error).message}`);
if (problem) {
log(`Skipping ${s.channelSlug}/${s.videoDir}: invalid local_recording metadata (${problem})`);
return;
diff --git a/common/lib/transcripts-server.ts b/common/lib/transcripts-server.ts
@@ -318,6 +318,8 @@ const warnedLocalRecordings = new Set<string>();
function warnInvalidLocalRecording(meta: RawMetadata, problem: string): void {
const key = typeof meta.id === "string" ? meta.id : JSON.stringify(meta.title ?? null);
if (warnedLocalRecordings.has(key)) return;
+ // Bounded: a long-lived server warns about at most this many ids.
+ if (warnedLocalRecordings.size >= 1000) return;
warnedLocalRecordings.add(key);
console.warn(`Invalid local_recording metadata for ${key}: ${problem}; the index skips it.`);
}