// A CHANNEL THAT DOWNLOADS ONLY WHAT IT IS ASKED FOR (2026-10-29). // // `ChannelConfig.downloadMode: "manual"` (lib/channelConfig.ts). Neither of // the two older switches says it: `syncIntervalMinutes: 0` stops the listing // being read but leaves the download lane working the backlog it already has, // and a `paused` tier takes the channel off EVERY lane — transcription too. // Manual keeps the listing and the transcription and turns off only the paths // that turn "a video the channel lists but lacks" into a download: // // the download lane controller/autoRunner.ts, listChannelMeta // a sync's / sweep's new-upload walk ytdlp/runYtdlp.ts, syncPaged / syncFullSweep // the batch downloads download-from-playlist, download-missing, // retry-bucket (runYtdlp, and the editor's // runPipelineAction before it queues a job) // the report's work list controller/channelSnapshot.ts: undownloadedIds // is empty, the listed-but-absent ids are // `manualNotRequestedIds` // the Download station views/channelGroupSections.ts // // What a person asks for, one video at a time, is not gated: import-video, the // video page's download / persist buttons, persist-videos, clip windows, a // whole-recording fetch, transcribe-one. // // Client-safe: the Configure form and the rack read the sentence below. import type { ChannelConfig } from "./channelConfig"; // THE ONE PREDICATE. Absent (and "auto") is today's behaviour. export function channelDownloadsAreManual( config: Pick | null | undefined, ): boolean { return config?.downloadMode === "manual"; } // What the channel page, the rack and the form say, so a manual channel with a // long listing is not read as a stalled one. export const MANUAL_DOWNLOADS_TEXT = "Manual downloads — only videos you add are downloaded"; // The runYtdlp modes that download a channel's listed-but-absent videos as a // batch. A manual channel refuses them; `sync` is not here because a sync // still reads the listing — it only skips the download half. export const BATCH_DOWNLOAD_MODES = [ "download-from-playlist", "download-missing", "retry-bucket", ] as const; export function isBatchDownloadMode(mode: string): boolean { return (BATCH_DOWNLOAD_MODES as readonly string[]).includes(mode); } // The refusal a batch download gets on a manual channel, or null when it may // run. One sentence for the editor's notice, the job log and the ops answer. export function manualDownloadsRefusal( slug: string, config: Pick | null | undefined, mode: string, ): string | null { if (!channelDownloadsAreManual(config) || !isBatchDownloadMode(mode)) { return null; } return ( `"${slug}" is set to manual downloads: only videos you add are downloaded, ` + `so ${mode} does not run. Import a video (import-video, or the channel ` + `page's Import) to download it, or set Downloads to Automatic in Configure.` ); }