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