From fb2f9ecda0531a950a871c6b85d42e913f3874f7 Mon Sep 17 00:00:00 2001 From: Florrie Date: Wed, 17 Jan 2018 18:33:13 -0400 Subject: Add cp converter --- src/downloaders.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/downloaders.js b/src/downloaders.js index 138b2d6..f5efa3e 100644 --- a/src/downloaders.js +++ b/src/downloaders.js @@ -111,8 +111,7 @@ function makePowerfulDownloader(downloader, maxAttempts = 5) { } async function makeConverter( - converterCommand = null, exportExtension = 'wav', - converterOptions = ['-i', '$in', '$out'] + converterCommand = null, exportExtension = 'wav' ) { if (converterCommand === null) { throw new Error( @@ -120,7 +119,14 @@ async function makeConverter( ) } - return function(converterOptions = ['-i', '$in', '$out']) { + return function(converterOptions = null) { + if (converterOptions === null) { + if (['ffmpeg', 'avconv'].includes(converterCommand)) { + converterOptions = ['-i', '$in', '$out'] + } else if (converterCommand === 'cp') { + converterOptions = ['$in', '$out'] + } + } return async function(inFile) { const base = path.basename(inFile, path.extname(inFile)) const tempDir = tempy.directory() -- cgit 1.3.0-6-gf8a5