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