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