( videoId: string, userId: string, video: typeof videos.$inferSelect, )
| 399 | } |
| 400 | |
| 401 | async function cleanupTempAudio( |
| 402 | videoId: string, |
| 403 | userId: string, |
| 404 | video: typeof videos.$inferSelect, |
| 405 | ): Promise<void> { |
| 406 | "use step"; |
| 407 | |
| 408 | const audioKey = `${userId}/${videoId}/audio-temp.mp3`; |
| 409 | |
| 410 | try { |
| 411 | const [bucket] = await Storage.getAccessForVideo( |
| 412 | decodeStorageVideo(video), |
| 413 | ).pipe(runPromise); |
| 414 | |
| 415 | await bucket.deleteObject(audioKey).pipe(runPromise); |
| 416 | } catch (error) { |
| 417 | console.error( |
| 418 | `[transcribe] Failed to cleanup temp audio file: ${audioKey}`, |
| 419 | error, |
| 420 | ); |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | async function queueAiGeneration( |
| 425 | videoId: string, |
no test coverage detected