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