]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/models/server/job.model.ts
Support live session in server
[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[]
a219c910 43 contextType: ContextType
8dc8a34e 44 body: any
a219c910 45 signatureActorId?: number
8dc8a34e
C
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
a219c910 65 contextType: ContextType
8dc8a34e 66 signatureActorId?: number
db4b15f2 67 body: object
8dc8a34e
C
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
4ec52d04 162 publishedAt: string
26e3e98f 163 liveSessionId: number
4ec52d04
C
164
165 replayDirectory?: string
a5cf76af 166}
8795d6f2
C
167
168export interface ActorKeysPayload {
169 actorId: number
170}
0305db28 171
276250f0
RK
172export interface DeleteResumableUploadMetaFilePayload {
173 filepath: string
174}
175
0305db28
JB
176export interface MoveObjectStoragePayload {
177 videoUUID: string
178 isNewVideo: boolean
1808a1f8 179 previousVideoState: VideoState
0305db28 180}
c729caf6 181
92e66e04 182export type VideoStudioTaskCutPayload = VideoStudioTaskCut
c729caf6 183
92e66e04 184export type VideoStudioTaskIntroPayload = {
c729caf6
C
185 name: 'add-intro'
186
187 options: {
188 file: string
189 }
190}
191
92e66e04 192export type VideoStudioTaskOutroPayload = {
c729caf6
C
193 name: 'add-outro'
194
195 options: {
196 file: string
197 }
198}
199
92e66e04 200export type VideoStudioTaskWatermarkPayload = {
c729caf6
C
201 name: 'add-watermark'
202
203 options: {
204 file: string
205 }
206}
207
92e66e04
C
208export type VideoStudioTaskPayload =
209 VideoStudioTaskCutPayload |
210 VideoStudioTaskIntroPayload |
211 VideoStudioTaskOutroPayload |
212 VideoStudioTaskWatermarkPayload
c729caf6 213
92e66e04 214export interface VideoStudioEditionPayload {
c729caf6 215 videoUUID: string
92e66e04 216 tasks: VideoStudioTaskPayload[]
c729caf6 217}