2020-04-24 04:33:01 -05:00
|
|
|
import { ContextType } from '../activitypub/context'
|
2022-03-22 08:35:04 -05:00
|
|
|
import { VideoState } from '../videos'
|
2022-03-22 10:58:49 -05:00
|
|
|
import { VideoStudioTaskCut } from '../videos/studio'
|
2021-11-18 07:35:08 -06:00
|
|
|
import { VideoResolution } from '../videos/file/video-resolution.enum'
|
2020-08-27 02:58:27 -05:00
|
|
|
import { SendEmailOptions } from './emailer.model'
|
2020-04-23 02:32:53 -05:00
|
|
|
|
2020-12-14 05:00:35 -06:00
|
|
|
export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused'
|
2018-01-25 08:05:18 -06:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type JobType =
|
|
|
|
| 'activitypub-http-unicast'
|
|
|
|
| 'activitypub-http-broadcast'
|
|
|
|
| 'activitypub-http-fetcher'
|
2021-02-26 09:26:27 -06:00
|
|
|
| 'activitypub-cleaner'
|
2020-01-31 09:56:52 -06:00
|
|
|
| 'activitypub-follow'
|
|
|
|
| 'video-file-import'
|
|
|
|
| 'video-transcoding'
|
|
|
|
| 'email'
|
|
|
|
| 'video-import'
|
2021-11-09 03:11:20 -06:00
|
|
|
| 'videos-views-stats'
|
2020-01-31 09:56:52 -06:00
|
|
|
| 'activitypub-refresher'
|
|
|
|
| 'video-redundancy'
|
2020-09-25 03:04:21 -05:00
|
|
|
| 'video-live-ending'
|
2021-02-26 07:22:25 -06:00
|
|
|
| 'actor-keys'
|
2022-03-16 09:34:21 -05:00
|
|
|
| 'manage-video-torrent'
|
2021-08-17 01:26:20 -05:00
|
|
|
| 'move-to-object-storage'
|
2022-03-22 10:58:49 -05:00
|
|
|
| 'video-studio-edition'
|
2017-11-30 03:51:13 -06:00
|
|
|
|
|
|
|
export interface Job {
|
|
|
|
id: number
|
|
|
|
state: JobState
|
2018-01-25 08:05:18 -06:00
|
|
|
type: JobType
|
2020-01-31 09:56:52 -06:00
|
|
|
data: any
|
2021-01-21 09:57:21 -06:00
|
|
|
priority: number
|
2021-01-21 07:42:43 -06:00
|
|
|
progress: number
|
2020-01-31 09:56:52 -06:00
|
|
|
error: any
|
2019-12-04 07:49:59 -06:00
|
|
|
createdAt: Date | string
|
|
|
|
finishedOn: Date | string
|
|
|
|
processedOn: Date | string
|
2017-11-30 03:51:13 -06:00
|
|
|
}
|
2020-04-23 02:32:53 -05:00
|
|
|
|
|
|
|
export type ActivitypubHttpBroadcastPayload = {
|
|
|
|
uris: string[]
|
2022-03-23 10:14:33 -05:00
|
|
|
contextType: ContextType
|
2020-04-23 02:32:53 -05:00
|
|
|
body: any
|
2022-03-23 10:14:33 -05:00
|
|
|
signatureActorId?: number
|
2020-04-23 02:32:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export type ActivitypubFollowPayload = {
|
|
|
|
followerActorId: number
|
|
|
|
name: string
|
|
|
|
host: string
|
|
|
|
isAutoFollow?: boolean
|
|
|
|
assertIsChannel?: boolean
|
|
|
|
}
|
|
|
|
|
2022-03-18 05:17:35 -05:00
|
|
|
export type FetchType = 'activity' | 'video-shares' | 'video-comments' | 'account-playlists'
|
2020-04-23 02:32:53 -05:00
|
|
|
export type ActivitypubHttpFetcherPayload = {
|
|
|
|
uri: string
|
|
|
|
type: FetchType
|
|
|
|
videoId?: number
|
|
|
|
}
|
|
|
|
|
|
|
|
export type ActivitypubHttpUnicastPayload = {
|
|
|
|
uri: string
|
2022-03-23 10:14:33 -05:00
|
|
|
contextType: ContextType
|
2020-04-23 02:32:53 -05:00
|
|
|
signatureActorId?: number
|
2021-03-08 07:24:11 -06:00
|
|
|
body: object
|
2020-04-23 02:32:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export type RefreshPayload = {
|
|
|
|
type: 'video' | 'video-playlist' | 'actor'
|
|
|
|
url: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type EmailPayload = SendEmailOptions
|
|
|
|
|
|
|
|
export type VideoFileImportPayload = {
|
|
|
|
videoUUID: string
|
|
|
|
filePath: string
|
|
|
|
}
|
|
|
|
|
2020-05-14 04:10:26 -05:00
|
|
|
export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
|
|
|
|
export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
|
|
|
|
|
2020-04-23 02:32:53 -05:00
|
|
|
export type VideoImportYoutubeDLPayload = {
|
2020-05-14 04:10:26 -05:00
|
|
|
type: VideoImportYoutubeDLPayloadType
|
2020-04-23 02:32:53 -05:00
|
|
|
videoImportId: number
|
|
|
|
|
|
|
|
fileExt?: string
|
|
|
|
}
|
|
|
|
export type VideoImportTorrentPayload = {
|
2020-05-14 04:10:26 -05:00
|
|
|
type: VideoImportTorrentPayloadType
|
2020-04-23 02:32:53 -05:00
|
|
|
videoImportId: number
|
|
|
|
}
|
|
|
|
export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload
|
|
|
|
|
|
|
|
export type VideoRedundancyPayload = {
|
|
|
|
videoId: number
|
|
|
|
}
|
|
|
|
|
2022-03-16 09:34:21 -05:00
|
|
|
export type ManageVideoTorrentPayload =
|
|
|
|
{
|
|
|
|
action: 'create'
|
|
|
|
videoId: number
|
|
|
|
videoFileId: number
|
|
|
|
} | {
|
|
|
|
action: 'update-metadata'
|
|
|
|
|
|
|
|
videoId?: number
|
|
|
|
streamingPlaylistId?: number
|
|
|
|
|
|
|
|
videoFileId: number
|
|
|
|
}
|
|
|
|
|
2020-04-23 02:32:53 -05:00
|
|
|
// Video transcoding payloads
|
|
|
|
|
|
|
|
interface BaseTranscodingPayload {
|
|
|
|
videoUUID: string
|
|
|
|
isNewVideo?: boolean
|
|
|
|
}
|
|
|
|
|
2021-01-21 08:58:17 -06:00
|
|
|
export interface HLSTranscodingPayload extends BaseTranscodingPayload {
|
|
|
|
type: 'new-resolution-to-hls'
|
2020-04-23 02:32:53 -05:00
|
|
|
resolution: VideoResolution
|
|
|
|
copyCodecs: boolean
|
2021-11-18 07:35:08 -06:00
|
|
|
|
2022-01-06 10:55:37 -06:00
|
|
|
hasAudio: boolean
|
|
|
|
isPortraitMode?: boolean
|
|
|
|
|
2021-11-18 07:35:08 -06:00
|
|
|
autoDeleteWebTorrentIfNeeded: boolean
|
2021-02-08 03:51:10 -06:00
|
|
|
isMaxQuality: boolean
|
2020-04-23 02:32:53 -05:00
|
|
|
}
|
|
|
|
|
2022-02-01 04:16:45 -06:00
|
|
|
export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
|
2021-01-21 08:58:17 -06:00
|
|
|
type: 'new-resolution-to-webtorrent'
|
2020-04-23 02:32:53 -05:00
|
|
|
resolution: VideoResolution
|
2022-01-06 10:55:37 -06:00
|
|
|
|
|
|
|
hasAudio: boolean
|
2022-02-01 04:16:45 -06:00
|
|
|
createHLSIfNeeded: boolean
|
2022-01-06 10:55:37 -06:00
|
|
|
|
|
|
|
isPortraitMode?: boolean
|
2020-04-23 02:32:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
|
2021-01-21 08:58:17 -06:00
|
|
|
type: 'merge-audio-to-webtorrent'
|
2020-04-23 02:32:53 -05:00
|
|
|
resolution: VideoResolution
|
2022-02-01 04:16:45 -06:00
|
|
|
createHLSIfNeeded: true
|
2020-04-23 02:32:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
|
2021-01-21 08:58:17 -06:00
|
|
|
type: 'optimize-to-webtorrent'
|
2020-04-23 02:32:53 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export type VideoTranscodingPayload =
|
|
|
|
HLSTranscodingPayload
|
2022-02-01 04:16:45 -06:00
|
|
|
| NewWebTorrentResolutionTranscodingPayload
|
2020-04-23 02:32:53 -05:00
|
|
|
| OptimizeTranscodingPayload
|
|
|
|
| MergeAudioTranscodingPayload
|
2020-09-25 03:04:21 -05:00
|
|
|
|
|
|
|
export interface VideoLiveEndingPayload {
|
|
|
|
videoId: number
|
2022-04-21 02:06:52 -05:00
|
|
|
publishedAt: string
|
2022-05-03 04:38:07 -05:00
|
|
|
liveSessionId: number
|
2022-06-16 06:39:57 -05:00
|
|
|
streamingPlaylistId: number
|
2022-04-21 02:06:52 -05:00
|
|
|
|
|
|
|
replayDirectory?: string
|
2020-09-25 03:04:21 -05:00
|
|
|
}
|
2021-02-26 07:22:25 -06:00
|
|
|
|
|
|
|
export interface ActorKeysPayload {
|
|
|
|
actorId: number
|
|
|
|
}
|
2021-08-17 01:26:20 -05:00
|
|
|
|
2021-10-25 10:42:20 -05:00
|
|
|
export interface DeleteResumableUploadMetaFilePayload {
|
|
|
|
filepath: string
|
|
|
|
}
|
|
|
|
|
2021-08-17 01:26:20 -05:00
|
|
|
export interface MoveObjectStoragePayload {
|
|
|
|
videoUUID: string
|
|
|
|
isNewVideo: boolean
|
2022-03-22 08:35:04 -05:00
|
|
|
previousVideoState: VideoState
|
2021-08-17 01:26:20 -05:00
|
|
|
}
|
2022-02-11 03:51:33 -06:00
|
|
|
|
2022-03-22 10:58:49 -05:00
|
|
|
export type VideoStudioTaskCutPayload = VideoStudioTaskCut
|
2022-02-11 03:51:33 -06:00
|
|
|
|
2022-03-22 10:58:49 -05:00
|
|
|
export type VideoStudioTaskIntroPayload = {
|
2022-02-11 03:51:33 -06:00
|
|
|
name: 'add-intro'
|
|
|
|
|
|
|
|
options: {
|
|
|
|
file: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-22 10:58:49 -05:00
|
|
|
export type VideoStudioTaskOutroPayload = {
|
2022-02-11 03:51:33 -06:00
|
|
|
name: 'add-outro'
|
|
|
|
|
|
|
|
options: {
|
|
|
|
file: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-22 10:58:49 -05:00
|
|
|
export type VideoStudioTaskWatermarkPayload = {
|
2022-02-11 03:51:33 -06:00
|
|
|
name: 'add-watermark'
|
|
|
|
|
|
|
|
options: {
|
|
|
|
file: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-22 10:58:49 -05:00
|
|
|
export type VideoStudioTaskPayload =
|
|
|
|
VideoStudioTaskCutPayload |
|
|
|
|
VideoStudioTaskIntroPayload |
|
|
|
|
VideoStudioTaskOutroPayload |
|
|
|
|
VideoStudioTaskWatermarkPayload
|
2022-02-11 03:51:33 -06:00
|
|
|
|
2022-03-22 10:58:49 -05:00
|
|
|
export interface VideoStudioEditionPayload {
|
2022-02-11 03:51:33 -06:00
|
|
|
videoUUID: string
|
2022-03-22 10:58:49 -05:00
|
|
|
tasks: VideoStudioTaskPayload[]
|
2022-02-11 03:51:33 -06:00
|
|
|
}
|