From ad5db1044c8599eaaaa2a578b350777ae996b068 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Nov 2021 14:35:08 +0100 Subject: Add ability to run transcoding jobs --- shared/extra-utils/server/jobs-command.ts | 15 +++++++++++++++ shared/extra-utils/videos/videos-command.ts | 21 ++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) (limited to 'shared/extra-utils') diff --git a/shared/extra-utils/server/jobs-command.ts b/shared/extra-utils/server/jobs-command.ts index f28397816..6636e7e4d 100644 --- a/shared/extra-utils/server/jobs-command.ts +++ b/shared/extra-utils/server/jobs-command.ts @@ -36,6 +36,21 @@ export class JobsCommand extends AbstractCommand { }) } + listFailed (options: OverrideCommandOptions & { + jobType?: JobType + }) { + const path = this.buildJobsUrl('failed') + + return this.getRequestBody>({ + ...options, + + path, + query: { start: 0, count: 50 }, + implicitToken: true, + defaultExpectedStatus: HttpStatusCode.OK_200 + }) + } + private buildJobsUrl (state?: JobState) { let path = '/api/v1/jobs' diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts index 13a7d0e1c..7ec9c3647 100644 --- a/shared/extra-utils/videos/videos-command.ts +++ b/shared/extra-utils/videos/videos-command.ts @@ -18,7 +18,8 @@ import { VideoDetails, VideoFileMetadata, VideoPrivacy, - VideosCommonQuery + VideosCommonQuery, + VideoTranscodingCreate } from '@shared/models' import { buildAbsoluteFixturePath, wait } from '../miscs' import { unwrapBody } from '../requests' @@ -630,6 +631,24 @@ export class VideosCommand extends AbstractCommand { }) } + runTranscoding (options: OverrideCommandOptions & { + videoId: number | string + transcodingType: 'hls' | 'webtorrent' + }) { + const path = '/api/v1/videos/' + options.videoId + '/transcoding' + + const fields: VideoTranscodingCreate = pick(options, [ 'transcodingType' ]) + + return this.postBodyRequest({ + ...options, + + path, + fields, + implicitToken: true, + defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 + }) + } + // --------------------------------------------------------------------------- private buildListQuery (options: VideosCommonQuery) { -- cgit v1.2.3