]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/models/server/job.model.ts
Display avatar in embed poster
[github/Chocobozzz/PeerTube.git] / shared / models / server / job.model.ts
index 694361276c23c8bc051dfe9ad2046c4219b26226..d0293f542fcc7b7406bb1ddf31b1857e2433bcdd 100644 (file)
@@ -1,27 +1,35 @@
-import { ContextType } from '@server/helpers/activitypub'
+import { ContextType } from '../activitypub/context'
+import { VideoEditorTaskCut } from '../videos/editor'
+import { VideoResolution } from '../videos/file/video-resolution.enum'
 import { SendEmailOptions } from './emailer.model'
-import { VideoResolution } from '@shared/models'
 
-export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed'
+export type JobState = 'active' | 'completed' | 'failed' | 'waiting' | 'delayed' | 'paused'
 
 export type JobType =
   | 'activitypub-http-unicast'
   | 'activitypub-http-broadcast'
   | 'activitypub-http-fetcher'
+  | 'activitypub-cleaner'
   | 'activitypub-follow'
   | 'video-file-import'
   | 'video-transcoding'
   | 'email'
   | 'video-import'
-  | 'videos-views'
+  | 'videos-views-stats'
   | 'activitypub-refresher'
   | 'video-redundancy'
+  | 'video-live-ending'
+  | 'actor-keys'
+  | 'move-to-object-storage'
+  | 'video-edition'
 
 export interface Job {
   id: number
   state: JobState
   type: JobType
   data: any
+  priority: number
+  progress: number
   error: any
   createdAt: Date | string
   finishedOn: Date | string
@@ -48,13 +56,12 @@ export type ActivitypubHttpFetcherPayload = {
   uri: string
   type: FetchType
   videoId?: number
-  accountId?: number
 }
 
 export type ActivitypubHttpUnicastPayload = {
   uri: string
   signatureActorId?: number
-  body: any
+  body: object
   contextType?: ContextType
 }
 
@@ -70,17 +77,17 @@ export type VideoFileImportPayload = {
   filePath: string
 }
 
+export type VideoImportTorrentPayloadType = 'magnet-uri' | 'torrent-file'
+export type VideoImportYoutubeDLPayloadType = 'youtube-dl'
+
 export type VideoImportYoutubeDLPayload = {
-  type: 'youtube-dl'
+  type: VideoImportYoutubeDLPayloadType
   videoImportId: number
 
-  generateThumbnail: boolean
-  generatePreview: boolean
-
   fileExt?: string
 }
 export type VideoImportTorrentPayload = {
-  type: 'magnet-uri' | 'torrent-file'
+  type: VideoImportTorrentPayloadType
   videoImportId: number
 }
 export type VideoImportPayload = VideoImportYoutubeDLPayload | VideoImportTorrentPayload
@@ -96,30 +103,94 @@ interface BaseTranscodingPayload {
   isNewVideo?: boolean
 }
 
-interface HLSTranscodingPayload extends BaseTranscodingPayload {
-  type: 'hls'
-  isPortraitMode?: boolean
+export interface HLSTranscodingPayload extends BaseTranscodingPayload {
+  type: 'new-resolution-to-hls'
   resolution: VideoResolution
   copyCodecs: boolean
-}
 
-export interface NewResolutionTranscodingPayload extends BaseTranscodingPayload {
-  type: 'new-resolution'
+  hasAudio: boolean
   isPortraitMode?: boolean
+
+  autoDeleteWebTorrentIfNeeded: boolean
+  isMaxQuality: boolean
+}
+
+export interface NewWebTorrentResolutionTranscodingPayload extends BaseTranscodingPayload {
+  type: 'new-resolution-to-webtorrent'
   resolution: VideoResolution
+
+  hasAudio: boolean
+  createHLSIfNeeded: boolean
+
+  isPortraitMode?: boolean
 }
 
 export interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
-  type: 'merge-audio'
+  type: 'merge-audio-to-webtorrent'
   resolution: VideoResolution
+  createHLSIfNeeded: true
 }
 
 export interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
-  type: 'optimize'
+  type: 'optimize-to-webtorrent'
 }
 
 export type VideoTranscodingPayload =
   HLSTranscodingPayload
-  | NewResolutionTranscodingPayload
+  | NewWebTorrentResolutionTranscodingPayload
   | OptimizeTranscodingPayload
   | MergeAudioTranscodingPayload
+
+export interface VideoLiveEndingPayload {
+  videoId: number
+}
+
+export interface ActorKeysPayload {
+  actorId: number
+}
+
+export interface DeleteResumableUploadMetaFilePayload {
+  filepath: string
+}
+
+export interface MoveObjectStoragePayload {
+  videoUUID: string
+  isNewVideo: boolean
+}
+
+export type VideoEditorTaskCutPayload = VideoEditorTaskCut
+
+export type VideoEditorTaskIntroPayload = {
+  name: 'add-intro'
+
+  options: {
+    file: string
+  }
+}
+
+export type VideoEditorTaskOutroPayload = {
+  name: 'add-outro'
+
+  options: {
+    file: string
+  }
+}
+
+export type VideoEditorTaskWatermarkPayload = {
+  name: 'add-watermark'
+
+  options: {
+    file: string
+  }
+}
+
+export type VideoEditionTaskPayload =
+  VideoEditorTaskCutPayload |
+  VideoEditorTaskIntroPayload |
+  VideoEditorTaskOutroPayload |
+  VideoEditorTaskWatermarkPayload
+
+export interface VideoEditionPayload {
+  videoUUID: string
+  tasks: VideoEditionTaskPayload[]
+}