]>
Commit | Line | Data |
---|---|---|
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 | ||
21 | export interface Job { | |
22 | id: number | |
23 | state: JobState | |
24 | type: JobType | |
25 | data: any | |
26 | progress: number | |
27 | error: any | |
28 | createdAt: Date | string | |
29 | finishedOn: Date | string | |
30 | processedOn: Date | string | |
31 | } | |
32 | ||
33 | export type ActivitypubHttpBroadcastPayload = { | |
34 | uris: string[] | |
35 | signatureActorId?: number | |
36 | body: any | |
37 | contextType?: ContextType | |
38 | } | |
39 | ||
40 | export type ActivitypubFollowPayload = { | |
41 | followerActorId: number | |
42 | name: string | |
43 | host: string | |
44 | isAutoFollow?: boolean | |
45 | assertIsChannel?: boolean | |
46 | } | |
47 | ||
48 | export type FetchType = 'activity' | 'video-likes' | 'video-dislikes' | 'video-shares' | 'video-comments' | 'account-playlists' | |
49 | export type ActivitypubHttpFetcherPayload = { | |
50 | uri: string | |
51 | type: FetchType | |
52 | videoId?: number | |
53 | accountId?: number | |
54 | } | |
55 | ||
56 | export type ActivitypubHttpUnicastPayload = { | |
57 | uri: string | |
58 | signatureActorId?: number | |
59 | body: any | |
60 | contextType?: ContextType | |
61 | } | |
62 | ||
63 | export type RefreshPayload = { | |
64 | type: 'video' | 'video-playlist' | 'actor' | |
65 | url: string | |
66 | } | |
67 | ||
68 | export type EmailPayload = SendEmailOptions | |
69 | ||
70 | export type VideoFileImportPayload = { | |
71 | videoUUID: string | |
72 | filePath: string | |
73 | } | |
74 | ||
75 | export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file' | |
76 | export type VideoImportYoutubeDLPayloadType = 'youtube-dl' | |
77 | ||
78 | export type VideoImportYoutubeDLPayload = { | |
79 | type: VideoImportYoutubeDLPayloadType | |
80 | videoImportId: number | |
81 | ||
82 | generateThumbnail: boolean | |
83 | generatePreview: boolean | |
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 | } | |
109 | ||
110 | export interface NewResolutionTranscodingPayload extends BaseTranscodingPayload { | |
111 | type: 'new-resolution-to-webtorrent' | |
112 | isPortraitMode?: boolean | |
113 | resolution: VideoResolution | |
114 | } | |
115 | ||
116 | export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload { | |
117 | type: 'merge-audio-to-webtorrent' | |
118 | resolution: VideoResolution | |
119 | } | |
120 | ||
121 | export interface OptimizeTranscodingPayload extends BaseTranscodingPayload { | |
122 | type: 'optimize-to-webtorrent' | |
123 | } | |
124 | ||
125 | export type VideoTranscodingPayload = | |
126 | HLSTranscodingPayload | |
127 | | NewResolutionTranscodingPayload | |
128 | | OptimizeTranscodingPayload | |
129 | | MergeAudioTranscodingPayload | |
130 | ||
131 | export interface VideoLiveEndingPayload { | |
132 | videoId: number | |
133 | } |