X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fcreate-transcoding-job.ts;h=2b7cb5177e2e4c0ec790a3a97010a81d023baeff;hb=675a8fc74faefa0161b0754bd61c710de7a449c5;hp=4a677eacb1e1b2e937920146eb2725c5bf4765df;hpb=a0327eedb0136c4ba7358df80b75cc56bd25ffb8;p=github%2FChocobozzz%2FPeerTube.git 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' import { VideoModel } from '../server/models/video/video' import { initDatabaseModels } from '../server/initializers' import { JobQueue } from '../server/lib/job-queue' +import { VideoTranscodingPayload } from '../server/lib/job-queue/handlers/video-transcoding' program .option('-v, --video [videoUUID]', 'Video UUID') @@ -31,15 +32,9 @@ async function run () { const video = await VideoModel.loadByUUIDWithFile(program['video']) if (!video) throw new Error('Video not found.') - const dataInput = { - videoUUID: video.uuid, - isNewVideo: false, - resolution: undefined - } - - if (program.resolution !== undefined) { - dataInput.resolution = program.resolution - } + const dataInput: VideoTranscodingPayload = program.resolution !== undefined + ? { type: 'new-resolution' as 'new-resolution', videoUUID: video.uuid, isNewVideo: false, resolution: program.resolution } + : { type: 'optimize' as 'optimize', videoUUID: video.uuid, isNewVideo: false } await JobQueue.Instance.init() await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput })