]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - 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
e307e4fc 1import { ContextType } from '../activitypub/context'
c729caf6 2import { VideoEditorTaskCut } from '../videos/editor'
ad5db104 3import { VideoResolution } from '../videos/file/video-resolution.enum'
0fecf427 4import { SendEmailOptions } from './emailer.model'
8dc8a34e 5
402145b8 6export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused'
94a5ff8a 7
a1587156
C
8export type JobType =
9 | 'activitypub-http-unicast'
10 | 'activitypub-http-broadcast'
11 | 'activitypub-http-fetcher'
74d249bc 12 | 'activitypub-cleaner'
a1587156
C
13 | 'activitypub-follow'
14 | 'video-file-import'
15 | 'video-transcoding'
16 | 'email'
17 | 'video-import'
51353d9a 18 | 'videos-views-stats'
a1587156
C
19 | 'activitypub-refresher'
20 | 'video-redundancy'
a5cf76af 21 | 'video-live-ending'
8795d6f2 22 | 'actor-keys'
0305db28 23 | 'move-to-object-storage'
c729caf6 24 | 'video-edition'
5cd80545
C
25
26export interface Job {
27 id: number
28 state: JobState
94a5ff8a 29 type: JobType
a1587156 30 data: any
77d7e851 31 priority: number
3b01f4c0 32 progress: number
a1587156 33 error: any
1061c73f
C
34 createdAt: Date | string
35 finishedOn: Date | string
36 processedOn: Date | string
5cd80545 37}
8dc8a34e
C
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
8dc8a34e
C
59}
60
61export type ActivitypubHttpUnicastPayload = {
62 uri: string
63 signatureActorId?: number
db4b15f2 64 body: object
8dc8a34e
C
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
2158ac90
RK
80export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
81export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
82
8dc8a34e 83export type VideoImportYoutubeDLPayload = {
2158ac90 84 type: VideoImportYoutubeDLPayloadType
8dc8a34e
C
85 videoImportId: number
86
8dc8a34e
C
87 fileExt?: string
88}
89export type VideoImportTorrentPayload = {
2158ac90 90 type: VideoImportTorrentPayloadType
8dc8a34e
C
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
24516aa2
C
106export interface HLSTranscodingPayload extends BaseTranscodingPayload {
107 type: 'new-resolution-to-hls'
8dc8a34e
C
108 resolution: VideoResolution
109 copyCodecs: boolean
ad5db104 110
cbe2f36d
C
111 hasAudio: boolean
112 isPortraitMode?: boolean
113
ad5db104 114 autoDeleteWebTorrentIfNeeded: boolean
9129b769 115 isMaxQuality: boolean
8dc8a34e
C
116}
117
0f11ec8d 118export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
24516aa2 119 type: 'new-resolution-to-webtorrent'
8dc8a34e 120 resolution: VideoResolution
cbe2f36d
C
121
122 hasAudio: boolean
0f11ec8d 123 createHLSIfNeeded: boolean
cbe2f36d
C
124
125 isPortraitMode?: boolean
8dc8a34e
C
126}
127
128export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
24516aa2 129 type: 'merge-audio-to-webtorrent'
8dc8a34e 130 resolution: VideoResolution
0f11ec8d 131 createHLSIfNeeded: true
8dc8a34e
C
132}
133
134export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
24516aa2 135 type: 'optimize-to-webtorrent'
8dc8a34e
C
136}
137
138export type VideoTranscodingPayload =
139 HLSTranscodingPayload
0f11ec8d 140 | NewWebTorrentResolutionTranscodingPayload
8dc8a34e
C
141 | OptimizeTranscodingPayload
142 | MergeAudioTranscodingPayload
a5cf76af
C
143
144export interface VideoLiveEndingPayload {
145 videoId: number
146}
8795d6f2
C
147
148export interface ActorKeysPayload {
149 actorId: number
150}
0305db28 151
276250f0
RK
152export interface DeleteResumableUploadMetaFilePayload {
153 filepath: string
154}
155
0305db28
JB
156export interface MoveObjectStoragePayload {
157 videoUUID: string
158 isNewVideo: boolean
159}
c729caf6
C
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}