diff options
author | Chocobozzz <me@florianbigard.com> | 2021-02-03 09:33:05 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-02-03 09:45:08 +0100 |
commit | ba5a8d89bbf049e4afc41543bcc072cccdb02669 (patch) | |
tree | 6cc6b2dca17745cc0824c7ad4515f3bc4883fa4a /scripts/create-import-video-file-job.ts | |
parent | 29f148a61381727a432c22a71c7a2b7cc23d9c9e (diff) | |
download | PeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.tar.gz PeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.tar.zst PeerTube-ba5a8d89bbf049e4afc41543bcc072cccdb02669.zip |
Update server dependencies
Diffstat (limited to 'scripts/create-import-video-file-job.ts')
-rw-r--r-- | scripts/create-import-video-file-job.ts | 8 |
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 | ||
16 | if (program['video'] === undefined || program['import'] === undefined) { | 16 | const options = program.opts() |
17 | |||
18 | if (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() | |||
28 | async function run () { | 30 | async 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() |