1 import * as program from 'commander'
2 import { createReadStream } from 'fs'
3 import { join } from 'path'
4 import { createInterface } from 'readline'
5 import { VideoModel } from '../server/models/video/video'
6 import { initDatabaseModels } from '../server/initializers'
7 import { JobQueue } from '../server/lib/job-queue'
10 .option('-v, --video [videoUUID]', 'Video UUID')
13 if (program['video'] === undefined) {
14 console.error('All parameters are mandatory.')
19 .then(() => process.exit(0))
25 async function run () {
26 await initDatabaseModels(true)
28 const video = await VideoModel.loadByUUID(program['video'])
29 if (!video) throw new Error('Video not found.')
32 videoUUID: video.uuid,
36 await JobQueue.Instance.init()
37 await JobQueue.Instance.createJob({ type: 'video-file', payload: dataInput })
38 console.log('Transcoding job for video %s created.', video.uuid)