diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/create-import-video-file-job.ts | 8 | ||||
-rwxr-xr-x | scripts/create-transcoding-job.ts | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.ts index a3a35bc10..726f51ccf 100644 --- a/scripts/create-import-video-file-job.ts +++ b/scripts/create-import-video-file-job.ts | |||
@@ -6,7 +6,7 @@ import { resolve } from 'path' | |||
6 | import { VideoModel } from '../server/models/video/video' | 6 | import { VideoModel } from '../server/models/video/video' |
7 | import { initDatabaseModels } from '../server/initializers/database' | 7 | import { initDatabaseModels } from '../server/initializers/database' |
8 | import { JobQueue } from '../server/lib/job-queue' | 8 | import { JobQueue } from '../server/lib/job-queue' |
9 | import { isUUIDValid } from '@server/helpers/custom-validators/misc' | 9 | import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc' |
10 | 10 | ||
11 | program | 11 | program |
12 | .option('-v, --video [videoUUID]', 'Video UUID') | 12 | .option('-v, --video [videoUUID]', 'Video UUID') |
@@ -31,12 +31,14 @@ run() | |||
31 | async function run () { | 31 | async function run () { |
32 | await initDatabaseModels(true) | 32 | await initDatabaseModels(true) |
33 | 33 | ||
34 | if (isUUIDValid(options.video) === false) { | 34 | const uuid = toCompleteUUID(options.video) |
35 | |||
36 | if (isUUIDValid(uuid) === false) { | ||
35 | console.error('%s is not a valid video UUID.', options.video) | 37 | console.error('%s is not a valid video UUID.', options.video) |
36 | return | 38 | return |
37 | } | 39 | } |
38 | 40 | ||
39 | const video = await VideoModel.load(options.video) | 41 | const video = await VideoModel.load(uuid) |
40 | if (!video) throw new Error('Video not found.') | 42 | if (!video) throw new Error('Video not found.') |
41 | if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.') | 43 | if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.') |
42 | 44 | ||
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts index 0bb9bfeab..30846cd15 100755 --- a/scripts/create-transcoding-job.ts +++ b/scripts/create-transcoding-job.ts | |||
@@ -8,7 +8,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 { VideoState, 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, toCompleteUUID } from '@server/helpers/custom-validators/misc' |
12 | import { addTranscodingJob } from '@server/lib/video' | 12 | import { addTranscodingJob } from '@server/lib/video' |
13 | 13 | ||
14 | program | 14 | program |
@@ -39,12 +39,14 @@ run() | |||
39 | async function run () { | 39 | async function run () { |
40 | await initDatabaseModels(true) | 40 | await initDatabaseModels(true) |
41 | 41 | ||
42 | if (isUUIDValid(options.video) === false) { | 42 | const uuid = toCompleteUUID(options.video) |
43 | |||
44 | if (isUUIDValid(uuid) === false) { | ||
43 | console.error('%s is not a valid video UUID.', options.video) | 45 | console.error('%s is not a valid video UUID.', options.video) |
44 | return | 46 | return |
45 | } | 47 | } |
46 | 48 | ||
47 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(options.video) | 49 | const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(uuid) |
48 | if (!video) throw new Error('Video not found.') | 50 | if (!video) throw new Error('Video not found.') |
49 | 51 | ||
50 | const dataInput: VideoTranscodingPayload[] = [] | 52 | const dataInput: VideoTranscodingPayload[] = [] |