]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - scripts/create-transcoding-job.ts
Update build with i18n
[github/Chocobozzz/PeerTube.git] / scripts / create-transcoding-job.ts
CommitLineData
0c948c16
C
1import * as program from 'commander'
2import { createReadStream } from 'fs'
3import { join } from 'path'
4import { createInterface } from 'readline'
5import { VideoModel } from '../server/models/video/video'
6import { initDatabaseModels } from '../server/initializers'
7import { JobQueue } from '../server/lib/job-queue'
8
9program
10 .option('-v, --video [videoUUID]', 'Video UUID')
11 .parse(process.argv)
12
13if (program['video'] === undefined) {
14 console.error('All parameters are mandatory.')
15 process.exit(-1)
16}
17
18run()
19 .then(() => process.exit(0))
20 .catch(err => {
21 console.error(err)
22 process.exit(-1)
23 })
24
25async function run () {
26 await initDatabaseModels(true)
27
28 const video = await VideoModel.loadByUUID(program['video'])
29 if (!video) throw new Error('Video not found.')
30
31 const dataInput = {
32 videoUUID: video.uuid,
33 isNewVideo: false
34 }
35
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)
39}