ready4testing
This commit is contained in:
parent
692898fda1
commit
753b78d18b
@ -15,6 +15,8 @@ var Log = null
|
|||||||
var Helper = null;
|
var Helper = null;
|
||||||
var Conf = null;
|
var Conf = null;
|
||||||
|
|
||||||
|
var Child = null;
|
||||||
|
|
||||||
|
|
||||||
exports.init = function(Express, Configuration) {
|
exports.init = function(Express, Configuration) {
|
||||||
App = Express;
|
App = Express;
|
||||||
@ -51,6 +53,14 @@ exports.play = function(idx) {
|
|||||||
var channel = Conf.channels[idx];
|
var channel = Conf.channels[idx];
|
||||||
if(channel !== undefined) {
|
if(channel !== undefined) {
|
||||||
var stream2play = channel.stream;
|
var stream2play = channel.stream;
|
||||||
|
|
||||||
|
if(Helper.isDefinedAndNotNull(Child)) {
|
||||||
|
try {
|
||||||
|
Child.kill();
|
||||||
|
} catch(err) {
|
||||||
|
Log.error('Radio: Error killing process');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*try {
|
/*try {
|
||||||
var parsers = require("playlist-parser");
|
var parsers = require("playlist-parser");
|
||||||
@ -68,7 +78,7 @@ exports.play = function(idx) {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
var child = spawn(
|
var Child = spawn(
|
||||||
'mplayer',
|
'mplayer',
|
||||||
[
|
[
|
||||||
'-slave',
|
'-slave',
|
||||||
@ -77,13 +87,19 @@ exports.play = function(idx) {
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
child.stdout.on('data', function(chunk) {
|
// listen for any response from the child
|
||||||
|
Child.stdout.on('data', function(chunk) {
|
||||||
Log.log('Radio: ' + chunk);
|
Log.log('Radio: ' + chunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
child.on('exit', function (code){
|
// listen for any errors
|
||||||
Log.log('Radio: Child process exited with exit code ' + code);
|
Child.stderr.on('data', function (chunk) {
|
||||||
|
Log.error('Radio: ' + chunk);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*Child.on('exit', function (code){
|
||||||
|
Log.log('Radio: Child process exited with exit code ' + code);
|
||||||
|
});*/
|
||||||
} else {
|
} else {
|
||||||
Log.error('Radio: No channel defined!');
|
Log.error('Radio: No channel defined!');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,12 @@
|
|||||||
"title": "WDR2",
|
"title": "WDR2",
|
||||||
"stream": "http://www.wdr.de/wdrlive/media/mp3/wdr2-ostwestfalen-lippe.m3u",
|
"stream": "http://www.wdr.de/wdrlive/media/mp3/wdr2-ostwestfalen-lippe.m3u",
|
||||||
"icon": "http://chip01.chipimages.de/crawler-mq/itunes/15/63/69/36/80/299611083/f9316ffa005339794c7d80d210b8464b.jpg"
|
"icon": "http://chip01.chipimages.de/crawler-mq/itunes/15/63/69/36/80/299611083/f9316ffa005339794c7d80d210b8464b.jpg"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "radiostream",
|
||||||
|
"title": "1Live",
|
||||||
|
"stream": "http://www.wdr.de/wdrlive/media/mp3/1live.m3u",
|
||||||
|
"icon": "https://www.android-user.de/wp-content/uploads/2015/01/icon-1live.png"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"logging": {
|
"logging": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user