aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/job-queue/handlers')
-rw-r--r--server/lib/job-queue/handlers/video-studio-edition.ts (renamed from server/lib/job-queue/handlers/video-edition.ts)38
1 files changed, 19 insertions, 19 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) {