"use client"; import { useState } from "react"; import { StreamActionLog } from "yt-dlp-transcript-common/components/StreamActionLog"; import { AUDIO_FORMAT_VALUES, type AudioFormat, } from "yt-dlp-transcript-common/lib/channelConfig"; import { QueueControl } from "../../../../../../components/QueueControl"; import { cancelJobAction } from "../../../../../../jobs/actions"; import { transcodeAudioAction, } from "../../videoActions"; import { Heading } from "./Heading"; import { audioExt, type VideoFile } from "./videoFiles"; export function PerFileTranscodeRow({ slug, videoId, file, existingQueues, channelAudioFormat, }: { slug: string; videoId: string; file: VideoFile; existingQueues: string[]; channelAudioFormat?: AudioFormat; }) { const ext = audioExt(file.name); const transcodeTargets = AUDIO_FORMAT_VALUES.filter((f) => f !== ext); const preferredTarget = channelAudioFormat && transcodeTargets.includes(channelAudioFormat) ? channelAudioFormat : transcodeTargets[0] ?? "opus"; const [target, setTarget] = useState(preferredTarget); const [transcodeQueue, setTranscodeQueue] = useState(""); if (transcodeTargets.length === 0) return null; return (
transcodeAudioAction(slug, videoId, file.name, target, transcodeQueue) } cancelAction={cancelJobAction} buttonLabel={`Transcode ${file.name} → ${target}`} runningLabel="Transcoding…" label={`Transcode ${file.name} to ${target}`} extraControls={ } />
); }