]>
Commit | Line | Data |
---|---|---|
1 | import { ContextType } from '../activitypub/context' | |
2 | import { VideoState } from '../videos' | |
3 | import { VideoStudioTaskCut } from '../videos/studio' | |
4 | import { VideoResolution } from '../videos/file/video-resolution.enum' | |
5 | import { SendEmailOptions } from './emailer.model' | |
6 | ||
7 | export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | |
8 | ||
9 | export 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 | ||
28 | export 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 | ||
41 | export type ActivitypubHttpBroadcastPayload = { | |
42 | uris: string[] | |
43 | contextType: ContextType | |
44 | body: any | |
45 | signatureActorId?: number | |
46 | } | |
47 | ||
48 | export type ActivitypubFollowPayload = { | |
49 | followerActorId: number | |
50 | name: string | |
51 | host: string | |
52 | isAutoFollow?: boolean | |
53 | assertIsChannel?: boolean | |
54 | } | |
55 | ||
56 | export type FetchType = 'activity' | 'video-shares' | 'video-comments' | 'account-playlists' | |
57 | export type ActivitypubHttpFetcherPayload = { | |
58 | uri: string | |
59 | type: FetchType | |
60 | videoId?: number | |
61 | } | |
62 | ||
63 | export type ActivitypubHttpUnicastPayload = { | |
64 | uri: string | |
65 | contextType: ContextType | |
66 | signatureActorId?: number | |
67 | body: object | |
68 | } | |
69 | ||
70 | export type RefreshPayload = { | |
71 | type: 'video' | 'video-playlist' | 'actor' | |
72 | url: string | |
73 | } | |
74 | ||
75 | export type EmailPayload = SendEmailOptions | |
76 | ||
77 | export type VideoFileImportPayload = { | |
78 | videoUUID: string | |
79 | filePath: string | |
80 | } | |
81 | ||
82 | export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file' | |
83 | export type VideoImportYoutubeDLPayloadType = 'youtube-dl' | |
84 | ||
85 | export type VideoImportYoutubeDLPayload = { | |
86 | type: VideoImportYoutubeDLPayloadType | |
87 | videoImportId: number | |
88 | ||
89 | fileExt?: string | |
90 | } | |
91 | export type VideoImportTorrentPayload = { | |
92 | type: VideoImportTorrentPayloadType | |
93 | videoImportId: number | |
94 | } | |
95 | export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload | |
96 | ||
97 | export type VideoRedundancyPayload = { | |
98 | videoId: number | |
99 | } | |
100 | ||
101 | export 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 | ||
117 | interface BaseTranscodingPayload { | |
118 | videoUUID: string | |
119 | isNewVideo?: boolean | |
120 | } | |
121 | ||
122 | export 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 | ||
134 | export 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 | ||
144 | export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload { | |
145 | type: 'merge-audio-to-webtorrent' | |
146 | resolution: VideoResolution | |
147 | createHLSIfNeeded: true | |
148 | } | |
149 | ||
150 | export interface OptimizeTranscodingPayload extends BaseTranscodingPayload { | |
151 | type: 'optimize-to-webtorrent' | |
152 | } | |
153 | ||
154 | export type VideoTranscodingPayload = | |
155 | HLSTranscodingPayload | |
156 | | NewWebTorrentResolutionTranscodingPayload | |
157 | | OptimizeTranscodingPayload | |
158 | | MergeAudioTranscodingPayload | |
159 | ||
160 | export interface VideoLiveEndingPayload { | |
161 | videoId: number | |
162 | publishedAt: string | |
163 | ||
164 | replayDirectory?: string | |
165 | } | |
166 | ||
167 | export interface ActorKeysPayload { | |
168 | actorId: number | |
169 | } | |
170 | ||
171 | export interface DeleteResumableUploadMetaFilePayload { | |
172 | filepath: string | |
173 | } | |
174 | ||
175 | export interface MoveObjectStoragePayload { | |
176 | videoUUID: string | |
177 | isNewVideo: boolean | |
178 | previousVideoState: VideoState | |
179 | } | |
180 | ||
181 | export type VideoStudioTaskCutPayload = VideoStudioTaskCut | |
182 | ||
183 | export type VideoStudioTaskIntroPayload = { | |
184 | name: 'add-intro' | |
185 | ||
186 | options: { | |
187 | file: string | |
188 | } | |
189 | } | |
190 | ||
191 | export type VideoStudioTaskOutroPayload = { | |
192 | name: 'add-outro' | |
193 | ||
194 | options: { | |
195 | file: string | |
196 | } | |
197 | } | |
198 | ||
199 | export type VideoStudioTaskWatermarkPayload = { | |
200 | name: 'add-watermark' | |
201 | ||
202 | options: { | |
203 | file: string | |
204 | } | |
205 | } | |
206 | ||
207 | export type VideoStudioTaskPayload = | |
208 | VideoStudioTaskCutPayload | | |
209 | VideoStudioTaskIntroPayload | | |
210 | VideoStudioTaskOutroPayload | | |
211 | VideoStudioTaskWatermarkPayload | |
212 | ||
213 | export interface VideoStudioEditionPayload { | |
214 | videoUUID: string | |
215 | tasks: VideoStudioTaskPayload[] | |
216 | } |