mirror of
https://github.com/balkian/go5ears.git
synced 2024-11-22 13:22:28 +00:00
Safely parse the response from goear (avoid resets)
This commit is contained in:
parent
1cf3f5d803
commit
62eff02fee
22
player.js
22
player.js
@ -74,16 +74,18 @@ app.get('/play', function(req,resp){
|
|||||||
parser.parseString(xml, function(err,result){
|
parser.parseString(xml, function(err,result){
|
||||||
console.log("xml: "+xml);
|
console.log("xml: "+xml);
|
||||||
console.log("Object: "+JSON.stringify(result));
|
console.log("Object: "+JSON.stringify(result));
|
||||||
var song = result['songs']['song'][0]["$"];
|
try{
|
||||||
console.log("Song:"+JSON.stringify(song));
|
var song = result['songs']['song'][0]["$"];
|
||||||
var path = song['path'];
|
console.log("Song:"+JSON.stringify(song));
|
||||||
var title = song['title'];
|
var path = song['path'];
|
||||||
var artist = song['artist'];
|
var title = song['title'];
|
||||||
console.log(title + " - " +artist+" - "+path);
|
var artist = song['artist'];
|
||||||
resp.writeHead(302, {
|
console.log(title + " - " +artist+" - "+path);
|
||||||
'Location': path
|
resp.writeHead(302, {
|
||||||
//add other headers here...
|
'Location': path
|
||||||
});
|
//add other headers here...
|
||||||
|
});
|
||||||
|
}
|
||||||
resp.end();
|
resp.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user