]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/models/server/job.model.ts
Remove activitypub helper
[github/Chocobozzz/PeerTube.git] / shared / models / server / job.model.ts
CommitLineData
e307e4fc 1import { ContextType } from '../activitypub/context'
1808a1f8 2import { VideoState } from '../videos'
92e66e04 3import { VideoStudioTaskCut } from '../videos/studio'
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'
92e66e04 26 | 'video-studio-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
120}
121
24516aa2
C
122export interface HLSTranscodingPayload extends BaseTranscodingPayload {
123 type: 'new-resolution-to-hls'
8dc8a34e
C
124 resolution: VideoResolution
125 copyCodecs: boolean
ad5db104 126
cbe2f36d
C
127 hasAudio: boolean
128 isPortraitMode?: boolean
129
ad5db104 130 autoDeleteWebTorrentIfNeeded: boolean
9129b769 131 isMaxQuality: boolean
8dc8a34e
C
132}
133
0f11ec8d 134export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
24516aa2 135 type: 'new-resolution-to-webtorrent'
8dc8a34e 136 resolution: VideoResolution
cbe2f36d
C
137
138 hasAudio: boolean
0f11ec8d 139 createHLSIfNeeded: boolean
cbe2f36d
C
140
141 isPortraitMode?: boolean
8dc8a34e
C
142}
143
144export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
24516aa2 145 type: 'merge-audio-to-webtorrent'
8dc8a34e 146 resolution: VideoResolution
0f11ec8d 147 createHLSIfNeeded: true
8dc8a34e
C
148}
149
150export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
24516aa2 151 type: 'optimize-to-webtorrent'
8dc8a34e
C
152}
153
154export type VideoTranscodingPayload =
155 HLSTranscodingPayload
0f11ec8d 156 | NewWebTorrentResolutionTranscodingPayload
8dc8a34e
C
157 | OptimizeTranscodingPayload
158 | MergeAudioTranscodingPayload
a5cf76af
C
159
160export interface VideoLiveEndingPayload {
161 videoId: number
162}
8795d6f2
C
163
164export interface ActorKeysPayload {
165 actorId: number
166}
0305db28 167
276250f0
RK
168export interface DeleteResumableUploadMetaFilePayload {
169 filepath: string
170}
171
0305db28
JB
172export interface MoveObjectStoragePayload {
173 videoUUID: string
174 isNewVideo: boolean
1808a1f8 175 previousVideoState: VideoState
0305db28 176}
c729caf6 177
92e66e04 178export type VideoStudioTaskCutPayload = VideoStudioTaskCut
c729caf6 179
92e66e04 180export type VideoStudioTaskIntroPayload = {
c729caf6
C
181 name: 'add-intro'
182
183 options: {
184 file: string
185 }
186}
187
92e66e04 188export type VideoStudioTaskOutroPayload = {
c729caf6
C
189 name: 'add-outro'
190
191 options: {
192 file: string
193 }
194}
195
92e66e04 196export type VideoStudioTaskWatermarkPayload = {
c729caf6
C
197 name: 'add-watermark'
198
199 options: {
200 file: string
201 }
202}
203
92e66e04
C
204export type VideoStudioTaskPayload =
205 VideoStudioTaskCutPayload |
206 VideoStudioTaskIntroPayload |
207 VideoStudioTaskOutroPayload |
208 VideoStudioTaskWatermarkPayload
c729caf6 209
92e66e04 210export interface VideoStudioEditionPayload {
c729caf6 211 videoUUID: string
92e66e04 212 tasks: VideoStudioTaskPayload[]
c729caf6 213}