diff --git a/README.md b/README.md index fb7b784..6a8ae88 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Lute +# Lute ![lute](https://raw.github.com/lyaunzbe/lute/master/lute.jpeg) @@ -17,7 +17,7 @@ Roadmap: * Multiple outputs * Pseudo effects (:newfile, :restart). Example: (sox infile.wav output.wav trim 0 30 : newfile : restart). Splits infile into n files, each 30 seconds in length. -### Installation +## Installation Before installing the module, you will need to install SoX. If you have homebrew, this is as simple as: @@ -42,9 +42,9 @@ var task = require('./path/to/your/task.json') lute(['song1.wav', 'song2.mp3'], task, callback); ``` -### Examples +## Examples -## Batch transcode, no output filenames given +### Batch transcode, no output filenames given ```javascript var task = { "outfile":{ @@ -55,7 +55,7 @@ var task = { lute(['Track-1.flac', 'Track-2.flac'], task, callback); // Outputs Track-1.mp3 & Track-2.mp3 ``` -## Transcode and flanger effect, w/ output filenames +### Transcode and flanger effect, w/ output filenames ```javascript var task = { "outfile":{ @@ -71,7 +71,7 @@ lute = (['Ride_With_It.flac', 'Sweet_Home_Alabama.flac'],task, callback); // Outputs song1.wav and song2.wav ``` -## Effect chain, no transcode and no output filenames +### Effect chain, no transcode and no output filenames ```javascript var task = { "effects":{ @@ -89,7 +89,7 @@ In general, if you aren't transcoding and dont provide any output filenames, they will be provied for you in the format of infile_epochtime.extension -### Testing +## Testing ```bash npm test ``` diff --git a/lib/lute.js b/lib/lute.js index bb9856f..c5d9158 100644 --- a/lib/lute.js +++ b/lib/lute.js @@ -10,6 +10,7 @@ */ var _ = require('lodash'), + path = require('path'), async = require('async'), spawn = require('child_process').spawn; @@ -38,12 +39,12 @@ module.exports = function (images, task, callback) { var queue = async.queue(function (infile,cb){ if(!task.outfile || !task.outfile.filename){ var id = new Date().getTime(); - var input = infile.split('.'); + var input = path.basename(infile).split('.'); outfile = input[0] +id + '.' +input[1]; } args = _.flatten([infile, outfile, effects]); - + console.log(args); var process = spawn('sox',args); process.on('exit', function(code){ diff --git a/test/index.js b/test/index.js index 465e53e..3b1910b 100644 --- a/test/index.js +++ b/test/index.js @@ -2,12 +2,12 @@ var test = require('tap').test, phaser = require('./../tasks/phaser.json'), lute = require('./../lib/lute'); + /* * Testing module and task definition. * */ test('Module definition', function(t){ - t.plan(2); t.type(lute, 'function', 'Lute should be a funciton.'); t.type(phaser,'object', 'Task should be an object.'); t.end(); @@ -21,11 +21,9 @@ test('Processesing an example task', function(t){ t.plan(1); lute(['rick.ogg', 'showtime.ogg'], phaser, function(err){ t.equal(null, err, 'Should return no errors or warnings'); - t.end(); }); }); - /** * A more complicated effect chain, using format options for * the output file. Ensure no errors.