From 89aa3331106874266f6feeee7bff852da2c1727e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 28 Jul 2023 11:07:03 +0200 Subject: Add ability to force transcoding --- shared/models/server/server-error-code.enum.ts | 4 +++- shared/models/videos/transcoding/video-transcoding-create.model.ts | 2 ++ shared/server-commands/videos/videos-command.ts | 7 ++----- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'shared') diff --git a/shared/models/server/server-error-code.enum.ts b/shared/models/server/server-error-code.enum.ts index 77d1e1d3f..583e8245f 100644 --- a/shared/models/server/server-error-code.enum.ts +++ b/shared/models/server/server-error-code.enum.ts @@ -52,7 +52,9 @@ export const enum ServerErrorCode { UNKNOWN_RUNNER_TOKEN = 'unknown_runner_token', VIDEO_REQUIRES_PASSWORD = 'video_requires_password', - INCORRECT_VIDEO_PASSWORD = 'incorrect_video_password' + INCORRECT_VIDEO_PASSWORD = 'incorrect_video_password', + + VIDEO_ALREADY_BEING_TRANSCODED = 'video_already_being_transcoded' } /** diff --git a/shared/models/videos/transcoding/video-transcoding-create.model.ts b/shared/models/videos/transcoding/video-transcoding-create.model.ts index c6e756a0a..6c2dbefa6 100644 --- a/shared/models/videos/transcoding/video-transcoding-create.model.ts +++ b/shared/models/videos/transcoding/video-transcoding-create.model.ts @@ -1,3 +1,5 @@ export interface VideoTranscodingCreate { transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7 + + forceTranscoding?: boolean // Default false } diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts index a58f1c545..4c3513ed4 100644 --- a/shared/server-commands/videos/videos-command.ts +++ b/shared/server-commands/videos/videos-command.ts @@ -775,19 +775,16 @@ export class VideosCommand extends AbstractCommand { }) } - runTranscoding (options: OverrideCommandOptions & { + runTranscoding (options: OverrideCommandOptions & VideoTranscodingCreate & { videoId: number | string - transcodingType: 'hls' | 'webtorrent' | 'web-video' }) { const path = '/api/v1/videos/' + options.videoId + '/transcoding' - const fields: VideoTranscodingCreate = pick(options, [ 'transcodingType' ]) - return this.postBodyRequest({ ...options, path, - fields, + fields: pick(options, [ 'transcodingType', 'forceTranscoding' ]), implicitToken: true, defaultExpectedStatus: HttpStatusCode.NO_CONTENT_204 }) -- cgit v1.2.3