diff options
Diffstat (limited to 'scripts/create-transcoding-job.ts')
-rwxr-xr-x | scripts/create-transcoding-job.ts | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts index 3a552c19a..0bb9bfeab 100755 --- a/scripts/create-transcoding-job.ts +++ b/scripts/create-transcoding-job.ts | |||
@@ -6,9 +6,10 @@ import { VideoModel } from '../server/models/video/video' | |||
6 | import { initDatabaseModels } from '../server/initializers/database' | 6 | import { initDatabaseModels } from '../server/initializers/database' |
7 | import { JobQueue } from '../server/lib/job-queue' | 7 | import { JobQueue } from '../server/lib/job-queue' |
8 | import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils' | 8 | import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils' |
9 | import { VideoTranscodingPayload } from '@shared/models' | 9 | import { VideoState, VideoTranscodingPayload } from '@shared/models' |
10 | import { CONFIG } from '@server/initializers/config' | 10 | import { CONFIG } from '@server/initializers/config' |
11 | import { isUUIDValid } from '@server/helpers/custom-validators/misc' | 11 | import { isUUIDValid } from '@server/helpers/custom-validators/misc' |
12 | import { addTranscodingJob } from '@server/lib/video' | ||
12 | 13 | ||
13 | program | 14 | program |
14 | .option('-v, --video [videoUUID]', 'Video UUID') | 15 | .option('-v, --video [videoUUID]', 'Video UUID') |
@@ -47,7 +48,7 @@ async function run () { | |||
47 | if (!video) throw new Error('Video not found.') | 48 | if (!video) throw new Error('Video not found.') |
48 | 49 | ||
49 | const dataInput: VideoTranscodingPayload[] = [] | 50 | const dataInput: VideoTranscodingPayload[] = [] |
50 | const { resolution } = await video.getMaxQualityResolution() | 51 | const resolution = video.getMaxQualityFile().resolution |
51 | 52 | ||
52 | // Generate HLS files | 53 | // Generate HLS files |
53 | if (options.generateHls || CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) { | 54 | if (options.generateHls || CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) { |
@@ -62,6 +63,7 @@ async function run () { | |||
62 | resolution, | 63 | resolution, |
63 | isPortraitMode: false, | 64 | isPortraitMode: false, |
64 | copyCodecs: false, | 65 | copyCodecs: false, |
66 | isNewVideo: false, | ||
65 | isMaxQuality: false | 67 | isMaxQuality: false |
66 | }) | 68 | }) |
67 | } | 69 | } |
@@ -87,10 +89,13 @@ async function run () { | |||
87 | } | 89 | } |
88 | } | 90 | } |
89 | 91 | ||
90 | await JobQueue.Instance.init() | 92 | JobQueue.Instance.init() |
93 | |||
94 | video.state = VideoState.TO_TRANSCODE | ||
95 | await video.save() | ||
91 | 96 | ||
92 | for (const d of dataInput) { | 97 | for (const d of dataInput) { |
93 | await JobQueue.Instance.createJobWithPromise({ type: 'video-transcoding', payload: d }) | 98 | await addTranscodingJob(d, {}) |
94 | console.log('Transcoding job for video %s created.', video.uuid) | 99 | console.log('Transcoding job for video %s created.', video.uuid) |
95 | } | 100 | } |
96 | } | 101 | } |