-if (!program['tags']) program['tags'] = []
-if (!program['nsfw']) program['nsfw'] = false
-if (!program['privacy']) program['privacy'] = VideoPrivacy.PUBLIC
-if (!program['commentsEnabled']) program['commentsEnabled'] = false
-
-getSettings()
- .then(settings => {
- if (
- (!program['url'] ||
- !program['username'] ||
- !program['password']) &&
- (settings.remotes.length === 0)
- ) {
- if (!program['url']) console.error('--url field is required.')
- if (!program['username']) console.error('--username field is required.')
- if (!program['password']) console.error('--password field is required.')
- if (!program['videoName']) console.error('--video-name field is required.')
- if (!program['file']) console.error('--file field is required.')
- process.exit(-1)
- }
-
- if (
- (!program['url'] ||
- !program['username'] ||
- !program['password']) &&
- (settings.remotes.length > 0)
- ) {
- if (!program['url']) {
- program['url'] = (settings.default !== -1) ?
- settings.remotes[settings.default] :
- settings.remotes[0]
- }
- if (!program['username']) program['username'] = netrc.machines[program['url']].login
- if (!program['password']) program['password'] = netrc.machines[program['url']].password
- }
+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.')