aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/create-import-video-file-job.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/create-import-video-file-job.ts')
-rw-r--r--scripts/create-import-video-file-job.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.ts
index d71e82c14..f5271c7a3 100644
--- a/scripts/create-import-video-file-job.ts
+++ b/scripts/create-import-video-file-job.ts
@@ -13,7 +13,9 @@ program
13 .description('Import a video file to replace an already uploaded file or to add a new resolution') 13 .description('Import a video file to replace an already uploaded file or to add a new resolution')
14 .parse(process.argv) 14 .parse(process.argv)
15 15
16if (program['video'] === undefined || program['import'] === undefined) { 16const options = program.opts()
17
18if (options.video === undefined || options.import === undefined) {
17 console.error('All parameters are mandatory.') 19 console.error('All parameters are mandatory.')
18 process.exit(-1) 20 process.exit(-1)
19} 21}
@@ -28,13 +30,13 @@ run()
28async function run () { 30async function run () {
29 await initDatabaseModels(true) 31 await initDatabaseModels(true)
30 32
31 const video = await VideoModel.loadByUUID(program['video']) 33 const video = await VideoModel.loadByUUID(options.video)
32 if (!video) throw new Error('Video not found.') 34 if (!video) throw new Error('Video not found.')
33 if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.') 35 if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.')
34 36
35 const dataInput = { 37 const dataInput = {
36 videoUUID: video.uuid, 38 videoUUID: video.uuid,
37 filePath: resolve(program['import']) 39 filePath: resolve(options.import)
38 } 40 }
39 41
40 await JobQueue.Instance.init() 42 await JobQueue.Instance.init()