// WHEN THE AUDIO CHECK APPLIES — one rule for every download path. // // The audio check (CHANNEL.md `audioCheck`; ytdlp/audioCheckedDownload.ts) exists // because some sources intermittently serve corrupt audio mid-download. For a // platform known to do that (AUDIO_CHECK_PLATFORMS: Odysee), it is ON by default: // a channel turns it off only by saying `audioCheck: {enabled: false}`. Anywhere // else it is the channel's opt-in, as before. // // Read by the full download (downloadOneManaged: the audio-checked downloader, on a // transcribe-handling channel) and by a clip window (fetchWindowManaged: the // pipeline's final probe on the fetched window, any handling). import type { ChannelConfig } from "./channelConfig"; import { detectPlatform } from "./platform"; export const AUDIO_CHECK_PLATFORMS: readonly string[] = ["odysee"]; export function audioCheckApplies( config: Pick, videoUrl: string | null | undefined, ): boolean { if (config.audioCheck?.enabled === true) return true; if (config.audioCheck?.enabled === false) return false; const platform = videoUrl ? detectPlatform(videoUrl) : null; return platform !== null && AUDIO_CHECK_PLATFORMS.includes(platform); }