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