MCPcopy
hub / github.com/CapSoftware/Cap / adminReprocessVideo

Function adminReprocessVideo

apps/web/actions/admin/reprocess-video.ts:42–95  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

40}
41
42export async function adminReprocessVideo(input: string) {
43 await requireAdmin();
44 const videoId = parseVideoId(input);
45
46 const [video] = await db()
47 .select({
48 id: videos.id,
49 ownerId: videos.ownerId,
50 name: videos.name,
51 })
52 .from(videos)
53 .where(eq(videos.id, videoId));
54
55 if (!video) {
56 throw new Error("Video not found");
57 }
58
59 const resultKey = `${video.ownerId}/${video.id}/result.mp4`;
60 await db()
61 .insert(videoUploads)
62 .values({
63 videoId: video.id,
64 uploaded: 0,
65 total: 0,
66 mode: "singlepart",
67 phase: "processing",
68 processingProgress: 0,
69 processingMessage: "Queued admin reprocess...",
70 processingError: null,
71 rawFileKey: resultKey,
72 updatedAt: new Date(),
73 })
74 .onDuplicateKeyUpdate({
75 set: {
76 uploaded: 0,
77 total: 0,
78 mode: "singlepart",
79 phase: "processing",
80 processingProgress: 0,
81 processingMessage: "Queued admin reprocess...",
82 processingError: null,
83 rawFileKey: resultKey,
84 updatedAt: new Date(),
85 },
86 });
87
88 await start(adminReprocessVideoWorkflow, [{ videoId }]);
89
90 return {
91 videoId,
92 name: video.name,
93 shareUrl: `${serverEnv().WEB_URL}/s/${videoId}`,
94 };
95}

Callers 1

ReprocessVideoPanelFunction · 0.90

Calls 5

dbFunction · 0.90
startFunction · 0.90
serverEnvFunction · 0.90
parseVideoIdFunction · 0.85
requireAdminFunction · 0.70

Tested by

no test coverage detected