]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - shared/models/server/job.model.ts
Fix e2e tests
[github/Chocobozzz/PeerTube.git] / shared / models / server / job.model.ts
... / ...
CommitLineData
1import { ContextType } from '../activitypub/context'
2import { VideoState } from '../videos'
3import { VideoStudioTaskCut } from '../videos/studio'
4import { VideoResolution } from '../videos/file/video-resolution.enum'
5import { SendEmailOptions } from './emailer.model'
6
7export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused'
8
9export type JobType =
10 | 'activitypub-http-unicast'
11 | 'activitypub-http-broadcast'
12 | 'activitypub-http-fetcher'
13 | 'activitypub-cleaner'
14 | 'activitypub-follow'
15 | 'video-file-import'
16 | 'video-transcoding'
17 | 'email'
18 | 'video-import'
19 | 'videos-views-stats'
20 | 'activitypub-refresher'
21 | 'video-redundancy'
22 | 'video-live-ending'
23 | 'actor-keys'
24 | 'manage-video-torrent'
25 | 'move-to-object-storage'
26 | 'video-studio-edition'
27
28export interface Job {
29 id: number
30 state: JobState
31 type: JobType
32 data: any
33 priority: number
34 progress: number
35 error: any
36 createdAt: Date | string
37 finishedOn: Date | string
38 processedOn: Date | string
39}
40
41export type ActivitypubHttpBroadcastPayload = {
42 uris: string[]
43 contextType: ContextType
44 body: any
45 signatureActorId?: number
46}
47
48export type ActivitypubFollowPayload = {
49 followerActorId: number
50 name: string
51 host: string
52 isAutoFollow?: boolean
53 assertIsChannel?: boolean
54}
55
56export type FetchType = 'activity' | 'video-shares' | 'video-comments' | 'account-playlists'
57export type ActivitypubHttpFetcherPayload = {
58 uri: string
59 type: FetchType
60 videoId?: number
61}
62
63export type ActivitypubHttpUnicastPayload = {
64 uri: string
65 contextType: ContextType
66 signatureActorId?: number
67 body: object
68}
69
70export type RefreshPayload = {
71 type: 'video' | 'video-playlist' | 'actor'
72 url: string
73}
74
75export type EmailPayload = SendEmailOptions
76
77export type VideoFileImportPayload = {
78 videoUUID: string
79 filePath: string
80}
81
82export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
83export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
84
85export type VideoImportYoutubeDLPayload = {
86 type: VideoImportYoutubeDLPayloadType
87 videoImportId: number
88
89 fileExt?: string
90}
91export type VideoImportTorrentPayload = {
92 type: VideoImportTorrentPayloadType
93 videoImportId: number
94}
95export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload
96
97export type VideoRedundancyPayload = {
98 videoId: number
99}
100
101export type ManageVideoTorrentPayload =
102 {
103 action: 'create'
104 videoId: number
105 videoFileId: number
106 } | {
107 action: 'update-metadata'
108
109 videoId?: number
110 streamingPlaylistId?: number
111
112 videoFileId: number
113 }
114
115// Video transcoding payloads
116
117interface BaseTranscodingPayload {
118 videoUUID: string
119 isNewVideo?: boolean
120}
121
122export interface HLSTranscodingPayload extends BaseTranscodingPayload {
123 type: 'new-resolution-to-hls'
124 resolution: VideoResolution
125 copyCodecs: boolean
126
127 hasAudio: boolean
128 isPortraitMode?: boolean
129
130 autoDeleteWebTorrentIfNeeded: boolean
131 isMaxQuality: boolean
132}
133
134export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
135 type: 'new-resolution-to-webtorrent'
136 resolution: VideoResolution
137
138 hasAudio: boolean
139 createHLSIfNeeded: boolean
140
141 isPortraitMode?: boolean
142}
143
144export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
145 type: 'merge-audio-to-webtorrent'
146 resolution: VideoResolution
147 createHLSIfNeeded: true
148}
149
150export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
151 type: 'optimize-to-webtorrent'
152}
153
154export type VideoTranscodingPayload =
155 HLSTranscodingPayload
156 | NewWebTorrentResolutionTranscodingPayload
157 | OptimizeTranscodingPayload
158 | MergeAudioTranscodingPayload
159
160export interface VideoLiveEndingPayload {
161 videoId: number
162}
163
164export interface ActorKeysPayload {
165 actorId: number
166}
167
168export interface DeleteResumableUploadMetaFilePayload {
169 filepath: string
170}
171
172export interface MoveObjectStoragePayload {
173 videoUUID: string
174 isNewVideo: boolean
175 previousVideoState: VideoState
176}
177
178export type VideoStudioTaskCutPayload = VideoStudioTaskCut
179
180export type VideoStudioTaskIntroPayload = {
181 name: 'add-intro'
182
183 options: {
184 file: string
185 }
186}
187
188export type VideoStudioTaskOutroPayload = {
189 name: 'add-outro'
190
191 options: {
192 file: string
193 }
194}
195
196export type VideoStudioTaskWatermarkPayload = {
197 name: 'add-watermark'
198
199 options: {
200 file: string
201 }
202}
203
204export type VideoStudioTaskPayload =
205 VideoStudioTaskCutPayload |
206 VideoStudioTaskIntroPayload |
207 VideoStudioTaskOutroPayload |
208 VideoStudioTaskWatermarkPayload
209
210export interface VideoStudioEditionPayload {
211 videoUUID: string
212 tasks: VideoStudioTaskPayload[]
213}