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