]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/models/server/job.model.ts
Add ability to update torrents cache in client
[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'
11 | 'activitypub-follow'
12 | 'video-file-import'
13 | 'video-transcoding'
14 | 'email'
15 | 'video-import'
16 | 'videos-views'
17 | 'activitypub-refresher'
18 | 'video-redundancy'
a5cf76af 19 | 'video-live-ending'
5cd80545
C
20
21export interface Job {
22 id: number
23 state: JobState
94a5ff8a 24 type: JobType
a1587156 25 data: any
77d7e851 26 priority: number
3b01f4c0 27 progress: number
a1587156 28 error: any
1061c73f
C
29 createdAt: Date | string
30 finishedOn: Date | string
31 processedOn: Date | string
5cd80545 32}
8dc8a34e
C
33
34export type ActivitypubHttpBroadcastPayload = {
35 uris: string[]
36 signatureActorId?: number
37 body: any
38 contextType?: ContextType
39}
40
41export type ActivitypubFollowPayload = {
42 followerActorId: number
43 name: string
44 host: string
45 isAutoFollow?: boolean
46 assertIsChannel?: boolean
47}
48
49export type FetchType = 'activity' | 'video-likes' | 'video-dislikes' | 'video-shares' | 'video-comments' | 'account-playlists'
50export type ActivitypubHttpFetcherPayload = {
51 uri: string
52 type: FetchType
53 videoId?: number
54 accountId?: number
55}
56
57export type ActivitypubHttpUnicastPayload = {
58 uri: string
59 signatureActorId?: number
60 body: any
61 contextType?: ContextType
62}
63
64export type RefreshPayload = {
65 type: 'video' | 'video-playlist' | 'actor'
66 url: string
67}
68
69export type EmailPayload = SendEmailOptions
70
71export type VideoFileImportPayload = {
72 videoUUID: string
73 filePath: string
74}
75
2158ac90
RK
76export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
77export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
78
8dc8a34e 79export type VideoImportYoutubeDLPayload = {
2158ac90 80 type: VideoImportYoutubeDLPayloadType
8dc8a34e
C
81 videoImportId: number
82
8dc8a34e
C
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
24516aa2
C
102export interface HLSTranscodingPayload extends BaseTranscodingPayload {
103 type: 'new-resolution-to-hls'
8dc8a34e
C
104 isPortraitMode?: boolean
105 resolution: VideoResolution
106 copyCodecs: boolean
9129b769 107 isMaxQuality: boolean
8dc8a34e
C
108}
109
110export interface NewResolutionTranscodingPayload extends BaseTranscodingPayload {
24516aa2 111 type: 'new-resolution-to-webtorrent'
8dc8a34e
C
112 isPortraitMode?: boolean
113 resolution: VideoResolution
114}
115
116export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
24516aa2 117 type: 'merge-audio-to-webtorrent'
8dc8a34e
C
118 resolution: VideoResolution
119}
120
121export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
24516aa2 122 type: 'optimize-to-webtorrent'
8dc8a34e
C
123}
124
125export type VideoTranscodingPayload =
126 HLSTranscodingPayload
127 | NewResolutionTranscodingPayload
128 | OptimizeTranscodingPayload
129 | MergeAudioTranscodingPayload
a5cf76af
C
130
131export interface VideoLiveEndingPayload {
132 videoId: number
133}