]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/models/server/job.model.ts
Add peertube runner cli
[github/Chocobozzz/PeerTube.git] / shared / models / server / job.model.ts
CommitLineData
e307e4fc 1import { ContextType } from '../activitypub/context'
1808a1f8 2import { VideoState } from '../videos'
ad5db104 3import { VideoResolution } from '../videos/file/video-resolution.enum'
84cae54e 4import { VideoStudioTaskCut } from '../videos/studio'
0fecf427 5import { SendEmailOptions } from './emailer.model'
8dc8a34e 6
5a921e7b 7export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | 'waiting-children'
94a5ff8a 8
a1587156 9export type JobType =
74d249bc 10 | 'activitypub-cleaner'
a1587156 11 | 'activitypub-follow'
0567049a
C
12 | 'activitypub-http-broadcast-parallel'
13 | 'activitypub-http-broadcast'
14 | 'activitypub-http-fetcher'
15 | 'activitypub-http-unicast'
a1587156 16 | 'activitypub-refresher'
8795d6f2 17 | 'actor-keys'
0567049a
C
18 | 'after-video-channel-import'
19 | 'email'
20 | 'federate-video'
0c9668f7 21 | 'transcoding-job-builder'
f012319a 22 | 'manage-video-torrent'
0305db28 23 | 'move-to-object-storage'
bd911b54 24 | 'notify'
0567049a
C
25 | 'video-channel-import'
26 | 'video-file-import'
27 | 'video-import'
28 | 'video-live-ending'
29 | 'video-redundancy'
30 | 'video-studio-edition'
31 | 'video-transcoding'
32 | 'videos-views-stats'
5cd80545
C
33
34export interface Job {
5a921e7b
C
35 id: number | string
36 state: JobState | 'unknown'
94a5ff8a 37 type: JobType
a1587156 38 data: any
77d7e851 39 priority: number
3b01f4c0 40 progress: number
a1587156 41 error: any
1061c73f
C
42 createdAt: Date | string
43 finishedOn: Date | string
44 processedOn: Date | string
0c9668f7
C
45
46 parent?: {
47 id: string
48 }
5cd80545 49}
8dc8a34e
C
50
51export type ActivitypubHttpBroadcastPayload = {
52 uris: string[]
a219c910 53 contextType: ContextType
8dc8a34e 54 body: any
a219c910 55 signatureActorId?: number
8dc8a34e
C
56}
57
58export type ActivitypubFollowPayload = {
59 followerActorId: number
60 name: string
61 host: string
62 isAutoFollow?: boolean
63 assertIsChannel?: boolean
64}
65
57e4e1c1 66export type FetchType = 'activity' | 'video-shares' | 'video-comments' | 'account-playlists'
8dc8a34e
C
67export type ActivitypubHttpFetcherPayload = {
68 uri: string
69 type: FetchType
70 videoId?: number
8dc8a34e
C
71}
72
73export type ActivitypubHttpUnicastPayload = {
74 uri: string
a219c910 75 contextType: ContextType
8dc8a34e 76 signatureActorId?: number
db4b15f2 77 body: object
8dc8a34e
C
78}
79
80export type RefreshPayload = {
81 type: 'video' | 'video-playlist' | 'actor'
82 url: string
83}
84
85export type EmailPayload = SendEmailOptions
86
87export type VideoFileImportPayload = {
88 videoUUID: string
89 filePath: string
90}
91
2a491182
F
92// ---------------------------------------------------------------------------
93
2158ac90
RK
94export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
95export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
96
2a491182 97export interface VideoImportYoutubeDLPayload {
2158ac90 98 type: VideoImportYoutubeDLPayloadType
8dc8a34e
C
99 videoImportId: number
100
8dc8a34e
C
101 fileExt?: string
102}
2a491182
F
103
104export interface VideoImportTorrentPayload {
2158ac90 105 type: VideoImportTorrentPayloadType
8dc8a34e
C
106 videoImportId: number
107}
2a491182
F
108
109export type VideoImportPayload = (VideoImportYoutubeDLPayload | VideoImportTorrentPayload) & {
110 preventException: boolean
111}
112
113export interface VideoImportPreventExceptionResult {
114 resultType: 'success' | 'error'
115}
116
117// ---------------------------------------------------------------------------
8dc8a34e
C
118
119export type VideoRedundancyPayload = {
120 videoId: number
121}
122
f012319a
C
123export type ManageVideoTorrentPayload =
124 {
125 action: 'create'
126 videoId: number
127 videoFileId: number
128 } | {
129 action: 'update-metadata'
130
131 videoId?: number
132 streamingPlaylistId?: number
133
134 videoFileId: number
135 }
136
8dc8a34e
C
137// Video transcoding payloads
138
139interface BaseTranscodingPayload {
140 videoUUID: string
141 isNewVideo?: boolean
142}
143
24516aa2
C
144export interface HLSTranscodingPayload extends BaseTranscodingPayload {
145 type: 'new-resolution-to-hls'
8dc8a34e 146 resolution: VideoResolution
0c9668f7 147 fps: number
8dc8a34e 148 copyCodecs: boolean
ad5db104 149
0c9668f7 150 deleteWebTorrentFiles: boolean
8dc8a34e
C
151}
152
0f11ec8d 153export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
24516aa2 154 type: 'new-resolution-to-webtorrent'
8dc8a34e 155 resolution: VideoResolution
0c9668f7 156 fps: number
8dc8a34e
C
157}
158
159export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
24516aa2 160 type: 'merge-audio-to-webtorrent'
8dc8a34e 161 resolution: VideoResolution
0c9668f7 162 fps: number
8dc8a34e
C
163}
164
165export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
24516aa2 166 type: 'optimize-to-webtorrent'
0c9668f7
C
167
168 quickTranscode: boolean
8dc8a34e
C
169}
170
171export type VideoTranscodingPayload =
172 HLSTranscodingPayload
0f11ec8d 173 | NewWebTorrentResolutionTranscodingPayload
8dc8a34e
C
174 | OptimizeTranscodingPayload
175 | MergeAudioTranscodingPayload
a5cf76af
C
176
177export interface VideoLiveEndingPayload {
178 videoId: number
4ec52d04 179 publishedAt: string
26e3e98f 180 liveSessionId: number
cdd83816 181 streamingPlaylistId: number
4ec52d04
C
182
183 replayDirectory?: string
a5cf76af 184}
8795d6f2
C
185
186export interface ActorKeysPayload {
187 actorId: number
188}
0305db28 189
276250f0
RK
190export interface DeleteResumableUploadMetaFilePayload {
191 filepath: string
192}
193
0305db28
JB
194export interface MoveObjectStoragePayload {
195 videoUUID: string
196 isNewVideo: boolean
1808a1f8 197 previousVideoState: VideoState
0305db28 198}
c729caf6 199
92e66e04 200export type VideoStudioTaskCutPayload = VideoStudioTaskCut
c729caf6 201
92e66e04 202export type VideoStudioTaskIntroPayload = {
c729caf6
C
203 name: 'add-intro'
204
205 options: {
206 file: string
207 }
208}
209
92e66e04 210export type VideoStudioTaskOutroPayload = {
c729caf6
C
211 name: 'add-outro'
212
213 options: {
214 file: string
215 }
216}
217
92e66e04 218export type VideoStudioTaskWatermarkPayload = {
c729caf6
C
219 name: 'add-watermark'
220
221 options: {
222 file: string
223 }
224}
225
92e66e04
C
226export type VideoStudioTaskPayload =
227 VideoStudioTaskCutPayload |
228 VideoStudioTaskIntroPayload |
229 VideoStudioTaskOutroPayload |
230 VideoStudioTaskWatermarkPayload
c729caf6 231
92e66e04 232export interface VideoStudioEditionPayload {
c729caf6 233 videoUUID: string
92e66e04 234 tasks: VideoStudioTaskPayload[]
c729caf6 235}
bd911b54
C
236
237// ---------------------------------------------------------------------------
238
2a491182
F
239export interface VideoChannelImportPayload {
240 externalChannelUrl: string
241 videoChannelId: number
a3b472a1
C
242
243 partOfChannelSyncId?: number
2a491182
F
244}
245
246export interface AfterVideoChannelImportPayload {
247 channelSyncId: number
248}
249
250// ---------------------------------------------------------------------------
251
bd911b54
C
252export type NotifyPayload =
253 {
254 action: 'new-video'
255 videoUUID: string
256 }
257
258// ---------------------------------------------------------------------------
259
260export interface FederateVideoPayload {
261 videoUUID: string
262 isNewVideo: boolean
263}
0c9668f7
C
264
265// ---------------------------------------------------------------------------
266
267export 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}