aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRaphaƫl Droz <raphael.droz+floss@gmail.com>2020-02-10 23:16:06 -0300
committerChocobozzz <chocobozzz@cpy.re>2020-02-12 11:33:14 +0100
commit79ee77eab14a64d51f628564062486ec388931b4 (patch)
tree8f5026c4e1aa5e2e355ef2c469d0bb394f10c45a
parente5426b3fa433487c664761b7076321858365a168 (diff)
downloadPeerTube-79ee77eab14a64d51f628564062486ec388931b4.tar.gz
PeerTube-79ee77eab14a64d51f628564062486ec388931b4.tar.zst
PeerTube-79ee77eab14a64d51f628564062486ec388931b4.zip
peertube-import-videos passes remaining options down to youtube-dl
-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) => {