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