import { Netrc } from 'netrc-parser'
import { getAppNumber, isTestInstance } from '../helpers/core-utils'
import { join } from 'path'
-import { getVideoChannel, root } from '../../shared/extra-utils'
+import { root } from '../../shared/extra-utils/miscs/miscs'
+import { getVideoChannel } from '../../shared/extra-utils/videos/video-channels'
import { Command } from 'commander'
import { VideoChannel, VideoPrivacy } from '../../shared/models/videos'
})
}
-function getRemoteObjectOrDie (program: any, settings: Settings, netrc: Netrc) {
+function getRemoteObjectOrDie (
+ program: any,
+ settings: Settings,
+ netrc: Netrc
+): { url: string, username: string, password: string } {
if (!program['url'] || !program['username'] || !program['password']) {
// No remote and we don't have program parameters: quit
if (settings.remotes.length === 0 || Object.keys(netrc.machines).length === 0) {
return videoAttributes
}
+function getServerCredentials (program: any) {
+ return Promise.all([ getSettings(), getNetrc() ])
+ .then(([ settings, netrc ]) => {
+ return getRemoteObjectOrDie(program, settings, netrc)
+ })
+}
+
// ---------------------------------------------------------------------------
export {
writeSettings,
deleteSettings,
+ getServerCredentials,
+
buildCommonVideoOptions,
buildVideoAttributesFromCommander
}