"use client"; import { useState } from "react"; import { StreamActionLog } from "yt-dlp-transcript-common/components/StreamActionLog"; import { DEFAULT_ARCHIVE_OPTIONS, type ArchiveBuildOptions, } from "yt-dlp-transcript-common/lib/archiveOptions"; import { QueueControl } from "../../components/QueueControl"; import { cancelJobAction } from "../../jobs/actions"; import { archiveCombinedLiveChatAction, archiveCombinedTranscriptsAction, archiveLiveChatAction, archiveTranscriptsAction, normalizeLiveChatAction, normalizeTranscriptsAction, } from "../lib/buildAction"; import { cancelPublishRunAction, updateIndexAction } from "../lib/publishActions"; import { ArchiveOptionsControl } from "./ArchiveOptionsControl"; type Props = { existingQueues: string[]; }; const DEFAULT_BUILD_QUEUE = "build"; export function BuildButtons({ existingQueues }: Props) { const [normalizeQueue, setNormalizeQueue] = useState(DEFAULT_BUILD_QUEUE); const [archiveQueue, setArchiveQueue] = useState(DEFAULT_BUILD_QUEUE); const [combinedQueue, setCombinedQueue] = useState(DEFAULT_BUILD_QUEUE); const [liveChatNormalizeQueue, setLiveChatNormalizeQueue] = useState( DEFAULT_BUILD_QUEUE, ); const [liveChatArchiveQueue, setLiveChatArchiveQueue] = useState( DEFAULT_BUILD_QUEUE, ); const [liveChatCombinedQueue, setLiveChatCombinedQueue] = useState( DEFAULT_BUILD_QUEUE, ); const [archiveOptions, setArchiveOptions] = useState( DEFAULT_ARCHIVE_OPTIONS, ); const [combinedOptions, setCombinedOptions] = useState( DEFAULT_ARCHIVE_OPTIONS, ); const [liveChatArchiveOptions, setLiveChatArchiveOptions] = useState(DEFAULT_ARCHIVE_OPTIONS); const [liveChatCombinedOptions, setLiveChatCombinedOptions] = useState(DEFAULT_ARCHIVE_OPTIONS); return (

Build index

The index update every site, the hub and the homepage are built from: the search index over transcripts/channels/, the stats datasets and the chart templates, in one child process on the publish queue. Cheap when nothing changed (each part short-circuits).

{/* No queue control: the index update is a publish stage, and the publish queue runs its stages one at a time. */} updateIndexAction()} cancelAction={cancelPublishRunAction} buttonLabel="Build index" runningLabel="Building index…" />

Normalize transcripts

Walks every video and writes{" "} transcript.cues.json next to each raw{" "} .vtt/.json. Idempotent — skips entries whose cues file is already up to date.

normalizeTranscriptsAction(normalizeQueue)} cancelAction={cancelJobAction} buttonLabel="Normalize transcripts" runningLabel="Normalizing transcripts…" extraControls={ } />

Build transcript archives

Produces one <channel>.{archiveOptions.format} per channel under transcripts/export/archives/, containing each video's compact transcript.cues.json plus a{" "} channel.json manifest. Normalizes missing cues on demand.

archiveTranscriptsAction(archiveOptions, archiveQueue)} cancelAction={cancelJobAction} buttonLabel="Build archives" runningLabel="Building archives…" extraControls={
} />

Build combined transcript archive

Produces a single{" "} all-transcripts.{combinedOptions.format} under{" "} transcripts/export/archives/ containing every channel plus a top-level manifest.json index. Normalizes missing cues on demand.

archiveCombinedTranscriptsAction(combinedOptions, combinedQueue) } cancelAction={cancelJobAction} buttonLabel="Build combined archive" runningLabel="Building combined archive…" extraControls={
} />

Normalize live chat

Walks every video and writes{" "} live_chat.cues.json next to each raw{" "} transcript.live_chat.json. Idempotent — skips entries whose cues file is already up to date.

normalizeLiveChatAction(liveChatNormalizeQueue)} cancelAction={cancelJobAction} buttonLabel="Normalize live chat" runningLabel="Normalizing live chat…" extraControls={ } />

Build live chat archives

Produces one <channel>.live_chat.{liveChatArchiveOptions.format} per channel under transcripts/export/archives/, containing each video's parsed{" "} live_chat.cues.json plus a{" "} channel.json manifest. Normalizes missing live chats on demand.

archiveLiveChatAction(liveChatArchiveOptions, liveChatArchiveQueue) } cancelAction={cancelJobAction} buttonLabel="Build live chat archives" runningLabel="Building live chat archives…" extraControls={
} />

Build combined live chat archive

Produces a single all-live-chat.{liveChatCombinedOptions.format} under{" "} transcripts/export/archives/ containing every channel's parsed live chats plus a top-level{" "} manifest.json index. Normalizes missing live chats on demand.

archiveCombinedLiveChatAction( liveChatCombinedOptions, liveChatCombinedQueue, ) } cancelAction={cancelJobAction} buttonLabel="Build combined live chat archive" runningLabel="Building combined live chat archive…" extraControls={
} />
); }