aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/create-transcoding-job.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-17 11:06:10 +0200
committerChocobozzz <me@florianbigard.com>2021-08-17 11:06:10 +0200
commitc186a67f90203af6bfa434f026efdc99193bcd65 (patch)
tree54e715f1afba3aaa14d6448fdbc14d699b7ae775 /scripts/create-transcoding-job.ts
parent66a7fc947321b923fa1e7182202e03d0e21ffb3e (diff)
downloadPeerTube-c186a67f90203af6bfa434f026efdc99193bcd65.tar.gz
PeerTube-c186a67f90203af6bfa434f026efdc99193bcd65.tar.zst
PeerTube-c186a67f90203af6bfa434f026efdc99193bcd65.zip
Support short uuid for scripts
Diffstat (limited to 'scripts/create-transcoding-job.ts')
-rwxr-xr-xscripts/create-transcoding-job.ts8
1 files changed, 5 insertions, 3 deletions
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'
8import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils' 8import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils'
9import { VideoState, VideoTranscodingPayload } from '@shared/models' 9import { VideoState, VideoTranscodingPayload } from '@shared/models'
10import { CONFIG } from '@server/initializers/config' 10import { CONFIG } from '@server/initializers/config'
11import { isUUIDValid } from '@server/helpers/custom-validators/misc' 11import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'
12import { addTranscodingJob } from '@server/lib/video' 12import { addTranscodingJob } from '@server/lib/video'
13 13
14program 14program
@@ -39,12 +39,14 @@ run()
39async function run () { 39async 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[] = []