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