From: Raphaƫl Droz Date: Tue, 11 Feb 2020 02:16:06 +0000 (-0300) Subject: peertube-import-videos passes remaining options down to youtube-dl X-Git-Tag: v2.2.0-rc.1~497 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=79ee77eab14a64d51f628564062486ec388931b4;p=oweals%2Fpeertube.git peertube-import-videos passes remaining options down to youtube-dl --- diff --git a/server/tools/peertube-import-videos.ts b/server/tools/peertube-import-videos.ts index 0efe87810..3fb9979df 100644 --- a/server/tools/peertube-import-videos.ts +++ b/server/tools/peertube-import-videos.ts @@ -38,6 +38,7 @@ command .option('--first ', 'Process first n elements of returned playlist') .option('--last ', 'Process last n elements of returned playlist') .option('-T, --tmpdir ', 'Working directory', __dirname) + .usage("[global options] [ -- youtube-dl options]") .parse(process.argv) const log = getLogger(program['verbose']) @@ -71,10 +72,11 @@ async function run (url: string, user: UserInfo) { const youtubeDL = await safeGetYoutubeDL() - const options = [ '-j', '--flat-playlist', '--playlist-reverse' ] + const options = [ '-j', '--flat-playlist', '--playlist-reverse', ...command.args ] + youtubeDL.getInfo(program['targetUrl'], options, processOptions, async (err, info) => { if (err) { - exitError(err.message) + exitError(err.stderr + ' ' + err.message) } let infoArray: any[] @@ -146,7 +148,7 @@ function processVideo (parameters: { log.info('Downloading video "%s"...', videoInfo.title) - const options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', '-o', path ] + const options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', ...command.args, '-o', path ] try { const youtubeDL = await safeGetYoutubeDL() youtubeDL.exec(videoInfo.url, options, processOptions, async (err, output) => {