X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fcreate-transcoding-job.ts;h=2b7cb5177e2e4c0ec790a3a97010a81d023baeff;hb=1f20622f2b087eaf8738d60fae00a44b9c558ca3;hp=3ea30f98e642701d5bf85e60387308c1c0fa88c1;hpb=3aa5cea8fec998805e32c0480884906d8e4fd490;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts index 3ea30f98e..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') @@ -28,20 +29,14 @@ run() async function run () { await initDatabaseModels(true) - const video = await VideoModel.loadByUUID(program['video']) + 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-file', payload: dataInput }) + await JobQueue.Instance.createJob({ type: 'video-transcoding', payload: dataInput }) console.log('Transcoding job for video %s created.', video.uuid) }