aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue')
-rw-r--r--server/lib/job-queue/handlers/video-studio-edition.ts (renamed from server/lib/job-queue/handlers/video-edition.ts)38
-rw-r--r--server/lib/job-queue/job-queue.ts10
2 files changed, 24 insertions, 24 deletions
diff --git a/server/lib/job-queue/handlers/video-edition.ts b/server/lib/job-queue/handlers/video-studio-edition.ts
index d2d2a4f65..cf3064a7a 100644
--- a/server/lib/job-queue/handlers/video-edition.ts
+++ b/server/lib/job-queue/handlers/video-studio-edition.ts
@@ -9,8 +9,8 @@ import { generateWebTorrentVideoFilename } from '@server/lib/paths'
9import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles' 9import { VideoTranscodingProfilesManager } from '@server/lib/transcoding/default-transcoding-profiles'
10import { isAbleToUploadVideo } from '@server/lib/user' 10import { isAbleToUploadVideo } from '@server/lib/user'
11import { addOptimizeOrMergeAudioJob } from '@server/lib/video' 11import { addOptimizeOrMergeAudioJob } from '@server/lib/video'
12import { approximateIntroOutroAdditionalSize } from '@server/lib/video-editor'
13import { VideoPathManager } from '@server/lib/video-path-manager' 12import { VideoPathManager } from '@server/lib/video-path-manager'
13import { approximateIntroOutroAdditionalSize } from '@server/lib/video-studio'
14import { UserModel } from '@server/models/user/user' 14import { UserModel } from '@server/models/user/user'
15import { VideoModel } from '@server/models/video/video' 15import { VideoModel } from '@server/models/video/video'
16import { VideoFileModel } from '@server/models/video/video-file' 16import { VideoFileModel } from '@server/models/video/video-file'
@@ -26,23 +26,23 @@ import {
26 getVideoStreamFPS 26 getVideoStreamFPS
27} from '@shared/extra-utils' 27} from '@shared/extra-utils'
28import { 28import {
29 VideoEditionPayload, 29 VideoStudioEditionPayload,
30 VideoEditionTaskPayload, 30 VideoStudioTaskPayload,
31 VideoEditorTask, 31 VideoStudioTaskCutPayload,
32 VideoEditorTaskCutPayload, 32 VideoStudioTaskIntroPayload,
33 VideoEditorTaskIntroPayload, 33 VideoStudioTaskOutroPayload,
34 VideoEditorTaskOutroPayload, 34 VideoStudioTaskWatermarkPayload,
35 VideoEditorTaskWatermarkPayload 35 VideoStudioTask
36} from '@shared/models' 36} from '@shared/models'
37import { logger, loggerTagsFactory } from '../../../helpers/logger' 37import { logger, loggerTagsFactory } from '../../../helpers/logger'
38 38
39const lTagsBase = loggerTagsFactory('video-edition') 39const lTagsBase = loggerTagsFactory('video-edition')
40 40
41async function processVideoEdition (job: Job) { 41async function processVideoStudioEdition (job: Job) {
42 const payload = job.data as VideoEditionPayload 42 const payload = job.data as VideoStudioEditionPayload
43 const lTags = lTagsBase(payload.videoUUID) 43 const lTags = lTagsBase(payload.videoUUID)
44 44
45 logger.info('Process video edition of %s in job %d.', payload.videoUUID, job.id, lTags) 45 logger.info('Process video studio edition of %s in job %d.', payload.videoUUID, job.id, lTags)
46 46
47 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID) 47 const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(payload.videoUUID)
48 48
@@ -106,12 +106,12 @@ async function processVideoEdition (job: Job) {
106// --------------------------------------------------------------------------- 106// ---------------------------------------------------------------------------
107 107
108export { 108export {
109 processVideoEdition 109 processVideoStudioEdition
110} 110}
111 111
112// --------------------------------------------------------------------------- 112// ---------------------------------------------------------------------------
113 113
114type TaskProcessorOptions <T extends VideoEditionTaskPayload = VideoEditionTaskPayload> = { 114type TaskProcessorOptions <T extends VideoStudioTaskPayload = VideoStudioTaskPayload> = {
115 inputPath: string 115 inputPath: string
116 outputPath: string 116 outputPath: string
117 video: MVideo 117 video: MVideo
@@ -119,7 +119,7 @@ type TaskProcessorOptions <T extends VideoEditionTaskPayload = VideoEditionTaskP
119 lTags: { tags: string[] } 119 lTags: { tags: string[] }
120} 120}
121 121
122const taskProcessors: { [id in VideoEditorTask['name']]: (options: TaskProcessorOptions) => Promise<any> } = { 122const taskProcessors: { [id in VideoStudioTask['name']]: (options: TaskProcessorOptions) => Promise<any> } = {
123 'add-intro': processAddIntroOutro, 123 'add-intro': processAddIntroOutro,
124 'add-outro': processAddIntroOutro, 124 'add-outro': processAddIntroOutro,
125 'cut': processCut, 125 'cut': processCut,
@@ -137,7 +137,7 @@ async function processTask (options: TaskProcessorOptions) {
137 return processor(options) 137 return processor(options)
138} 138}
139 139
140function processAddIntroOutro (options: TaskProcessorOptions<VideoEditorTaskIntroPayload | VideoEditorTaskOutroPayload>) { 140function processAddIntroOutro (options: TaskProcessorOptions<VideoStudioTaskIntroPayload | VideoStudioTaskOutroPayload>) {
141 const { task } = options 141 const { task } = options
142 142
143 return addIntroOutro({ 143 return addIntroOutro({
@@ -153,7 +153,7 @@ function processAddIntroOutro (options: TaskProcessorOptions<VideoEditorTaskIntr
153 }) 153 })
154} 154}
155 155
156function processCut (options: TaskProcessorOptions<VideoEditorTaskCutPayload>) { 156function processCut (options: TaskProcessorOptions<VideoStudioTaskCutPayload>) {
157 const { task } = options 157 const { task } = options
158 158
159 return cutVideo({ 159 return cutVideo({
@@ -164,7 +164,7 @@ function processCut (options: TaskProcessorOptions<VideoEditorTaskCutPayload>) {
164 }) 164 })
165} 165}
166 166
167function processAddWatermark (options: TaskProcessorOptions<VideoEditorTaskWatermarkPayload>) { 167function processAddWatermark (options: TaskProcessorOptions<VideoStudioTaskWatermarkPayload>) {
168 const { task } = options 168 const { task } = options
169 169
170 return addWatermark({ 170 return addWatermark({
@@ -212,10 +212,10 @@ async function removeAllFiles (video: MVideoWithAllFiles, webTorrentFileExceptio
212 } 212 }
213} 213}
214 214
215async function checkUserQuotaOrThrow (video: MVideoFullLight, payload: VideoEditionPayload) { 215async function checkUserQuotaOrThrow (video: MVideoFullLight, payload: VideoStudioEditionPayload) {
216 const user = await UserModel.loadByVideoId(video.id) 216 const user = await UserModel.loadByVideoId(video.id)
217 217
218 const filePathFinder = (i: number) => (payload.tasks[i] as VideoEditorTaskIntroPayload | VideoEditorTaskOutroPayload).options.file 218 const filePathFinder = (i: number) => (payload.tasks[i] as VideoStudioTaskIntroPayload | VideoStudioTaskOutroPayload).options.file
219 219
220 const additionalBytes = await approximateIntroOutroAdditionalSize(video, payload.tasks, filePathFinder) 220 const additionalBytes = await approximateIntroOutroAdditionalSize(video, payload.tasks, filePathFinder)
221 if (await isAbleToUploadVideo(user.id, additionalBytes) === false) { 221 if (await isAbleToUploadVideo(user.id, additionalBytes) === false) {
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts
index 3224abcc3..167b7b168 100644
--- a/server/lib/job-queue/job-queue.ts
+++ b/server/lib/job-queue/job-queue.ts
@@ -15,11 +15,11 @@ import {
15 ManageVideoTorrentPayload, 15 ManageVideoTorrentPayload,
16 MoveObjectStoragePayload, 16 MoveObjectStoragePayload,
17 RefreshPayload, 17 RefreshPayload,
18 VideoEditionPayload,
19 VideoFileImportPayload, 18 VideoFileImportPayload,
20 VideoImportPayload, 19 VideoImportPayload,
21 VideoLiveEndingPayload, 20 VideoLiveEndingPayload,
22 VideoRedundancyPayload, 21 VideoRedundancyPayload,
22 VideoStudioEditionPayload,
23 VideoTranscodingPayload 23 VideoTranscodingPayload
24} from '../../../shared/models' 24} from '../../../shared/models'
25import { logger } from '../../helpers/logger' 25import { logger } from '../../helpers/logger'
@@ -34,10 +34,10 @@ import { processActorKeys } from './handlers/actor-keys'
34import { processEmail } from './handlers/email' 34import { processEmail } from './handlers/email'
35import { processManageVideoTorrent } from './handlers/manage-video-torrent' 35import { processManageVideoTorrent } from './handlers/manage-video-torrent'
36import { processMoveToObjectStorage } from './handlers/move-to-object-storage' 36import { processMoveToObjectStorage } from './handlers/move-to-object-storage'
37import { processVideoEdition } from './handlers/video-edition'
38import { processVideoFileImport } from './handlers/video-file-import' 37import { processVideoFileImport } from './handlers/video-file-import'
39import { processVideoImport } from './handlers/video-import' 38import { processVideoImport } from './handlers/video-import'
40import { processVideoLiveEnding } from './handlers/video-live-ending' 39import { processVideoLiveEnding } from './handlers/video-live-ending'
40import { processVideoStudioEdition } from './handlers/video-studio-edition'
41import { processVideoTranscoding } from './handlers/video-transcoding' 41import { processVideoTranscoding } from './handlers/video-transcoding'
42import { processVideosViewsStats } from './handlers/video-views-stats' 42import { processVideosViewsStats } from './handlers/video-views-stats'
43 43
@@ -57,7 +57,7 @@ type CreateJobArgument =
57 { type: 'actor-keys', payload: ActorKeysPayload } | 57 { type: 'actor-keys', payload: ActorKeysPayload } |
58 { type: 'video-redundancy', payload: VideoRedundancyPayload } | 58 { type: 'video-redundancy', payload: VideoRedundancyPayload } |
59 { type: 'delete-resumable-upload-meta-file', payload: DeleteResumableUploadMetaFilePayload } | 59 { type: 'delete-resumable-upload-meta-file', payload: DeleteResumableUploadMetaFilePayload } |
60 { type: 'video-edition', payload: VideoEditionPayload } | 60 { type: 'video-studio-edition', payload: VideoStudioEditionPayload } |
61 { type: 'manage-video-torrent', payload: ManageVideoTorrentPayload } | 61 { type: 'manage-video-torrent', payload: ManageVideoTorrentPayload } |
62 { type: 'move-to-object-storage', payload: MoveObjectStoragePayload } 62 { type: 'move-to-object-storage', payload: MoveObjectStoragePayload }
63 63
@@ -83,7 +83,7 @@ const handlers: { [id in JobType]: (job: Job) => Promise<any> } = {
83 'video-redundancy': processVideoRedundancy, 83 'video-redundancy': processVideoRedundancy,
84 'move-to-object-storage': processMoveToObjectStorage, 84 'move-to-object-storage': processMoveToObjectStorage,
85 'manage-video-torrent': processManageVideoTorrent, 85 'manage-video-torrent': processManageVideoTorrent,
86 'video-edition': processVideoEdition 86 'video-studio-edition': processVideoStudioEdition
87} 87}
88 88
89const jobTypes: JobType[] = [ 89const jobTypes: JobType[] = [
@@ -103,7 +103,7 @@ const jobTypes: JobType[] = [
103 'video-live-ending', 103 'video-live-ending',
104 'move-to-object-storage', 104 'move-to-object-storage',
105 'manage-video-torrent', 105 'manage-video-torrent',
106 'video-edition' 106 'video-studio-edition'
107] 107]
108 108
109class JobQueue { 109class JobQueue {