"use server"; // The video page's Find clips (release 36 lane A): the same chain as `pnpm ops // find-clips` (controller/findClips.ts), through the same deps // (api/ops/_findClips.ts). NOTHING BUT FUNCTIONS IS DECLARED HERE (a "use // server" file). import { enqueueFindClips } from "yt-dlp-transcript-common/controller/findClips"; import type { StreamActionResult } from "yt-dlp-transcript-common/jobs/streamCommand"; import { findClipsDeps } from "../../../../api/ops/_findClips"; export async function findClipsAction( slug: string, videoId: string, opts: { target?: number; segment?: string; whilePaused?: boolean } = {}, ): Promise { const out = await enqueueFindClips( { slug, id: videoId, ...(opts.target !== undefined ? { target: opts.target } : {}), ...(opts.segment ? { segment: opts.segment } : {}), ...(opts.whilePaused ? { whilePaused: true } : {}), }, findClipsDeps(slug, videoId), ); if (out.dryRun) return { ok: false, error: "a dry run starts no job" }; return out.result; }