1
0
Fork 0

peertube-import-videos passes remaining options down to youtube-dl

This commit is contained in:
Raphaël Droz 2020-02-10 23:16:06 -03:00 committed by Chocobozzz
parent e5426b3fa4
commit 79ee77eab1

View file

@ -38,6 +38,7 @@ command
.option('--first <first>', 'Process first n elements of returned playlist') .option('--first <first>', 'Process first n elements of returned playlist')
.option('--last <last>', 'Process last n elements of returned playlist') .option('--last <last>', 'Process last n elements of returned playlist')
.option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname) .option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname)
.usage("[global options] [ -- youtube-dl options]")
.parse(process.argv) .parse(process.argv)
const log = getLogger(program['verbose']) const log = getLogger(program['verbose'])
@ -71,10 +72,11 @@ async function run (url: string, user: UserInfo) {
const youtubeDL = await safeGetYoutubeDL() 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) => { youtubeDL.getInfo(program['targetUrl'], options, processOptions, async (err, info) => {
if (err) { if (err) {
exitError(err.message) exitError(err.stderr + ' ' + err.message)
} }
let infoArray: any[] let infoArray: any[]
@ -146,7 +148,7 @@ function processVideo (parameters: {
log.info('Downloading video "%s"...', videoInfo.title) 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 { try {
const youtubeDL = await safeGetYoutubeDL() const youtubeDL = await safeGetYoutubeDL()
youtubeDL.exec(videoInfo.url, options, processOptions, async (err, output) => { youtubeDL.exec(videoInfo.url, options, processOptions, async (err, output) => {