]>
Commit | Line | Data |
---|---|---|
1 | import { ContextType } from '../activitypub/context' | |
2 | import { VideoResolution } from '../videos/file/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-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 | ||
24 | export 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 | ||
37 | export type ActivitypubHttpBroadcastPayload = { | |
38 | uris: string[] | |
39 | signatureActorId?: number | |
40 | body: any | |
41 | contextType?: ContextType | |
42 | } | |
43 | ||
44 | export type ActivitypubFollowPayload = { | |
45 | followerActorId: number | |
46 | name: string | |
47 | host: string | |
48 | isAutoFollow?: boolean | |
49 | assertIsChannel?: boolean | |
50 | } | |
51 | ||
52 | export type FetchType = 'activity' | 'video-likes' | 'video-dislikes' | 'video-shares' | 'video-comments' | 'account-playlists' | |
53 | export type ActivitypubHttpFetcherPayload = { | |
54 | uri: string | |
55 | type: FetchType | |
56 | videoId?: number | |
57 | } | |
58 | ||
59 | export type ActivitypubHttpUnicastPayload = { | |
60 | uri: string | |
61 | signatureActorId?: number | |
62 | body: object | |
63 | contextType?: ContextType | |
64 | } | |
65 | ||
66 | export type RefreshPayload = { | |
67 | type: 'video' | 'video-playlist' | 'actor' | |
68 | url: string | |
69 | } | |
70 | ||
71 | export type EmailPayload = SendEmailOptions | |
72 | ||
73 | export type VideoFileImportPayload = { | |
74 | videoUUID: string | |
75 | filePath: string | |
76 | } | |
77 | ||
78 | export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file' | |
79 | export type VideoImportYoutubeDLPayloadType = 'youtube-dl' | |
80 | ||
81 | export type VideoImportYoutubeDLPayload = { | |
82 | type: VideoImportYoutubeDLPayloadType | |
83 | videoImportId: number | |
84 | ||
85 | fileExt?: string | |
86 | } | |
87 | export type VideoImportTorrentPayload = { | |
88 | type: VideoImportTorrentPayloadType | |
89 | videoImportId: number | |
90 | } | |
91 | export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload | |
92 | ||
93 | export type VideoRedundancyPayload = { | |
94 | videoId: number | |
95 | } | |
96 | ||
97 | // Video transcoding payloads | |
98 | ||
99 | interface BaseTranscodingPayload { | |
100 | videoUUID: string | |
101 | isNewVideo?: boolean | |
102 | } | |
103 | ||
104 | export interface HLSTranscodingPayload extends BaseTranscodingPayload { | |
105 | type: 'new-resolution-to-hls' | |
106 | resolution: VideoResolution | |
107 | copyCodecs: boolean | |
108 | ||
109 | hasAudio: boolean | |
110 | isPortraitMode?: boolean | |
111 | ||
112 | autoDeleteWebTorrentIfNeeded: boolean | |
113 | isMaxQuality: boolean | |
114 | } | |
115 | ||
116 | export interface NewResolutionTranscodingPayload extends BaseTranscodingPayload { | |
117 | type: 'new-resolution-to-webtorrent' | |
118 | resolution: VideoResolution | |
119 | ||
120 | hasAudio: boolean | |
121 | ||
122 | isPortraitMode?: boolean | |
123 | } | |
124 | ||
125 | export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload { | |
126 | type: 'merge-audio-to-webtorrent' | |
127 | resolution: VideoResolution | |
128 | } | |
129 | ||
130 | export interface OptimizeTranscodingPayload extends BaseTranscodingPayload { | |
131 | type: 'optimize-to-webtorrent' | |
132 | } | |
133 | ||
134 | export type VideoTranscodingPayload = | |
135 | HLSTranscodingPayload | |
136 | | NewResolutionTranscodingPayload | |
137 | | OptimizeTranscodingPayload | |
138 | | MergeAudioTranscodingPayload | |
139 | ||
140 | export interface VideoLiveEndingPayload { | |
141 | videoId: number | |
142 | } | |
143 | ||
144 | export interface ActorKeysPayload { | |
145 | actorId: number | |
146 | } | |
147 | ||
148 | export interface DeleteResumableUploadMetaFilePayload { | |
149 | filepath: string | |
150 | } | |
151 | ||
152 | export interface MoveObjectStoragePayload { | |
153 | videoUUID: string | |
154 | isNewVideo: boolean | |
155 | } |