ready4testing

This commit is contained in:
Gerrit Linnemann 2015-11-02 15:59:21 +01:00
parent 1d08ba6432
commit 692898fda1

View File

@ -7,7 +7,7 @@
// load the things we need // load the things we need
var exec = require('child_process').exec; var spawn = require('child_process').spawn;
var App = null; var App = null;
@ -52,12 +52,12 @@ exports.play = function(idx) {
if(channel !== undefined) { if(channel !== undefined) {
var stream2play = channel.stream; var stream2play = channel.stream;
try { /*try {
var parsers = require("playlist-parser"); var parsers = require("playlist-parser");
var M3U = parsers.M3U; var M3U = parsers.M3U;
var fs = require("fs"); var fs = require("fs");
var playlist = M3U.parse(fs.readFileSync('/Users/gerrit/Downloads/swr3_m.m3u', { encoding: "utf8" })); var playlist = M3U.parse(fs.readFileSync(channel.stream, { encoding: "utf8" }));
Log.inspect('Radio: playlist', playlist); Log.inspect('Radio: playlist', playlist);
if(Helper.isDefinedAndNotNull(playlist[0])) { if(Helper.isDefinedAndNotNull(playlist[0])) {
@ -65,23 +65,23 @@ exports.play = function(idx) {
} }
} catch(e) { } catch(e) {
Log.error(e); Log.error(e);
} }*/
var ls = exec( var child = spawn(
'mplayer -slave -quiet ' + stream2play, 'mplayer',
function (error, stdout, stderr) { [
Log.log('Radio: stdout: ' + stdout); '-slave',
Log.log('Radio: stderr: ' + stderr); '-quit',
if (error !== null) { 'stream2play'
Log.error('Radio: exec error: ' + error); ]
}
}
); );
setTimeout(function() { exec('echo "pause"', function(error, stdout, stderr) {}); }, 4000); child.stdout.on('data', function(chunk) {
Log.log('Radio: ' + chunk);
});
ls.on('exit', function (code){ child.on('exit', function (code){
Log.log('Radio: Child process exited with exit code ' + code); Log.log('Radio: Child process exited with exit code ' + code);
}); });
} else { } else {