ready4testing

This commit is contained in:
Gerrit Linnemann 2015-11-02 16:35:16 +01:00
parent dd1fdab73d
commit 33eb4b0b81
2 changed files with 10 additions and 4 deletions

View File

@ -8,6 +8,9 @@
// load the things we need // load the things we need
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var fs = require("fs");
var http = require('http');
var wget = require('wget');
var App = null; var App = null;
@ -54,6 +57,10 @@ exports.play = function(idx) {
if(channel !== undefined) { if(channel !== undefined) {
var stream2play = channel.stream; var stream2play = channel.stream;
var m3u = '/tmp/kitchenradio.m3u';
fs.unlinkSync(m3u);
wget.download(channel.stream, m3u);
if(Helper.isDefinedAndNotNull(Child)) { if(Helper.isDefinedAndNotNull(Child)) {
try { try {
Child.kill(); Child.kill();
@ -66,8 +73,7 @@ exports.play = function(idx) {
var parsers = require('playlist-parser'); var parsers = require('playlist-parser');
var M3U = parsers.M3U; var M3U = parsers.M3U;
var fs = require("fs"); var playlist = M3U.parse(fs.readFileSync(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])) {
@ -77,7 +83,6 @@ exports.play = function(idx) {
Log.error(e); Log.error(e);
} }
var Child = spawn( var Child = spawn(
'mplayer', 'mplayer',
[ [

View File

@ -17,6 +17,7 @@
"dateformat": "*", "dateformat": "*",
"eyespect": "*", "eyespect": "*",
"interface-addresses": "*", "interface-addresses": "*",
"playlist-parser": "*" "playlist-parser": "*",
"wget": "*"
} }
} }