From a15871560f80e07386c1dabb8370cd2664ecfd1f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 31 Jan 2020 16:56:52 +0100 Subject: Move to eslint --- server/tools/peertube-upload.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'server/tools/peertube-upload.ts') diff --git a/server/tools/peertube-upload.ts b/server/tools/peertube-upload.ts index f604c9bee..8de952e7b 100644 --- a/server/tools/peertube-upload.ts +++ b/server/tools/peertube-upload.ts @@ -24,14 +24,14 @@ command getServerCredentials(command) .then(({ url, username, password }) => { - if (!program[ 'videoName' ] || !program[ 'file' ]) { - if (!program[ 'videoName' ]) console.error('--video-name is required.') - if (!program[ 'file' ]) console.error('--file is required.') + if (!program['videoName'] || !program['file']) { + if (!program['videoName']) console.error('--video-name is required.') + if (!program['file']) console.error('--file is required.') process.exit(-1) } - if (isAbsolute(program[ 'file' ]) === false) { + if (isAbsolute(program['file']) === false) { console.error('File path should be absolute.') process.exit(-1) } @@ -41,25 +41,26 @@ getServerCredentials(command) process.exit(-1) }) }) + .catch(err => console.error(err)) async function run (url: string, username: string, password: string) { const accessToken = await getAccessToken(url, username, password) - await access(program[ 'file' ], constants.F_OK) + await access(program['file'], constants.F_OK) - console.log('Uploading %s video...', program[ 'videoName' ]) + console.log('Uploading %s video...', program['videoName']) const videoAttributes = await buildVideoAttributesFromCommander(url, program) Object.assign(videoAttributes, { - fixture: program[ 'file' ], - thumbnailfile: program[ 'thumbnail' ], - previewfile: program[ 'preview' ] + fixture: program['file'], + thumbnailfile: program['thumbnail'], + previewfile: program['preview'] }) try { await uploadVideo(url, accessToken, videoAttributes) - console.log(`Video ${program[ 'videoName' ]} uploaded.`) + console.log(`Video ${program['videoName']} uploaded.`) process.exit(0) } catch (err) { console.error(require('util').inspect(err)) -- cgit v1.2.3