]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - shared/models/server/job.model.ts
Merge remote-tracking branch 'weblate/develop' into develop
[github/Chocobozzz/PeerTube.git] / shared / models / server / job.model.ts
... / ...
CommitLineData
1import { ContextType } from '../activitypub/context'
2import { VideoEditorTaskCut } from '../videos/editor'
3import { VideoResolution } from '../videos/file/video-resolution.enum'
4import { SendEmailOptions } from './emailer.model'
5
6export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused'
7
8export type JobType =
9 | 'activitypub-http-unicast'
10 | 'activitypub-http-broadcast'
11 | 'activitypub-http-fetcher'
12 | 'activitypub-cleaner'
13 | 'activitypub-follow'
14 | 'video-file-import'
15 | 'video-transcoding'
16 | 'email'
17 | 'video-import'
18 | 'videos-views-stats'
19 | 'activitypub-refresher'
20 | 'video-redundancy'
21 | 'video-live-ending'
22 | 'actor-keys'
23 | 'move-to-object-storage'
24 | 'video-edition'
25
26export interface Job {
27 id: number
28 state: JobState
29 type: JobType
30 data: any
31 priority: number
32 progress: number
33 error: any
34 createdAt: Date | string
35 finishedOn: Date | string
36 processedOn: Date | string
37}
38
39export type ActivitypubHttpBroadcastPayload = {
40 uris: string[]
41 signatureActorId?: number
42 body: any
43 contextType?: ContextType
44}
45
46export type ActivitypubFollowPayload = {
47 followerActorId: number
48 name: string
49 host: string
50 isAutoFollow?: boolean
51 assertIsChannel?: boolean
52}
53
54export type FetchType = 'activity' | 'video-likes' | 'video-dislikes' | 'video-shares' | 'video-comments' | 'account-playlists'
55export type ActivitypubHttpFetcherPayload = {
56 uri: string
57 type: FetchType
58 videoId?: number
59}
60
61export type ActivitypubHttpUnicastPayload = {
62 uri: string
63 signatureActorId?: number
64 body: object
65 contextType?: ContextType
66}
67
68export type RefreshPayload = {
69 type: 'video' | 'video-playlist' | 'actor'
70 url: string
71}
72
73export type EmailPayload = SendEmailOptions
74
75export type VideoFileImportPayload = {
76 videoUUID: string
77 filePath: string
78}
79
80export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
81export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
82
83export type VideoImportYoutubeDLPayload = {
84 type: VideoImportYoutubeDLPayloadType
85 videoImportId: number
86
87 fileExt?: string
88}
89export type VideoImportTorrentPayload = {
90 type: VideoImportTorrentPayloadType
91 videoImportId: number
92}
93export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload
94
95export type VideoRedundancyPayload = {
96 videoId: number
97}
98
99// Video transcoding payloads
100
101interface BaseTranscodingPayload {
102 videoUUID: string
103 isNewVideo?: boolean
104}
105
106export interface HLSTranscodingPayload extends BaseTranscodingPayload {
107 type: 'new-resolution-to-hls'
108 resolution: VideoResolution
109 copyCodecs: boolean
110
111 hasAudio: boolean
112 isPortraitMode?: boolean
113
114 autoDeleteWebTorrentIfNeeded: boolean
115 isMaxQuality: boolean
116}
117
118export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
119 type: 'new-resolution-to-webtorrent'
120 resolution: VideoResolution
121
122 hasAudio: boolean
123 createHLSIfNeeded: boolean
124
125 isPortraitMode?: boolean
126}
127
128export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
129 type: 'merge-audio-to-webtorrent'
130 resolution: VideoResolution
131 createHLSIfNeeded: true
132}
133
134export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
135 type: 'optimize-to-webtorrent'
136}
137
138export type VideoTranscodingPayload =
139 HLSTranscodingPayload
140 | NewWebTorrentResolutionTranscodingPayload
141 | OptimizeTranscodingPayload
142 | MergeAudioTranscodingPayload
143
144export interface VideoLiveEndingPayload {
145 videoId: number
146}
147
148export interface ActorKeysPayload {
149 actorId: number
150}
151
152export interface DeleteResumableUploadMetaFilePayload {
153 filepath: string
154}
155
156export interface MoveObjectStoragePayload {
157 videoUUID: string
158 isNewVideo: boolean
159}
160
161export type VideoEditorTaskCutPayload = VideoEditorTaskCut
162
163export type VideoEditorTaskIntroPayload = {
164 name: 'add-intro'
165
166 options: {
167 file: string
168 }
169}
170
171export type VideoEditorTaskOutroPayload = {
172 name: 'add-outro'
173
174 options: {
175 file: string
176 }
177}
178
179export type VideoEditorTaskWatermarkPayload = {
180 name: 'add-watermark'
181
182 options: {
183 file: string
184 }
185}
186
187export type VideoEditionTaskPayload =
188 VideoEditorTaskCutPayload |
189 VideoEditorTaskIntroPayload |
190 VideoEditorTaskOutroPayload |
191 VideoEditorTaskWatermarkPayload
192
193export interface VideoEditionPayload {
194 videoUUID: string
195 tasks: VideoEditionTaskPayload[]
196}