]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - 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
1import { ContextType } from '../activitypub/context'
2import { VideoState } from '../videos'
3import { VideoResolution } from '../videos/file/video-resolution.enum'
4import { VideoStudioTaskCut } from '../videos/studio'
5import { SendEmailOptions } from './emailer.model'
6
7export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | 'waiting-children'
8
9export type JobType =
10 | 'activitypub-cleaner'
11 | 'activitypub-follow'
12 | 'activitypub-http-broadcast-parallel'
13 | 'activitypub-http-broadcast'
14 | 'activitypub-http-fetcher'
15 | 'activitypub-http-unicast'
16 | 'activitypub-refresher'
17 | 'actor-keys'
18 | 'after-video-channel-import'
19 | 'email'
20 | 'federate-video'
21 | 'manage-video-torrent'
22 | 'move-to-object-storage'
23 | 'notify'
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'
32
33export interface Job {
34 id: number | string
35 state: JobState | 'unknown'
36 type: JobType
37 data: any
38 priority: number
39 progress: number
40 error: any
41 createdAt: Date | string
42 finishedOn: Date | string
43 processedOn: Date | string
44}
45
46export type ActivitypubHttpBroadcastPayload = {
47 uris: string[]
48 contextType: ContextType
49 body: any
50 signatureActorId?: number
51}
52
53export type ActivitypubFollowPayload = {
54 followerActorId: number
55 name: string
56 host: string
57 isAutoFollow?: boolean
58 assertIsChannel?: boolean
59}
60
61export type FetchType = 'activity' | 'video-shares' | 'video-comments' | 'account-playlists'
62export type ActivitypubHttpFetcherPayload = {
63 uri: string
64 type: FetchType
65 videoId?: number
66}
67
68export type ActivitypubHttpUnicastPayload = {
69 uri: string
70 contextType: ContextType
71 signatureActorId?: number
72 body: object
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
87// ---------------------------------------------------------------------------
88
89export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
90export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
91
92export interface VideoImportYoutubeDLPayload {
93 type: VideoImportYoutubeDLPayloadType
94 videoImportId: number
95
96 fileExt?: string
97}
98
99export interface VideoImportTorrentPayload {
100 type: VideoImportTorrentPayloadType
101 videoImportId: number
102}
103
104export type VideoImportPayload = (VideoImportYoutubeDLPayload | VideoImportTorrentPayload) & {
105 preventException: boolean
106}
107
108export interface VideoImportPreventExceptionResult {
109 resultType: 'success' | 'error'
110}
111
112// ---------------------------------------------------------------------------
113
114export type VideoRedundancyPayload = {
115 videoId: number
116}
117
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
132// Video transcoding payloads
133
134interface BaseTranscodingPayload {
135 videoUUID: string
136 isNewVideo?: boolean
137}
138
139export interface HLSTranscodingPayload extends BaseTranscodingPayload {
140 type: 'new-resolution-to-hls'
141 resolution: VideoResolution
142 copyCodecs: boolean
143
144 hasAudio: boolean
145
146 autoDeleteWebTorrentIfNeeded: boolean
147 isMaxQuality: boolean
148}
149
150export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
151 type: 'new-resolution-to-webtorrent'
152 resolution: VideoResolution
153
154 hasAudio: boolean
155 createHLSIfNeeded: boolean
156}
157
158export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
159 type: 'merge-audio-to-webtorrent'
160 resolution: VideoResolution
161 createHLSIfNeeded: true
162}
163
164export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
165 type: 'optimize-to-webtorrent'
166}
167
168export type VideoTranscodingPayload =
169 HLSTranscodingPayload
170 | NewWebTorrentResolutionTranscodingPayload
171 | OptimizeTranscodingPayload
172 | MergeAudioTranscodingPayload
173
174export interface VideoLiveEndingPayload {
175 videoId: number
176 publishedAt: string
177 liveSessionId: number
178 streamingPlaylistId: number
179
180 replayDirectory?: string
181}
182
183export interface ActorKeysPayload {
184 actorId: number
185}
186
187export interface DeleteResumableUploadMetaFilePayload {
188 filepath: string
189}
190
191export interface MoveObjectStoragePayload {
192 videoUUID: string
193 isNewVideo: boolean
194 previousVideoState: VideoState
195}
196
197export type VideoStudioTaskCutPayload = VideoStudioTaskCut
198
199export type VideoStudioTaskIntroPayload = {
200 name: 'add-intro'
201
202 options: {
203 file: string
204 }
205}
206
207export type VideoStudioTaskOutroPayload = {
208 name: 'add-outro'
209
210 options: {
211 file: string
212 }
213}
214
215export type VideoStudioTaskWatermarkPayload = {
216 name: 'add-watermark'
217
218 options: {
219 file: string
220 }
221}
222
223export type VideoStudioTaskPayload =
224 VideoStudioTaskCutPayload |
225 VideoStudioTaskIntroPayload |
226 VideoStudioTaskOutroPayload |
227 VideoStudioTaskWatermarkPayload
228
229export interface VideoStudioEditionPayload {
230 videoUUID: string
231 tasks: VideoStudioTaskPayload[]
232}
233
234// ---------------------------------------------------------------------------
235
236export interface VideoChannelImportPayload {
237 externalChannelUrl: string
238 videoChannelId: number
239
240 partOfChannelSyncId?: number
241}
242
243export interface AfterVideoChannelImportPayload {
244 channelSyncId: number
245}
246
247// ---------------------------------------------------------------------------
248
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}