]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - shared/models/server/job.model.ts
Ability for admins to set default upload values
[github/Chocobozzz/PeerTube.git] / shared / models / server / job.model.ts
... / ...
CommitLineData
1import { ContextType } from '../activitypub/context'
2import { VideoResolution } from '../videos/file/video-resolution.enum'
3import { SendEmailOptions } from './emailer.model'
4
5export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused'
6
7export type JobType =
8 | 'activitypub-http-unicast'
9 | 'activitypub-http-broadcast'
10 | 'activitypub-http-fetcher'
11 | 'activitypub-cleaner'
12 | 'activitypub-follow'
13 | 'video-file-import'
14 | 'video-transcoding'
15 | 'email'
16 | 'video-import'
17 | 'videos-views-stats'
18 | 'activitypub-refresher'
19 | 'video-redundancy'
20 | 'video-live-ending'
21 | 'actor-keys'
22 | 'move-to-object-storage'
23
24export interface Job {
25 id: number
26 state: JobState
27 type: JobType
28 data: any
29 priority: number
30 progress: number
31 error: any
32 createdAt: Date | string
33 finishedOn: Date | string
34 processedOn: Date | string
35}
36
37export type ActivitypubHttpBroadcastPayload = {
38 uris: string[]
39 signatureActorId?: number
40 body: any
41 contextType?: ContextType
42}
43
44export type ActivitypubFollowPayload = {
45 followerActorId: number
46 name: string
47 host: string
48 isAutoFollow?: boolean
49 assertIsChannel?: boolean
50}
51
52export type FetchType = 'activity' | 'video-likes' | 'video-dislikes' | 'video-shares' | 'video-comments' | 'account-playlists'
53export type ActivitypubHttpFetcherPayload = {
54 uri: string
55 type: FetchType
56 videoId?: number
57}
58
59export type ActivitypubHttpUnicastPayload = {
60 uri: string
61 signatureActorId?: number
62 body: object
63 contextType?: ContextType
64}
65
66export type RefreshPayload = {
67 type: 'video' | 'video-playlist' | 'actor'
68 url: string
69}
70
71export type EmailPayload = SendEmailOptions
72
73export type VideoFileImportPayload = {
74 videoUUID: string
75 filePath: string
76}
77
78export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
79export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
80
81export type VideoImportYoutubeDLPayload = {
82 type: VideoImportYoutubeDLPayloadType
83 videoImportId: number
84
85 fileExt?: string
86}
87export type VideoImportTorrentPayload = {
88 type: VideoImportTorrentPayloadType
89 videoImportId: number
90}
91export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload
92
93export type VideoRedundancyPayload = {
94 videoId: number
95}
96
97// Video transcoding payloads
98
99interface BaseTranscodingPayload {
100 videoUUID: string
101 isNewVideo?: boolean
102}
103
104export interface HLSTranscodingPayload extends BaseTranscodingPayload {
105 type: 'new-resolution-to-hls'
106 isPortraitMode?: boolean
107 resolution: VideoResolution
108 copyCodecs: boolean
109
110 autoDeleteWebTorrentIfNeeded: boolean
111 isMaxQuality: boolean
112}
113
114export interface NewResolutionTranscodingPayload extends BaseTranscodingPayload {
115 type: 'new-resolution-to-webtorrent'
116 isPortraitMode?: boolean
117 resolution: VideoResolution
118}
119
120export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
121 type: 'merge-audio-to-webtorrent'
122 resolution: VideoResolution
123}
124
125export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
126 type: 'optimize-to-webtorrent'
127}
128
129export type VideoTranscodingPayload =
130 HLSTranscodingPayload
131 | NewResolutionTranscodingPayload
132 | OptimizeTranscodingPayload
133 | MergeAudioTranscodingPayload
134
135export interface VideoLiveEndingPayload {
136 videoId: number
137}
138
139export interface ActorKeysPayload {
140 actorId: number
141}
142
143export interface DeleteResumableUploadMetaFilePayload {
144 filepath: string
145}
146
147export interface MoveObjectStoragePayload {
148 videoUUID: string
149 isNewVideo: boolean
150}