diff options
author | Chocobozzz <me@florianbigard.com> | 2019-05-21 10:05:12 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-05-21 10:05:12 +0200 |
commit | 73b3aa6429dfb2e31628fa09a479dce318289d7d (patch) | |
tree | 88cf5c7c49ba89c18633a4a64a4acfc8d40b4a50 /scripts | |
parent | fd822c1c699fb89bb1c3218e047e1d842bc1ba1a (diff) | |
parent | 618750486ee2732e0ad3525349e4d42f29e1803e (diff) | |
download | PeerTube-73b3aa6429dfb2e31628fa09a479dce318289d7d.tar.gz PeerTube-73b3aa6429dfb2e31628fa09a479dce318289d7d.tar.zst PeerTube-73b3aa6429dfb2e31628fa09a479dce318289d7d.zip |
Merge branch 'feature/audio-upload' into develop
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 }) |