diff options
author | Chocobozzz <me@florianbigard.com> | 2023-04-21 14:55:10 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2023-05-09 08:57:34 +0200 |
commit | 0c9668f77901e7540e2c7045eb0f2974a4842a69 (patch) | |
tree | 226d3dd1565b0bb56588897af3b8530e6216e96b /shared/models | |
parent | 6bcb854cdea8688a32240bc5719c7d139806e00b (diff) | |
download | PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.gz PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.zst PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.zip |
Implement remote runner jobs in server
Move ffmpeg functions to @shared
Diffstat (limited to 'shared/models')
29 files changed, 398 insertions, 11 deletions
diff --git a/shared/models/index.ts b/shared/models/index.ts index 439e9c8e1..78f6e73e3 100644 --- a/shared/models/index.ts +++ b/shared/models/index.ts | |||
@@ -11,6 +11,7 @@ export * from './moderation' | |||
11 | export * from './overviews' | 11 | export * from './overviews' |
12 | export * from './plugins' | 12 | export * from './plugins' |
13 | export * from './redundancy' | 13 | export * from './redundancy' |
14 | export * from './runners' | ||
14 | export * from './search' | 15 | export * from './search' |
15 | export * from './server' | 16 | export * from './server' |
16 | export * from './tokens' | 17 | export * from './tokens' |
diff --git a/shared/models/runners/abort-runner-job-body.model.ts b/shared/models/runners/abort-runner-job-body.model.ts new file mode 100644 index 000000000..0b9c46c91 --- /dev/null +++ b/shared/models/runners/abort-runner-job-body.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export interface AbortRunnerJobBody { | ||
2 | runnerToken: string | ||
3 | jobToken: string | ||
4 | |||
5 | reason: string | ||
6 | } | ||
diff --git a/shared/models/runners/accept-runner-job-body.model.ts b/shared/models/runners/accept-runner-job-body.model.ts new file mode 100644 index 000000000..cb266c4e6 --- /dev/null +++ b/shared/models/runners/accept-runner-job-body.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface AcceptRunnerJobBody { | ||
2 | runnerToken: string | ||
3 | } | ||
diff --git a/shared/models/runners/accept-runner-job-result.model.ts b/shared/models/runners/accept-runner-job-result.model.ts new file mode 100644 index 000000000..f2094b945 --- /dev/null +++ b/shared/models/runners/accept-runner-job-result.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | import { RunnerJobPayload } from './runner-job-payload.model' | ||
2 | import { RunnerJob } from './runner-job.model' | ||
3 | |||
4 | export interface AcceptRunnerJobResult <T extends RunnerJobPayload = RunnerJobPayload> { | ||
5 | job: RunnerJob<T> & { jobToken: string } | ||
6 | } | ||
diff --git a/shared/models/runners/error-runner-job-body.model.ts b/shared/models/runners/error-runner-job-body.model.ts new file mode 100644 index 000000000..ac8568409 --- /dev/null +++ b/shared/models/runners/error-runner-job-body.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export interface ErrorRunnerJobBody { | ||
2 | runnerToken: string | ||
3 | jobToken: string | ||
4 | |||
5 | message: string | ||
6 | } | ||
diff --git a/shared/models/runners/index.ts b/shared/models/runners/index.ts new file mode 100644 index 000000000..a52b82d2e --- /dev/null +++ b/shared/models/runners/index.ts | |||
@@ -0,0 +1,21 @@ | |||
1 | export * from './abort-runner-job-body.model' | ||
2 | export * from './accept-runner-job-body.model' | ||
3 | export * from './accept-runner-job-result.model' | ||
4 | export * from './error-runner-job-body.model' | ||
5 | export * from './list-runner-jobs-query.model' | ||
6 | export * from './list-runner-registration-tokens.model' | ||
7 | export * from './list-runners-query.model' | ||
8 | export * from './register-runner-body.model' | ||
9 | export * from './register-runner-result.model' | ||
10 | export * from './request-runner-job-body.model' | ||
11 | export * from './request-runner-job-result.model' | ||
12 | export * from './runner-job-payload.model' | ||
13 | export * from './runner-job-private-payload.model' | ||
14 | export * from './runner-job-state.model' | ||
15 | export * from './runner-job-success-body.model' | ||
16 | export * from './runner-job-type.type' | ||
17 | export * from './runner-job-update-body.model' | ||
18 | export * from './runner-job.model' | ||
19 | export * from './runner-registration-token' | ||
20 | export * from './runner.model' | ||
21 | export * from './unregister-runner-body.model' | ||
diff --git a/shared/models/runners/list-runner-jobs-query.model.ts b/shared/models/runners/list-runner-jobs-query.model.ts new file mode 100644 index 000000000..a5b62c55d --- /dev/null +++ b/shared/models/runners/list-runner-jobs-query.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export interface ListRunnerJobsQuery { | ||
2 | start?: number | ||
3 | count?: number | ||
4 | sort?: string | ||
5 | search?: string | ||
6 | } | ||
diff --git a/shared/models/runners/list-runner-registration-tokens.model.ts b/shared/models/runners/list-runner-registration-tokens.model.ts new file mode 100644 index 000000000..872e059cf --- /dev/null +++ b/shared/models/runners/list-runner-registration-tokens.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface ListRunnerRegistrationTokensQuery { | ||
2 | start?: number | ||
3 | count?: number | ||
4 | sort?: string | ||
5 | } | ||
diff --git a/shared/models/runners/list-runners-query.model.ts b/shared/models/runners/list-runners-query.model.ts new file mode 100644 index 000000000..d4362e4c5 --- /dev/null +++ b/shared/models/runners/list-runners-query.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface ListRunnersQuery { | ||
2 | start?: number | ||
3 | count?: number | ||
4 | sort?: string | ||
5 | } | ||
diff --git a/shared/models/runners/register-runner-body.model.ts b/shared/models/runners/register-runner-body.model.ts new file mode 100644 index 000000000..969bb35e1 --- /dev/null +++ b/shared/models/runners/register-runner-body.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export interface RegisterRunnerBody { | ||
2 | registrationToken: string | ||
3 | |||
4 | name: string | ||
5 | description?: string | ||
6 | } | ||
diff --git a/shared/models/runners/register-runner-result.model.ts b/shared/models/runners/register-runner-result.model.ts new file mode 100644 index 000000000..e31776c6a --- /dev/null +++ b/shared/models/runners/register-runner-result.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface RegisterRunnerResult { | ||
2 | id: number | ||
3 | runnerToken: string | ||
4 | } | ||
diff --git a/shared/models/runners/request-runner-job-body.model.ts b/shared/models/runners/request-runner-job-body.model.ts new file mode 100644 index 000000000..0970d9007 --- /dev/null +++ b/shared/models/runners/request-runner-job-body.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface RequestRunnerJobBody { | ||
2 | runnerToken: string | ||
3 | } | ||
diff --git a/shared/models/runners/request-runner-job-result.model.ts b/shared/models/runners/request-runner-job-result.model.ts new file mode 100644 index 000000000..98601c42c --- /dev/null +++ b/shared/models/runners/request-runner-job-result.model.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | import { RunnerJobPayload } from './runner-job-payload.model' | ||
2 | import { RunnerJobType } from './runner-job-type.type' | ||
3 | |||
4 | export interface RequestRunnerJobResult <P extends RunnerJobPayload = RunnerJobPayload> { | ||
5 | availableJobs: { | ||
6 | uuid: string | ||
7 | type: RunnerJobType | ||
8 | payload: P | ||
9 | }[] | ||
10 | } | ||
diff --git a/shared/models/runners/runner-job-payload.model.ts b/shared/models/runners/runner-job-payload.model.ts new file mode 100644 index 000000000..8f0c17135 --- /dev/null +++ b/shared/models/runners/runner-job-payload.model.ts | |||
@@ -0,0 +1,68 @@ | |||
1 | export type RunnerJobVODPayload = | ||
2 | RunnerJobVODWebVideoTranscodingPayload | | ||
3 | RunnerJobVODHLSTranscodingPayload | | ||
4 | RunnerJobVODAudioMergeTranscodingPayload | ||
5 | |||
6 | export type RunnerJobPayload = | ||
7 | RunnerJobVODPayload | | ||
8 | RunnerJobLiveRTMPHLSTranscodingPayload | ||
9 | |||
10 | // --------------------------------------------------------------------------- | ||
11 | |||
12 | export interface RunnerJobVODWebVideoTranscodingPayload { | ||
13 | input: { | ||
14 | videoFileUrl: string | ||
15 | } | ||
16 | |||
17 | output: { | ||
18 | resolution: number | ||
19 | fps: number | ||
20 | } | ||
21 | } | ||
22 | |||
23 | export interface RunnerJobVODHLSTranscodingPayload { | ||
24 | input: { | ||
25 | videoFileUrl: string | ||
26 | } | ||
27 | |||
28 | output: { | ||
29 | resolution: number | ||
30 | fps: number | ||
31 | } | ||
32 | } | ||
33 | |||
34 | export interface RunnerJobVODAudioMergeTranscodingPayload { | ||
35 | input: { | ||
36 | audioFileUrl: string | ||
37 | previewFileUrl: string | ||
38 | } | ||
39 | |||
40 | output: { | ||
41 | resolution: number | ||
42 | fps: number | ||
43 | } | ||
44 | } | ||
45 | |||
46 | // --------------------------------------------------------------------------- | ||
47 | |||
48 | export function isAudioMergeTranscodingPayload (payload: RunnerJobPayload): payload is RunnerJobVODAudioMergeTranscodingPayload { | ||
49 | return !!(payload as RunnerJobVODAudioMergeTranscodingPayload).input.audioFileUrl | ||
50 | } | ||
51 | |||
52 | // --------------------------------------------------------------------------- | ||
53 | |||
54 | export interface RunnerJobLiveRTMPHLSTranscodingPayload { | ||
55 | input: { | ||
56 | rtmpUrl: string | ||
57 | } | ||
58 | |||
59 | output: { | ||
60 | toTranscode: { | ||
61 | resolution: number | ||
62 | fps: number | ||
63 | }[] | ||
64 | |||
65 | segmentDuration: number | ||
66 | segmentListSize: number | ||
67 | } | ||
68 | } | ||
diff --git a/shared/models/runners/runner-job-private-payload.model.ts b/shared/models/runners/runner-job-private-payload.model.ts new file mode 100644 index 000000000..c1d8d1045 --- /dev/null +++ b/shared/models/runners/runner-job-private-payload.model.ts | |||
@@ -0,0 +1,34 @@ | |||
1 | export type RunnerJobVODPrivatePayload = | ||
2 | RunnerJobVODWebVideoTranscodingPrivatePayload | | ||
3 | RunnerJobVODAudioMergeTranscodingPrivatePayload | | ||
4 | RunnerJobVODHLSTranscodingPrivatePayload | ||
5 | |||
6 | export type RunnerJobPrivatePayload = | ||
7 | RunnerJobVODPrivatePayload | | ||
8 | RunnerJobLiveRTMPHLSTranscodingPrivatePayload | ||
9 | |||
10 | // --------------------------------------------------------------------------- | ||
11 | |||
12 | export interface RunnerJobVODWebVideoTranscodingPrivatePayload { | ||
13 | videoUUID: string | ||
14 | isNewVideo: boolean | ||
15 | } | ||
16 | |||
17 | export interface RunnerJobVODAudioMergeTranscodingPrivatePayload { | ||
18 | videoUUID: string | ||
19 | isNewVideo: boolean | ||
20 | } | ||
21 | |||
22 | export interface RunnerJobVODHLSTranscodingPrivatePayload { | ||
23 | videoUUID: string | ||
24 | isNewVideo: boolean | ||
25 | deleteWebVideoFiles: boolean | ||
26 | } | ||
27 | |||
28 | // --------------------------------------------------------------------------- | ||
29 | |||
30 | export interface RunnerJobLiveRTMPHLSTranscodingPrivatePayload { | ||
31 | videoUUID: string | ||
32 | masterPlaylistName: string | ||
33 | outputDirectory: string | ||
34 | } | ||
diff --git a/shared/models/runners/runner-job-state.model.ts b/shared/models/runners/runner-job-state.model.ts new file mode 100644 index 000000000..738db38b7 --- /dev/null +++ b/shared/models/runners/runner-job-state.model.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | export enum RunnerJobState { | ||
2 | PENDING = 1, | ||
3 | PROCESSING = 2, | ||
4 | COMPLETED = 3, | ||
5 | ERRORED = 4, | ||
6 | WAITING_FOR_PARENT_JOB = 5, | ||
7 | CANCELLED = 6, | ||
8 | PARENT_ERRORED = 7, | ||
9 | PARENT_CANCELLED = 8 | ||
10 | } | ||
diff --git a/shared/models/runners/runner-job-success-body.model.ts b/shared/models/runners/runner-job-success-body.model.ts new file mode 100644 index 000000000..223b7552d --- /dev/null +++ b/shared/models/runners/runner-job-success-body.model.ts | |||
@@ -0,0 +1,41 @@ | |||
1 | export interface RunnerJobSuccessBody { | ||
2 | runnerToken: string | ||
3 | jobToken: string | ||
4 | |||
5 | payload: RunnerJobSuccessPayload | ||
6 | } | ||
7 | |||
8 | // --------------------------------------------------------------------------- | ||
9 | |||
10 | export type RunnerJobSuccessPayload = | ||
11 | VODWebVideoTranscodingSuccess | | ||
12 | VODHLSTranscodingSuccess | | ||
13 | VODAudioMergeTranscodingSuccess | | ||
14 | LiveRTMPHLSTranscodingSuccess | ||
15 | |||
16 | export interface VODWebVideoTranscodingSuccess { | ||
17 | videoFile: Blob | string | ||
18 | } | ||
19 | |||
20 | export interface VODHLSTranscodingSuccess { | ||
21 | videoFile: Blob | string | ||
22 | resolutionPlaylistFile: Blob | string | ||
23 | } | ||
24 | |||
25 | export interface VODAudioMergeTranscodingSuccess { | ||
26 | videoFile: Blob | string | ||
27 | } | ||
28 | |||
29 | export interface LiveRTMPHLSTranscodingSuccess { | ||
30 | |||
31 | } | ||
32 | |||
33 | export function isWebVideoOrAudioMergeTranscodingPayloadSuccess ( | ||
34 | payload: RunnerJobSuccessPayload | ||
35 | ): payload is VODHLSTranscodingSuccess | VODAudioMergeTranscodingSuccess { | ||
36 | return !!(payload as VODHLSTranscodingSuccess | VODAudioMergeTranscodingSuccess)?.videoFile | ||
37 | } | ||
38 | |||
39 | export function isHLSTranscodingPayloadSuccess (payload: RunnerJobSuccessPayload): payload is VODHLSTranscodingSuccess { | ||
40 | return !!(payload as VODHLSTranscodingSuccess)?.resolutionPlaylistFile | ||
41 | } | ||
diff --git a/shared/models/runners/runner-job-type.type.ts b/shared/models/runners/runner-job-type.type.ts new file mode 100644 index 000000000..36d3b9b25 --- /dev/null +++ b/shared/models/runners/runner-job-type.type.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export type RunnerJobType = | ||
2 | 'vod-web-video-transcoding' | | ||
3 | 'vod-hls-transcoding' | | ||
4 | 'vod-audio-merge-transcoding' | | ||
5 | 'live-rtmp-hls-transcoding' | ||
diff --git a/shared/models/runners/runner-job-update-body.model.ts b/shared/models/runners/runner-job-update-body.model.ts new file mode 100644 index 000000000..ed94bbe63 --- /dev/null +++ b/shared/models/runners/runner-job-update-body.model.ts | |||
@@ -0,0 +1,28 @@ | |||
1 | export interface RunnerJobUpdateBody { | ||
2 | runnerToken: string | ||
3 | jobToken: string | ||
4 | |||
5 | progress?: number | ||
6 | payload?: RunnerJobUpdatePayload | ||
7 | } | ||
8 | |||
9 | // --------------------------------------------------------------------------- | ||
10 | |||
11 | export type RunnerJobUpdatePayload = LiveRTMPHLSTranscodingUpdatePayload | ||
12 | |||
13 | export interface LiveRTMPHLSTranscodingUpdatePayload { | ||
14 | type: 'add-chunk' | 'remove-chunk' | ||
15 | |||
16 | masterPlaylistFile?: Blob | string | ||
17 | |||
18 | resolutionPlaylistFilename?: string | ||
19 | resolutionPlaylistFile?: Blob | string | ||
20 | |||
21 | videoChunkFilename: string | ||
22 | videoChunkFile?: Blob | string | ||
23 | } | ||
24 | |||
25 | export function isLiveRTMPHLSTranscodingUpdatePayload (value: RunnerJobUpdatePayload): value is LiveRTMPHLSTranscodingUpdatePayload { | ||
26 | // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion | ||
27 | return !!(value as LiveRTMPHLSTranscodingUpdatePayload)?.videoChunkFilename | ||
28 | } | ||
diff --git a/shared/models/runners/runner-job.model.ts b/shared/models/runners/runner-job.model.ts new file mode 100644 index 000000000..080093563 --- /dev/null +++ b/shared/models/runners/runner-job.model.ts | |||
@@ -0,0 +1,45 @@ | |||
1 | import { VideoConstant } from '../videos' | ||
2 | import { RunnerJobPayload } from './runner-job-payload.model' | ||
3 | import { RunnerJobPrivatePayload } from './runner-job-private-payload.model' | ||
4 | import { RunnerJobState } from './runner-job-state.model' | ||
5 | import { RunnerJobType } from './runner-job-type.type' | ||
6 | |||
7 | export interface RunnerJob <T extends RunnerJobPayload = RunnerJobPayload> { | ||
8 | uuid: string | ||
9 | |||
10 | type: RunnerJobType | ||
11 | |||
12 | state: VideoConstant<RunnerJobState> | ||
13 | |||
14 | payload: T | ||
15 | |||
16 | failures: number | ||
17 | error: string | null | ||
18 | |||
19 | progress: number | ||
20 | priority: number | ||
21 | |||
22 | startedAt: Date | string | ||
23 | createdAt: Date | string | ||
24 | updatedAt: Date | string | ||
25 | finishedAt: Date | string | ||
26 | |||
27 | parent?: { | ||
28 | type: RunnerJobType | ||
29 | state: VideoConstant<RunnerJobState> | ||
30 | uuid: string | ||
31 | } | ||
32 | |||
33 | // If associated to a runner | ||
34 | runner?: { | ||
35 | id: number | ||
36 | name: string | ||
37 | |||
38 | description: string | ||
39 | } | ||
40 | } | ||
41 | |||
42 | // eslint-disable-next-line max-len | ||
43 | export interface RunnerJobAdmin <T extends RunnerJobPayload = RunnerJobPayload, U extends RunnerJobPrivatePayload = RunnerJobPrivatePayload> extends RunnerJob<T> { | ||
44 | privatePayload: U | ||
45 | } | ||
diff --git a/shared/models/runners/runner-registration-token.ts b/shared/models/runners/runner-registration-token.ts new file mode 100644 index 000000000..0a157aa51 --- /dev/null +++ b/shared/models/runners/runner-registration-token.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | export interface RunnerRegistrationToken { | ||
2 | id: number | ||
3 | |||
4 | registrationToken: string | ||
5 | |||
6 | createdAt: Date | ||
7 | updatedAt: Date | ||
8 | |||
9 | registeredRunnersCount: number | ||
10 | } | ||
diff --git a/shared/models/runners/runner.model.ts b/shared/models/runners/runner.model.ts new file mode 100644 index 000000000..3284f2992 --- /dev/null +++ b/shared/models/runners/runner.model.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | export interface Runner { | ||
2 | id: number | ||
3 | |||
4 | name: string | ||
5 | description: string | ||
6 | |||
7 | ip: string | ||
8 | lastContact: Date | string | ||
9 | |||
10 | createdAt: Date | string | ||
11 | updatedAt: Date | string | ||
12 | } | ||
diff --git a/shared/models/runners/unregister-runner-body.model.ts b/shared/models/runners/unregister-runner-body.model.ts new file mode 100644 index 000000000..d3465c5d6 --- /dev/null +++ b/shared/models/runners/unregister-runner-body.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface UnregisterRunnerBody { | ||
2 | runnerToken: string | ||
3 | } | ||
diff --git a/shared/models/server/custom-config.model.ts b/shared/models/server/custom-config.model.ts index 6ffe3a676..5d2c10278 100644 --- a/shared/models/server/custom-config.model.ts +++ b/shared/models/server/custom-config.model.ts | |||
@@ -116,6 +116,10 @@ export interface CustomConfig { | |||
116 | allowAdditionalExtensions: boolean | 116 | allowAdditionalExtensions: boolean |
117 | allowAudioFiles: boolean | 117 | allowAudioFiles: boolean |
118 | 118 | ||
119 | remoteRunners: { | ||
120 | enabled: boolean | ||
121 | } | ||
122 | |||
119 | threads: number | 123 | threads: number |
120 | concurrency: number | 124 | concurrency: number |
121 | 125 | ||
@@ -149,6 +153,9 @@ export interface CustomConfig { | |||
149 | 153 | ||
150 | transcoding: { | 154 | transcoding: { |
151 | enabled: boolean | 155 | enabled: boolean |
156 | remoteRunners: { | ||
157 | enabled: boolean | ||
158 | } | ||
152 | threads: number | 159 | threads: number |
153 | profile: string | 160 | profile: string |
154 | resolutions: ConfigResolutions | 161 | resolutions: ConfigResolutions |
diff --git a/shared/models/server/job.model.ts b/shared/models/server/job.model.ts index 9c0b5ea56..16187d133 100644 --- a/shared/models/server/job.model.ts +++ b/shared/models/server/job.model.ts | |||
@@ -18,6 +18,7 @@ export type JobType = | |||
18 | | 'after-video-channel-import' | 18 | | 'after-video-channel-import' |
19 | | 'email' | 19 | | 'email' |
20 | | 'federate-video' | 20 | | 'federate-video' |
21 | | 'transcoding-job-builder' | ||
21 | | 'manage-video-torrent' | 22 | | 'manage-video-torrent' |
22 | | 'move-to-object-storage' | 23 | | 'move-to-object-storage' |
23 | | 'notify' | 24 | | 'notify' |
@@ -41,6 +42,10 @@ export interface Job { | |||
41 | createdAt: Date | string | 42 | createdAt: Date | string |
42 | finishedOn: Date | string | 43 | finishedOn: Date | string |
43 | processedOn: Date | string | 44 | processedOn: Date | string |
45 | |||
46 | parent?: { | ||
47 | id: string | ||
48 | } | ||
44 | } | 49 | } |
45 | 50 | ||
46 | export type ActivitypubHttpBroadcastPayload = { | 51 | export type ActivitypubHttpBroadcastPayload = { |
@@ -139,30 +144,28 @@ interface BaseTranscodingPayload { | |||
139 | export interface HLSTranscodingPayload extends BaseTranscodingPayload { | 144 | export interface HLSTranscodingPayload extends BaseTranscodingPayload { |
140 | type: 'new-resolution-to-hls' | 145 | type: 'new-resolution-to-hls' |
141 | resolution: VideoResolution | 146 | resolution: VideoResolution |
147 | fps: number | ||
142 | copyCodecs: boolean | 148 | copyCodecs: boolean |
143 | 149 | ||
144 | hasAudio: boolean | 150 | deleteWebTorrentFiles: boolean |
145 | |||
146 | autoDeleteWebTorrentIfNeeded: boolean | ||
147 | isMaxQuality: boolean | ||
148 | } | 151 | } |
149 | 152 | ||
150 | export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload { | 153 | export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload { |
151 | type: 'new-resolution-to-webtorrent' | 154 | type: 'new-resolution-to-webtorrent' |
152 | resolution: VideoResolution | 155 | resolution: VideoResolution |
153 | 156 | fps: number | |
154 | hasAudio: boolean | ||
155 | createHLSIfNeeded: boolean | ||
156 | } | 157 | } |
157 | 158 | ||
158 | export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload { | 159 | export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload { |
159 | type: 'merge-audio-to-webtorrent' | 160 | type: 'merge-audio-to-webtorrent' |
160 | resolution: VideoResolution | 161 | resolution: VideoResolution |
161 | createHLSIfNeeded: true | 162 | fps: number |
162 | } | 163 | } |
163 | 164 | ||
164 | export interface OptimizeTranscodingPayload extends BaseTranscodingPayload { | 165 | export interface OptimizeTranscodingPayload extends BaseTranscodingPayload { |
165 | type: 'optimize-to-webtorrent' | 166 | type: 'optimize-to-webtorrent' |
167 | |||
168 | quickTranscode: boolean | ||
166 | } | 169 | } |
167 | 170 | ||
168 | export type VideoTranscodingPayload = | 171 | export type VideoTranscodingPayload = |
@@ -258,3 +261,27 @@ export interface FederateVideoPayload { | |||
258 | videoUUID: string | 261 | videoUUID: string |
259 | isNewVideo: boolean | 262 | isNewVideo: boolean |
260 | } | 263 | } |
264 | |||
265 | // --------------------------------------------------------------------------- | ||
266 | |||
267 | export interface TranscodingJobBuilderPayload { | ||
268 | videoUUID: string | ||
269 | |||
270 | optimizeJob?: { | ||
271 | isNewVideo: boolean | ||
272 | } | ||
273 | |||
274 | // Array of jobs to create | ||
275 | jobs?: { | ||
276 | type: 'video-transcoding' | ||
277 | payload: VideoTranscodingPayload | ||
278 | priority?: number | ||
279 | }[] | ||
280 | |||
281 | // Array of sequential jobs to create | ||
282 | sequentialJobs?: { | ||
283 | type: 'video-transcoding' | ||
284 | payload: VideoTranscodingPayload | ||
285 | priority?: number | ||
286 | }[][] | ||
287 | } | ||
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts index d0bd9a00f..38b9d0385 100644 --- a/shared/models/server/server-config.model.ts +++ b/shared/models/server/server-config.model.ts | |||
@@ -148,6 +148,10 @@ export interface ServerConfig { | |||
148 | 148 | ||
149 | profile: string | 149 | profile: string |
150 | availableProfiles: string[] | 150 | availableProfiles: string[] |
151 | |||
152 | remoteRunners: { | ||
153 | enabled: boolean | ||
154 | } | ||
151 | } | 155 | } |
152 | 156 | ||
153 | live: { | 157 | live: { |
@@ -165,6 +169,10 @@ export interface ServerConfig { | |||
165 | transcoding: { | 169 | transcoding: { |
166 | enabled: boolean | 170 | enabled: boolean |
167 | 171 | ||
172 | remoteRunners: { | ||
173 | enabled: boolean | ||
174 | } | ||
175 | |||
168 | enabledResolutions: number[] | 176 | enabledResolutions: number[] |
169 | 177 | ||
170 | profile: string | 178 | profile: string |
diff --git a/shared/models/server/server-error-code.enum.ts b/shared/models/server/server-error-code.enum.ts index a39cde1b3..24d3c6d21 100644 --- a/shared/models/server/server-error-code.enum.ts +++ b/shared/models/server/server-error-code.enum.ts | |||
@@ -45,7 +45,10 @@ export const enum ServerErrorCode { | |||
45 | INVALID_TWO_FACTOR = 'invalid_two_factor', | 45 | INVALID_TWO_FACTOR = 'invalid_two_factor', |
46 | 46 | ||
47 | ACCOUNT_WAITING_FOR_APPROVAL = 'account_waiting_for_approval', | 47 | ACCOUNT_WAITING_FOR_APPROVAL = 'account_waiting_for_approval', |
48 | ACCOUNT_APPROVAL_REJECTED = 'account_approval_rejected' | 48 | ACCOUNT_APPROVAL_REJECTED = 'account_approval_rejected', |
49 | |||
50 | RUNNER_JOB_NOT_IN_PROCESSING_STATE = 'runner_job_not_in_processing_state', | ||
51 | UNKNOWN_RUNNER_TOKEN = 'unknown_runner_token' | ||
49 | } | 52 | } |
50 | 53 | ||
51 | /** | 54 | /** |
diff --git a/shared/models/users/user-right.enum.ts b/shared/models/users/user-right.enum.ts index 42e5c8cd6..a5a770b75 100644 --- a/shared/models/users/user-right.enum.ts +++ b/shared/models/users/user-right.enum.ts | |||
@@ -45,5 +45,7 @@ export const enum UserRight { | |||
45 | 45 | ||
46 | MANAGE_VIDEO_IMPORTS = 27, | 46 | MANAGE_VIDEO_IMPORTS = 27, |
47 | 47 | ||
48 | MANAGE_REGISTRATIONS = 28 | 48 | MANAGE_REGISTRATIONS = 28, |
49 | |||
50 | MANAGE_RUNNERS = 29 | ||
49 | } | 51 | } |
diff --git a/shared/models/videos/live/live-video-error.enum.ts b/shared/models/videos/live/live-video-error.enum.ts index 3a8e4afa0..a26453505 100644 --- a/shared/models/videos/live/live-video-error.enum.ts +++ b/shared/models/videos/live/live-video-error.enum.ts | |||
@@ -3,5 +3,7 @@ export const enum LiveVideoError { | |||
3 | DURATION_EXCEEDED = 2, | 3 | DURATION_EXCEEDED = 2, |
4 | QUOTA_EXCEEDED = 3, | 4 | QUOTA_EXCEEDED = 3, |
5 | FFMPEG_ERROR = 4, | 5 | FFMPEG_ERROR = 4, |
6 | BLACKLISTED = 5 | 6 | BLACKLISTED = 5, |
7 | RUNNER_JOB_ERROR = 6, | ||
8 | RUNNER_JOB_CANCEL = 7 | ||
7 | } | 9 | } |