diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/create-transcoding-job.ts | 13 |
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' | |||
2 | import { VideoModel } from '../server/models/video/video' | 2 | import { VideoModel } from '../server/models/video/video' |
3 | import { initDatabaseModels } from '../server/initializers' | 3 | import { initDatabaseModels } from '../server/initializers' |
4 | import { JobQueue } from '../server/lib/job-queue' | 4 | import { JobQueue } from '../server/lib/job-queue' |
5 | import { VideoTranscodingPayload } from '../server/lib/job-queue/handlers/video-transcoding' | ||
5 | 6 | ||
6 | program | 7 | program |
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 }) |