1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Add ability to filter requested runner jobs

This commit is contained in:
Chocobozzz 2024-10-31 10:22:35 +01:00
parent e0f39d7995
commit a91bd80087
No known key found for this signature in database
GPG key ID: 583A612D890159BE
9 changed files with 65 additions and 19 deletions

View file

@ -79,30 +79,30 @@ export class RunnerJobsCommand extends AbstractCommand {
...options,
path,
fields: pick(options, [ 'runnerToken' ]),
fields: pick(options, [ 'runnerToken', 'jobTypes' ]),
implicitToken: false,
defaultExpectedStatus: HttpStatusCode.OK_200
}))
}
async requestVOD (options: OverrideCommandOptions & RequestRunnerJobBody) {
const vodTypes = new Set<RunnerJobType>([ 'vod-audio-merge-transcoding', 'vod-hls-transcoding', 'vod-web-video-transcoding' ])
const { availableJobs } = await this.request({
...options,
const { availableJobs } = await this.request(options)
jobTypes: [ 'vod-audio-merge-transcoding', 'vod-hls-transcoding', 'vod-web-video-transcoding' ]
})
return {
availableJobs: availableJobs.filter(j => vodTypes.has(j.type))
} as RequestRunnerJobResult<RunnerJobVODPayload>
return { availableJobs } as RequestRunnerJobResult<RunnerJobVODPayload>
}
async requestLive (options: OverrideCommandOptions & RequestRunnerJobBody) {
const vodTypes = new Set<RunnerJobType>([ 'live-rtmp-hls-transcoding' ])
const { availableJobs } = await this.request({
...options,
const { availableJobs } = await this.request(options)
jobTypes: [ 'live-rtmp-hls-transcoding' ]
})
return {
availableJobs: availableJobs.filter(j => vodTypes.has(j.type))
} as RequestRunnerJobResult<RunnerJobLiveRTMPHLSTranscodingPayload>
return { availableJobs } as RequestRunnerJobResult<RunnerJobLiveRTMPHLSTranscodingPayload>
}
// ---------------------------------------------------------------------------