2020-04-24 11:33:01 +02:00
|
|
|
import { ContextType } from '../activitypub/context'
|
2022-03-22 14:35:04 +01:00
|
|
|
import { VideoState } from '../videos'
|
2021-11-18 14:35:08 +01:00
|
|
|
import { VideoResolution } from '../videos/file/video-resolution.enum'
|
2022-08-05 10:36:19 +02:00
|
|
|
import { VideoStudioTaskCut } from '../videos/studio'
|
2020-08-27 09:58:27 +02:00
|
|
|
import { SendEmailOptions } from './emailer.model'
|
2020-04-23 09:32:53 +02:00
|
|
|
|
2022-08-08 10:42:08 +02:00
|
|
|
export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | 'waiting-children'
|
2018-01-25 15:05:18 +01:00
|
|
|
|
2020-01-31 16:56:52 +01:00
|
|
|
export type JobType =
|
2021-02-26 16:26:27 +01:00
|
|
|
| 'activitypub-cleaner'
|
2020-01-31 16:56:52 +01:00
|
|
|
| 'activitypub-follow'
|
2022-08-10 10:34:39 +02:00
|
|
|
| 'activitypub-http-broadcast-parallel'
|
|
|
|
| 'activitypub-http-broadcast'
|
|
|
|
| 'activitypub-http-fetcher'
|
|
|
|
| 'activitypub-http-unicast'
|
2020-01-31 16:56:52 +01:00
|
|
|
| 'activitypub-refresher'
|
2021-02-26 14:22:25 +01:00
|
|
|
| 'actor-keys'
|
2022-08-10 10:34:39 +02:00
|
|
|
| 'after-video-channel-import'
|
|
|
|
| 'email'
|
|
|
|
| 'federate-video'
|
2023-04-21 14:55:10 +02:00
|
|
|
| 'transcoding-job-builder'
|
2022-03-16 15:34:21 +01:00
|
|
|
| 'manage-video-torrent'
|
2021-08-17 08:26:20 +02:00
|
|
|
| 'move-to-object-storage'
|
2022-08-08 15:48:17 +02:00
|
|
|
| 'notify'
|
2022-08-10 10:34:39 +02:00
|
|
|
| 'video-channel-import'
|
|
|
|
| 'video-file-import'
|
|
|
|
| 'video-import'
|
|
|
|
| 'video-live-ending'
|
|
|
|
| 'video-redundancy'
|
|
|
|
| 'video-studio-edition'
|
|
|
|
| 'video-transcoding'
|
|
|
|
| 'videos-views-stats'
|
2017-11-30 10:51:13 +01:00
|
|
|
|
|
|
|
export interface Job {
|
2022-08-08 10:42:08 +02:00
|
|
|
id: number | string
|
|
|
|
state: JobState | 'unknown'
|
2018-01-25 15:05:18 +01:00
|
|
|
type: JobType
|
2020-01-31 16:56:52 +01:00
|
|
|
data: any
|
2021-01-21 16:57:21 +01:00
|
|
|
priority: number
|
2021-01-21 14:42:43 +01:00
|
|
|
progress: number
|
2020-01-31 16:56:52 +01:00
|
|
|
error: any
|
2019-12-04 14:49:59 +01:00
|
|
|
createdAt: Date | string
|
|
|
|
finishedOn: Date | string
|
|
|
|
processedOn: Date | string
|
2023-04-21 14:55:10 +02:00
|
|
|
|
|
|
|
parent?: {
|
|
|
|
id: string
|
|
|
|
}
|
2017-11-30 10:51:13 +01:00
|
|
|
}
|
2020-04-23 09:32:53 +02:00
|
|
|
|
|
|
|
export type ActivitypubHttpBroadcastPayload = {
|
|
|
|
uris: string[]
|
2022-03-23 16:14:33 +01:00
|
|
|
contextType: ContextType
|
2020-04-23 09:32:53 +02:00
|
|
|
body: any
|
2022-03-23 16:14:33 +01:00
|
|
|
signatureActorId?: number
|
2020-04-23 09:32:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export type ActivitypubFollowPayload = {
|
|
|
|
followerActorId: number
|
|
|
|
name: string
|
|
|
|
host: string
|
|
|
|
isAutoFollow?: boolean
|
|
|
|
assertIsChannel?: boolean
|
|
|
|
}
|
|
|
|
|
2022-03-18 11:17:35 +01:00
|
|
|
export type FetchType = 'activity' | 'video-shares' | 'video-comments' | 'account-playlists'
|
2020-04-23 09:32:53 +02:00
|
|
|
export type ActivitypubHttpFetcherPayload = {
|
|
|
|
uri: string
|
|
|
|
type: FetchType
|
|
|
|
videoId?: number
|
|
|
|
}
|
|
|
|
|
|
|
|
export type ActivitypubHttpUnicastPayload = {
|
|
|
|
uri: string
|
2022-03-23 16:14:33 +01:00
|
|
|
contextType: ContextType
|
2020-04-23 09:32:53 +02:00
|
|
|
signatureActorId?: number
|
2021-03-08 14:24:11 +01:00
|
|
|
body: object
|
2020-04-23 09:32:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export type RefreshPayload = {
|
|
|
|
type: 'video' | 'video-playlist' | 'actor'
|
|
|
|
url: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export type EmailPayload = SendEmailOptions
|
|
|
|
|
|
|
|
export type VideoFileImportPayload = {
|
|
|
|
videoUUID: string
|
|
|
|
filePath: string
|
|
|
|
}
|
|
|
|
|
2022-08-10 09:53:39 +02:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2020-05-14 11:10:26 +02:00
|
|
|
export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
|
|
|
|
export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
|
|
|
|
|
2022-08-10 09:53:39 +02:00
|
|
|
export interface VideoImportYoutubeDLPayload {
|
2020-05-14 11:10:26 +02:00
|
|
|
type: VideoImportYoutubeDLPayloadType
|
2020-04-23 09:32:53 +02:00
|
|
|
videoImportId: number
|
|
|
|
|
|
|
|
fileExt?: string
|
|
|
|
}
|
2022-08-10 09:53:39 +02:00
|
|
|
|
|
|
|
export interface VideoImportTorrentPayload {
|
2020-05-14 11:10:26 +02:00
|
|
|
type: VideoImportTorrentPayloadType
|
2020-04-23 09:32:53 +02:00
|
|
|
videoImportId: number
|
|
|
|
}
|
2022-08-10 09:53:39 +02:00
|
|
|
|
|
|
|
export type VideoImportPayload = (VideoImportYoutubeDLPayload | VideoImportTorrentPayload) & {
|
|
|
|
preventException: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoImportPreventExceptionResult {
|
|
|
|
resultType: 'success' | 'error'
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
2020-04-23 09:32:53 +02:00
|
|
|
|
|
|
|
export type VideoRedundancyPayload = {
|
|
|
|
videoId: number
|
|
|
|
}
|
|
|
|
|
2022-03-16 15:34:21 +01:00
|
|
|
export type ManageVideoTorrentPayload =
|
|
|
|
{
|
|
|
|
action: 'create'
|
|
|
|
videoId: number
|
|
|
|
videoFileId: number
|
|
|
|
} | {
|
|
|
|
action: 'update-metadata'
|
|
|
|
|
|
|
|
videoId?: number
|
|
|
|
streamingPlaylistId?: number
|
|
|
|
|
|
|
|
videoFileId: number
|
|
|
|
}
|
|
|
|
|
2020-04-23 09:32:53 +02:00
|
|
|
// Video transcoding payloads
|
|
|
|
|
|
|
|
interface BaseTranscodingPayload {
|
|
|
|
videoUUID: string
|
|
|
|
isNewVideo?: boolean
|
|
|
|
}
|
|
|
|
|
2021-01-21 15:58:17 +01:00
|
|
|
export interface HLSTranscodingPayload extends BaseTranscodingPayload {
|
|
|
|
type: 'new-resolution-to-hls'
|
2020-04-23 09:32:53 +02:00
|
|
|
resolution: VideoResolution
|
2023-04-21 14:55:10 +02:00
|
|
|
fps: number
|
2020-04-23 09:32:53 +02:00
|
|
|
copyCodecs: boolean
|
2021-11-18 14:35:08 +01:00
|
|
|
|
2023-04-21 14:55:10 +02:00
|
|
|
deleteWebTorrentFiles: boolean
|
2020-04-23 09:32:53 +02:00
|
|
|
}
|
|
|
|
|
2022-02-01 11:16:45 +01:00
|
|
|
export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
|
2021-01-21 15:58:17 +01:00
|
|
|
type: 'new-resolution-to-webtorrent'
|
2020-04-23 09:32:53 +02:00
|
|
|
resolution: VideoResolution
|
2023-04-21 14:55:10 +02:00
|
|
|
fps: number
|
2020-04-23 09:32:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
|
2021-01-21 15:58:17 +01:00
|
|
|
type: 'merge-audio-to-webtorrent'
|
2023-04-21 16:31:04 +02:00
|
|
|
|
2020-04-23 09:32:53 +02:00
|
|
|
resolution: VideoResolution
|
2023-04-21 14:55:10 +02:00
|
|
|
fps: number
|
2023-04-21 16:31:04 +02:00
|
|
|
|
|
|
|
hasChildren: boolean
|
2020-04-23 09:32:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
|
2021-01-21 15:58:17 +01:00
|
|
|
type: 'optimize-to-webtorrent'
|
2023-04-21 14:55:10 +02:00
|
|
|
|
|
|
|
quickTranscode: boolean
|
2023-04-21 16:31:04 +02:00
|
|
|
|
|
|
|
hasChildren: boolean
|
2020-04-23 09:32:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export type VideoTranscodingPayload =
|
|
|
|
HLSTranscodingPayload
|
2022-02-01 11:16:45 +01:00
|
|
|
| NewWebTorrentResolutionTranscodingPayload
|
2020-04-23 09:32:53 +02:00
|
|
|
| OptimizeTranscodingPayload
|
|
|
|
| MergeAudioTranscodingPayload
|
2020-09-25 10:04:21 +02:00
|
|
|
|
|
|
|
export interface VideoLiveEndingPayload {
|
|
|
|
videoId: number
|
2022-04-21 09:06:52 +02:00
|
|
|
publishedAt: string
|
2022-05-03 11:38:07 +02:00
|
|
|
liveSessionId: number
|
2022-06-16 13:39:57 +02:00
|
|
|
streamingPlaylistId: number
|
2022-04-21 09:06:52 +02:00
|
|
|
|
|
|
|
replayDirectory?: string
|
2020-09-25 10:04:21 +02:00
|
|
|
}
|
2021-02-26 14:22:25 +01:00
|
|
|
|
|
|
|
export interface ActorKeysPayload {
|
|
|
|
actorId: number
|
|
|
|
}
|
2021-08-17 08:26:20 +02:00
|
|
|
|
2021-10-25 17:42:20 +02:00
|
|
|
export interface DeleteResumableUploadMetaFilePayload {
|
|
|
|
filepath: string
|
|
|
|
}
|
|
|
|
|
2021-08-17 08:26:20 +02:00
|
|
|
export interface MoveObjectStoragePayload {
|
|
|
|
videoUUID: string
|
|
|
|
isNewVideo: boolean
|
2022-03-22 14:35:04 +01:00
|
|
|
previousVideoState: VideoState
|
2021-08-17 08:26:20 +02:00
|
|
|
}
|
2022-02-11 10:51:33 +01:00
|
|
|
|
2022-03-22 16:58:49 +01:00
|
|
|
export type VideoStudioTaskCutPayload = VideoStudioTaskCut
|
2022-02-11 10:51:33 +01:00
|
|
|
|
2022-03-22 16:58:49 +01:00
|
|
|
export type VideoStudioTaskIntroPayload = {
|
2022-02-11 10:51:33 +01:00
|
|
|
name: 'add-intro'
|
|
|
|
|
|
|
|
options: {
|
|
|
|
file: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-22 16:58:49 +01:00
|
|
|
export type VideoStudioTaskOutroPayload = {
|
2022-02-11 10:51:33 +01:00
|
|
|
name: 'add-outro'
|
|
|
|
|
|
|
|
options: {
|
|
|
|
file: string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-22 16:58:49 +01:00
|
|
|
export type VideoStudioTaskWatermarkPayload = {
|
2022-02-11 10:51:33 +01:00
|
|
|
name: 'add-watermark'
|
|
|
|
|
|
|
|
options: {
|
|
|
|
file: string
|
2023-05-04 15:29:34 +02:00
|
|
|
|
|
|
|
watermarkSizeRatio: number
|
|
|
|
horitonzalMarginRatio: number
|
|
|
|
verticalMarginRatio: number
|
2022-02-11 10:51:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-22 16:58:49 +01:00
|
|
|
export type VideoStudioTaskPayload =
|
|
|
|
VideoStudioTaskCutPayload |
|
|
|
|
VideoStudioTaskIntroPayload |
|
|
|
|
VideoStudioTaskOutroPayload |
|
|
|
|
VideoStudioTaskWatermarkPayload
|
2022-02-11 10:51:33 +01:00
|
|
|
|
2022-03-22 16:58:49 +01:00
|
|
|
export interface VideoStudioEditionPayload {
|
2022-02-11 10:51:33 +01:00
|
|
|
videoUUID: string
|
2022-03-22 16:58:49 +01:00
|
|
|
tasks: VideoStudioTaskPayload[]
|
2022-02-11 10:51:33 +01:00
|
|
|
}
|
2022-08-08 15:48:17 +02:00
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2022-08-10 09:53:39 +02:00
|
|
|
export interface VideoChannelImportPayload {
|
|
|
|
externalChannelUrl: string
|
|
|
|
videoChannelId: number
|
2022-08-10 11:51:13 +02:00
|
|
|
|
|
|
|
partOfChannelSyncId?: number
|
2022-08-10 09:53:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface AfterVideoChannelImportPayload {
|
|
|
|
channelSyncId: number
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2022-08-08 15:48:17 +02:00
|
|
|
export type NotifyPayload =
|
|
|
|
{
|
|
|
|
action: 'new-video'
|
|
|
|
videoUUID: string
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export interface FederateVideoPayload {
|
|
|
|
videoUUID: string
|
|
|
|
isNewVideo: boolean
|
|
|
|
}
|
2023-04-21 14:55:10 +02:00
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export interface TranscodingJobBuilderPayload {
|
|
|
|
videoUUID: string
|
|
|
|
|
|
|
|
optimizeJob?: {
|
|
|
|
isNewVideo: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
// Array of jobs to create
|
|
|
|
jobs?: {
|
|
|
|
type: 'video-transcoding'
|
|
|
|
payload: VideoTranscodingPayload
|
|
|
|
priority?: number
|
|
|
|
}[]
|
|
|
|
|
|
|
|
// Array of sequential jobs to create
|
|
|
|
sequentialJobs?: {
|
|
|
|
type: 'video-transcoding'
|
|
|
|
payload: VideoTranscodingPayload
|
|
|
|
priority?: number
|
|
|
|
}[][]
|
|
|
|
}
|