MCPcopy Create free account
hub / github.com/CapSoftware/Cap / saveMetadataAndComplete

Function saveMetadataAndComplete

apps/web/workflows/process-video.ts:419–440  ·  view source on GitHub ↗
(
	videoId: string,
	metadata: { duration: number; width: number; height: number; fps: number },
)

Source from the content-addressed store, hash-verified

417}
418
419async function saveMetadataAndComplete(
420 videoId: string,
421 metadata: { duration: number; width: number; height: number; fps: number },
422): Promise<void> {
423 "use step";
424
425 const duration = getValidDuration(metadata.duration);
426
427 await db()
428 .update(videos)
429 .set({
430 width: metadata.width,
431 height: metadata.height,
432 fps: metadata.fps,
433 ...(duration === undefined ? {} : { duration }),
434 })
435 .where(eq(videos.id, videoId as Video.VideoId));
436
437 await db()
438 .delete(videoUploads)
439 .where(eq(videoUploads.videoId, videoId as Video.VideoId));
440}
441
442async function cleanupRawUpload(
443 videoId: string,

Callers 1

processVideoWorkflowFunction · 0.70

Calls 3

dbFunction · 0.90
updateMethod · 0.80
getValidDurationFunction · 0.70

Tested by

no test coverage detected