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