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'
|
2021-11-18 07:35:08 -06:00
|
|
|
import { VideoResolution } from '../videos/file/video-resolution.enum'
|
2022-08-05 03:36:19 -05:00
|
|
|
import { VideoStudioTaskCut } from '../videos/studio'
|
2020-08-27 02:58:27 -05:00
|
|
|
import { SendEmailOptions } from './emailer.model'
|
2020-04-23 02:32:53 -05:00
|
|
|
|
2022-08-08 03:42:08 -05:00
|
|
|
export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused' | 'waiting-children'
|
2018-01-25 08:05:18 -06:00
|
|
|
|
2020-01-31 09:56:52 -06:00
|
|
|
export type JobType =
|
2021-02-26 09:26:27 -06:00
|
|
|
| 'activitypub-cleaner'
|
2020-01-31 09:56:52 -06:00
|
|
|
| 'activitypub-follow'
|
2022-08-10 03:34:39 -05:00
|
|
|
| 'activitypub-http-broadcast-parallel'
|
|
|
|
| 'activitypub-http-broadcast'
|
|
|
|
| 'activitypub-http-fetcher'
|
|
|
|
| 'activitypub-http-unicast'
|
2020-01-31 09:56:52 -06:00
|
|
|
| 'activitypub-refresher'
|
2021-02-26 07:22:25 -06:00
|
|
|
| 'actor-keys'
|
2022-08-10 03:34:39 -05:00
|
|
|
| 'after-video-channel-import'
|
|
|
|
| 'email'
|
|
|
|
| 'federate-video'
|
2023-04-21 07:55:10 -05:00
|
|
|
| 'transcoding-job-builder'
|
2022-03-16 09:34:21 -05:00
|
|
|
| 'manage-video-torrent'
|
2021-08-17 01:26:20 -05:00
|
|
|
| 'move-to-object-storage'
|
2022-08-08 08:48:17 -05:00
|
|
|
| 'notify'
|
2022-08-10 03:34:39 -05:00
|
|
|
| 'video-channel-import'
|
|
|
|
| 'video-file-import'
|
|
|
|
| 'video-import'
|
|
|
|
| 'video-live-ending'
|
|
|
|
| 'video-redundancy'
|
|
|
|
| 'video-studio-edition'
|
|
|
|
| 'video-transcoding'
|
|
|
|
| 'videos-views-stats'
|
2023-06-01 07:51:16 -05:00
|
|
|
| 'generate-video-storyboard'
|
2017-11-30 03:51:13 -06:00
|
|
|
|
|
|
|
export interface Job {
|
2022-08-08 03:42:08 -05:00
|
|
|
id: number | string
|
|
|
|
state: JobState | 'unknown'
|
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
|
2023-04-21 07:55:10 -05:00
|
|
|
|
|
|
|
parent?: {
|
|
|
|
id: 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
|
|
|
|
}
|
|
|
|
|
2022-08-10 02:53:39 -05:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2020-05-14 04:10:26 -05:00
|
|
|
export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
|
|
|
|
export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
|
|
|
|
|
2022-08-10 02:53:39 -05:00
|
|
|
export interface VideoImportYoutubeDLPayload {
|
2020-05-14 04:10:26 -05:00
|
|
|
type: VideoImportYoutubeDLPayloadType
|
2020-04-23 02:32:53 -05:00
|
|
|
videoImportId: number
|
|
|
|
|
|
|
|
fileExt?: string
|
|
|
|
}
|
2022-08-10 02:53:39 -05:00
|
|
|
|
|
|
|
export interface VideoImportTorrentPayload {
|
2020-05-14 04:10:26 -05:00
|
|
|
type: VideoImportTorrentPayloadType
|
2020-04-23 02:32:53 -05:00
|
|
|
videoImportId: number
|
|
|
|
}
|
2022-08-10 02:53:39 -05:00
|
|
|
|
|
|
|
export type VideoImportPayload = (VideoImportYoutubeDLPayload | VideoImportTorrentPayload) & {
|
|
|
|
preventException: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoImportPreventExceptionResult {
|
|
|
|
resultType: 'success' | 'error'
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
2020-04-23 02:32:53 -05:00
|
|
|
|
|
|
|
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
|
2023-04-21 07:55:10 -05:00
|
|
|
fps: number
|
2020-04-23 02:32:53 -05:00
|
|
|
copyCodecs: boolean
|
2021-11-18 07:35:08 -06:00
|
|
|
|
2023-04-21 07:55:10 -05:00
|
|
|
deleteWebTorrentFiles: 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
|
2023-04-21 07:55:10 -05:00
|
|
|
fps: number
|
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'
|
2023-04-21 09:31:04 -05:00
|
|
|
|
2020-04-23 02:32:53 -05:00
|
|
|
resolution: VideoResolution
|
2023-04-21 07:55:10 -05:00
|
|
|
fps: number
|
2023-04-21 09:31:04 -05:00
|
|
|
|
|
|
|
hasChildren: boolean
|
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'
|
2023-04-21 07:55:10 -05:00
|
|
|
|
|
|
|
quickTranscode: boolean
|
2023-04-21 09:31:04 -05:00
|
|
|
|
|
|
|
hasChildren: boolean
|
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
|
2023-05-04 08:29:34 -05:00
|
|
|
|
|
|
|
watermarkSizeRatio: number
|
|
|
|
horitonzalMarginRatio: number
|
|
|
|
verticalMarginRatio: number
|
2022-02-11 03:51:33 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
2022-08-08 08:48:17 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2022-08-10 02:53:39 -05:00
|
|
|
export interface VideoChannelImportPayload {
|
|
|
|
externalChannelUrl: string
|
|
|
|
videoChannelId: number
|
2022-08-10 04:51:13 -05:00
|
|
|
|
|
|
|
partOfChannelSyncId?: number
|
2022-08-10 02:53:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface AfterVideoChannelImportPayload {
|
|
|
|
channelSyncId: number
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2022-08-08 08:48:17 -05:00
|
|
|
export type NotifyPayload =
|
|
|
|
{
|
|
|
|
action: 'new-video'
|
|
|
|
videoUUID: string
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export interface FederateVideoPayload {
|
|
|
|
videoUUID: string
|
|
|
|
isNewVideo: boolean
|
|
|
|
}
|
2023-04-21 07:55:10 -05: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
|
|
|
|
}[][]
|
|
|
|
}
|
2023-06-01 07:51:16 -05:00
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export interface GenerateStoryboardPayload {
|
|
|
|
videoUUID: string
|
|
|
|
federate: boolean
|
|
|
|
}
|