aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/tools/peertube-import-videos.ts8
1 files changed, 5 insertions, 3 deletions
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
38 .option('--first <first>', 'Process first n elements of returned playlist') 38 .option('--first <first>', 'Process first n elements of returned playlist')
39 .option('--last <last>', 'Process last n elements of returned playlist') 39 .option('--last <last>', 'Process last n elements of returned playlist')
40 .option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname) 40 .option('-T, --tmpdir <tmpdir>', 'Working directory', __dirname)
41 .usage("[global options] [ -- youtube-dl options]")
41 .parse(process.argv) 42 .parse(process.argv)
42 43
43const log = getLogger(program['verbose']) 44const log = getLogger(program['verbose'])
@@ -71,10 +72,11 @@ async function run (url: string, user: UserInfo) {
71 72
72 const youtubeDL = await safeGetYoutubeDL() 73 const youtubeDL = await safeGetYoutubeDL()
73 74
74 const options = [ '-j', '--flat-playlist', '--playlist-reverse' ] 75 const options = [ '-j', '--flat-playlist', '--playlist-reverse', ...command.args ]
76
75 youtubeDL.getInfo(program['targetUrl'], options, processOptions, async (err, info) => { 77 youtubeDL.getInfo(program['targetUrl'], options, processOptions, async (err, info) => {
76 if (err) { 78 if (err) {
77 exitError(err.message) 79 exitError(err.stderr + ' ' + err.message)
78 } 80 }
79 81
80 let infoArray: any[] 82 let infoArray: any[]
@@ -146,7 +148,7 @@ function processVideo (parameters: {
146 148
147 log.info('Downloading video "%s"...', videoInfo.title) 149 log.info('Downloading video "%s"...', videoInfo.title)
148 150
149 const options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', '-o', path ] 151 const options = [ '-f', 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best', ...command.args, '-o', path ]
150 try { 152 try {
151 const youtubeDL = await safeGetYoutubeDL() 153 const youtubeDL = await safeGetYoutubeDL()
152 youtubeDL.exec(videoInfo.url, options, processOptions, async (err, output) => { 154 youtubeDL.exec(videoInfo.url, options, processOptions, async (err, output) => {