X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftools%2Fimport-videos.ts;h=e49fbb2f5ef3e0f2253703e0b94fb9581ecc3572;hb=83e6519ba4ee752dc3148a16c69effbfccb13e6b;hp=91b897976a417e6a5b77e0cd0b2fe67b95705281;hpb=066fc8ba71fa3573d1b1fb4c692b8f51c17111fc;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tools/import-videos.ts b/server/tools/import-videos.ts index 91b897976..e49fbb2f5 100644 --- a/server/tools/import-videos.ts +++ b/server/tools/import-videos.ts @@ -39,39 +39,37 @@ run().catch(err => console.error(err)) let accessToken: string let client: { id: string, secret: string } - + const processOptions = { cwd: __dirname, maxBuffer: Infinity } async function promptPassword () { - return new Promise ( resolve => { - prompt.start() - const schema = { - properties: { - password: { - hidden:true, - required:true - } - } - } - prompt.get(schema, function(err, result) { - if (err) { - console.log(err.message) - } - resolve(result.password) - }) + return new Promise((res, rej) => { + prompt.start() + const schema = { + properties: { + password: { + hidden: true, + required: true + } + } + } + prompt.get(schema, function (err, result) { + if (err) { + return rej(err) + } + return res(result.password) + }) }) } async function run () { - if ( - !user.password - ) { - user.password = await promptPassword(); + if (!user.password) { + user.password = await promptPassword() } - + const res = await getClient(program['url']) client = { id: res.body.client_id, @@ -178,6 +176,7 @@ async function uploadVideoOnPeerTube (videoInfo: any, videoPath: string, languag licence, language, nsfw: isNSFW(videoInfo), + waitTranscoding: true, commentsEnabled: true, description: videoInfo.description || undefined, support: undefined,