diff options
author | Florrie <towerofnix@gmail.com> | 2018-01-17 18:33:13 -0400 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-01-17 18:33:13 -0400 |
commit | fb2f9ecda0531a950a871c6b85d42e913f3874f7 (patch) | |
tree | bf648c8f33f18a3b1da30dafd8a4e36c30d2a13d /src | |
parent | b7e52919ebbf0b5c9b1772682e2d63c2e9aeb831 (diff) |
Add cp converter
Diffstat (limited to 'src')
-rw-r--r-- | src/downloaders.js | 12 |
1 files changed, 9 insertions, 3 deletions
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() |