aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create-transcoding-job.ts13
1 files changed, 4 insertions, 9 deletions
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts
index 4a677eacb..2b7cb5177 100755
--- a/scripts/create-transcoding-job.ts
+++ b/scripts/create-transcoding-job.ts
@@ -2,6 +2,7 @@ import * as program from 'commander'
2import { VideoModel } from '../server/models/video/video' 2import { VideoModel } from '../server/models/video/video'
3import { initDatabaseModels } from '../server/initializers' 3import { initDatabaseModels } from '../server/initializers'
4import { JobQueue } from '../server/lib/job-queue' 4import { JobQueue } from '../server/lib/job-queue'
5import { VideoTranscodingPayload } from '../server/lib/job-queue/handlers/video-transcoding'
5 6
6program 7program
7 .option('-v, --video [videoUUID]', 'Video UUID') 8 .option('-v, --video [videoUUID]', 'Video UUID')
@@ -31,15 +32,9 @@ async function run () {
31 const video = await VideoModel.loadByUUIDWithFile(program['video']) 32 const video = await VideoModel.loadByUUIDWithFile(program['video'])
32 if (!video) throw new Error('Video not found.') 33 if (!video) throw new Error('Video not found.')
33 34
34 const dataInput = { 35 const dataInput: VideoTranscodingPayload = program.resolution !== undefined
35 videoUUID: video.uuid, 36 ? { type: 'new-resolution' as 'new-resolution', videoUUID: video.uuid, isNewVideo: false, resolution: program.resolution }
36 isNewVideo: false, 37 : { type: 'optimize' as 'optimize', videoUUID: video.uuid, isNewVideo: false }
37 resolution: undefined
38 }
39
40 if (program.resolution !== undefined) {
41 dataInput.resolution = program.resolution
42 }
43 38
44 await JobQueue.Instance.init() 39 await JobQueue.Instance.init()
45 await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput }) 40 await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })