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
var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
var App = null;
@ -52,12 +52,12 @@ exports.play = function(idx) {
if(channel !== undefined) {
var stream2play = channel.stream;
try {
/*try {
var parsers = require("playlist-parser");
var M3U = parsers.M3U;
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);
if(Helper.isDefinedAndNotNull(playlist[0])) {
@ -65,23 +65,23 @@ exports.play = function(idx) {
}
} catch(e) {
Log.error(e);
}
}*/
var ls = exec(
'mplayer -slave -quiet ' + stream2play,
function (error, stdout, stderr) {
Log.log('Radio: stdout: ' + stdout);
Log.log('Radio: stderr: ' + stderr);
if (error !== null) {
Log.error('Radio: exec error: ' + error);
}
}
var child = spawn(
'mplayer',
[
'-slave',
'-quit',
'stream2play'
]
);
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);
});
} else {