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