start with this

This commit is contained in:
Hrvoje Šimić
2014-09-09 00:08:40 +02:00
commit 5397c4930c
4 changed files with 75 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
node_modules
+9
View File
@@ -0,0 +1,9 @@
function Play(opts){
this.child_process = opts.child_process
this.play = function(what){
if (what) this.child_process.exec('cvlc ' + what)
}
}
module.exports = function(opts){
return new Play(opts)
}
+29
View File
@@ -0,0 +1,29 @@
{
"name": "play-sound",
"version": "0.0.0",
"description": "Play audio files by shelling out to available audio tool.",
"main": "index.js",
"scripts": {
"test": "node_modules/.bin/mocha tests.js"
},
"repository": {
"type": "git",
"url": "git://github.com/shime/play-sound.git"
},
"keywords": [
"audio",
"sound",
"play"
],
"author": "Hrvoje Simic <shime.ferovac@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/shime/play-sound/issues"
},
"homepage": "https://github.com/shime/play-sound",
"devDependencies": {
"expect.js": "^0.3.1",
"mocha": "^1.21.4",
"sinon": "^1.10.3"
}
}
+36
View File
@@ -0,0 +1,36 @@
var expect = require('expect.js')
, sinon = require('sinon')
describe('cvlc has the maximum priorty', function(){
it('tries to play with cvlc first', function(){
var command = "cvlc beep.mp3"
, spy = sinon.spy()
var cli = require('./')({ child_process: {
exec: spy
}})
cli.play('beep.mp3')
expect(spy.calledOnce).to.be(true)
expect(spy.calledWith(command)).to.be(true)
})
it("doesn't try to play anything if nothing is passed", function(){
var command = "cvlc beep.mp3"
, spy = sinon.spy()
var cli = require('./')({ child_process: spy})
cli.play()
expect(spy.called).to.not.be(true)
})
it("doesn't error out if it's not available")
})
it('fallbacks to other players')
describe('errors', function(){
})