1
0
Fork 0

Support short uuid for scripts

This commit is contained in:
Chocobozzz 2021-08-17 11:06:10 +02:00
parent 66a7fc9473
commit c186a67f90
No known key found for this signature in database
GPG key ID: 583A612D890159BE
4 changed files with 26 additions and 17 deletions

View file

@ -8,7 +8,7 @@ import { JobQueue } from '../server/lib/job-queue'
import { computeResolutionsToTranscode } from '@server/helpers/ffprobe-utils'
import { VideoState, VideoTranscodingPayload } from '@shared/models'
import { CONFIG } from '@server/initializers/config'
import { isUUIDValid } from '@server/helpers/custom-validators/misc'
import { isUUIDValid, toCompleteUUID } from '@server/helpers/custom-validators/misc'
import { addTranscodingJob } from '@server/lib/video'
program
@ -39,12 +39,14 @@ run()
async function run () {
await initDatabaseModels(true)
if (isUUIDValid(options.video) === false) {
const uuid = toCompleteUUID(options.video)
if (isUUIDValid(uuid) === false) {
console.error('%s is not a valid video UUID.', options.video)
return
}
const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(options.video)
const video = await VideoModel.loadAndPopulateAccountAndServerAndTags(uuid)
if (!video) throw new Error('Video not found.')
const dataInput: VideoTranscodingPayload[] = []