import { IMPORT_MEDIA_BODY_KEYS } from "yt-dlp-transcript-common/lib/mediaImport"; import { importMediaAction } from "../../../channels/[slug]/liveMediaActions"; import { jobResponse, ops, reqSlug } from "../_lib"; export const dynamic = "force-dynamic"; // POST { slug, path, url? | id? | meta?: {title, date?, duration?, description?}, // move?, replace?, audio?, transcribe?, doNotClean?, note?, dryRun? } // -> { ok: true, jobId } // // A FILE FROM OUTSIDE THE ARCHIVE MADE A NORMAL TRANSCRIBED ITEM // (controller/importMedia.ts; plans/live-capture.md): the record — `url` (one // metadata-only pass, under the id the archive keys the page by: Rumble's URL // id), `id` (a record already here) or `meta` (by hand) — then the landing // record-live shares: ffprobe (an unreadable file is refused), keep the longer // over a container already stored (`replace` lands it anyway), a `-c copy` // remux to mp4 when it is not a stored container already (never a re-encode), // the saved-video store, audio., the archive line, media-import.json. // `move` removes the original once the landed copy verifies. `transcribe` // queues a transcribe-one job (held by any pause). `doNotClean` sets the // video's marker with `note`. `dryRun` says what it would do and writes // nothing. A directory, a .zip or a .7z goes to attach-media's walk. export async function POST(request: Request) { return ops(request, IMPORT_MEDIA_BODY_KEYS, async (body) => { reqSlug(body, "slug"); return jobResponse(await importMediaAction(body)); }); }