mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 09:49:20 +02:00
Feature for runners - handle storyboard-generation-job (#7191)
* Implement processing storyboards by runners * Fixed storyboard generation by runners * use common code patterns * fix import * improve debug logging for storyboard generation * config option for storyboard processing with remote-runners * refactor repetitive pattern * refactor storyboard related code to share common utlities * Fix test * Fix storyboard generation config logic * Improve logging * Added tests for storyboard generation with runners * Refactor PR --------- Co-authored-by: ilfarpro <ilfarpro@ya.ru> Co-authored-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
parent
e74bf8ae2a
commit
dd52e8b89e
50 changed files with 973 additions and 248 deletions
|
@ -4,6 +4,7 @@ import {
|
|||
AcceptRunnerJobBody,
|
||||
AcceptRunnerJobResult,
|
||||
ErrorRunnerJobBody,
|
||||
GenerateStoryboardSuccess,
|
||||
HttpStatusCode,
|
||||
ListRunnerJobsQuery,
|
||||
RequestRunnerJobBody,
|
||||
|
@ -11,6 +12,7 @@ import {
|
|||
ResultList,
|
||||
RunnerJobAdmin,
|
||||
RunnerJobCustomUpload,
|
||||
RunnerJobGenerateStoryboardPayload,
|
||||
RunnerJobLiveRTMPHLSTranscodingPayload,
|
||||
RunnerJobPayload,
|
||||
RunnerJobState,
|
||||
|
@ -26,6 +28,7 @@ import {
|
|||
TranscriptionSuccess,
|
||||
VODHLSTranscodingSuccess,
|
||||
VODWebVideoTranscodingSuccess,
|
||||
isGenerateStoryboardSuccess,
|
||||
isHLSTranscodingPayloadSuccess,
|
||||
isLiveRTMPHLSTranscodingUpdatePayload,
|
||||
isTranscriptionPayloadSuccess,
|
||||
|
@ -265,6 +268,22 @@ export class RunnerJobsCommand extends AbstractCommand {
|
|||
payloadWithoutFiles = omit(payloadWithoutFiles as TranscriptionSuccess, [ 'vttFile' ])
|
||||
}
|
||||
|
||||
// Generate storyboard success payload contains a storyboard image file
|
||||
if (isGenerateStoryboardSuccess(payload) && payload.storyboardFile) {
|
||||
const reqPayload = options.reqPayload as RunnerJobGenerateStoryboardPayload
|
||||
|
||||
this.updateUploadPayloads({
|
||||
attachesStore: attaches,
|
||||
customUploadsStore: customUploads,
|
||||
|
||||
file: payload.storyboardFile,
|
||||
attachName: 'storyboardFile',
|
||||
customUpload: reqPayload?.output?.storyboardFileCustomUpload
|
||||
})
|
||||
|
||||
payloadWithoutFiles = omit(payloadWithoutFiles as GenerateStoryboardSuccess, [ 'storyboardFile' ])
|
||||
}
|
||||
|
||||
return this.uploadRunnerJobRequest({
|
||||
...options,
|
||||
|
||||
|
@ -367,12 +386,17 @@ export class RunnerJobsCommand extends AbstractCommand {
|
|||
|
||||
if (!jobUUID) {
|
||||
const { availableJobs } = await this.request({ runnerToken })
|
||||
jobUUID = availableJobs[0].uuid
|
||||
// Find a web video transcoding job specifically
|
||||
const webVideoJob = availableJobs.find(j => j.type === 'vod-web-video-transcoding')
|
||||
if (!webVideoJob) throw new Error('No web video transcoding jobs available')
|
||||
|
||||
jobUUID = webVideoJob.uuid
|
||||
}
|
||||
|
||||
const { job } = await this.accept({ runnerToken, jobUUID })
|
||||
const jobToken = job.jobToken
|
||||
|
||||
// Use a proper fixture file path for testing
|
||||
const payload: RunnerJobSuccessPayload = { videoFile: 'video_short.mp4' }
|
||||
await this.success({ runnerToken, jobUUID, jobToken, payload, reqPayload: undefined })
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue