lordpengwin / muzak

Amazon Echo Skill for Logitech/Squeezebox Media Server
MIT License
35 stars 16 forks source link

java script failing when doing a replace on what looks like a Squeezebox name. #7

Open cthierman opened 7 years ago

cthierman commented 7 years ago

Hi I'm really hoping you can help me,

So I've managed to get muzak Alexa function almost working.... But when I do a simple test of "what is playing" the function blows up with a "TypeError: Connot read property 'replace' of undefined

It almost looks like it's tripping up on the fact that some of my squeezebox names have blanks in them.

Am I missing something, or is this actually a bug in the squeezenode code?

Here is some output from the console log, with app id replaced with xxxx:

2017-03-04T17:57:58.487Z 18fa40e8-0104-11e7-8a79-59166935dcbd getPlayers: {"result":[{"isplayer":1,"displaytype":"graphic-160x32","name":"Boom Box","canpoweroff":1,"playerid":"00:04:20:1e:46:51","model":"boom","ip":"192.168.1.100:35466","playerindex":"0","connected":1,"uuid":"273d0e60d66aef1f0ac1b84bbac097f5"},{"playerid":"00:04:20:06:84:21","model":"squeezebox3","ip":"192.168.1.32:24156","playeri  17:57:58 2017-03-04T17:57:58.488Z 18fa40e8-0104-11e7-8a79-59166935dcbd Got intent: {"name":"WhatsPlaying","slots":{"Player":{"name":"Player"}}} 2017-03-04T17:57:58.488Z 18fa40e8-0104-11e7-8a79-59166935dcbd Got intent: { "name": "WhatsPlaying", "slots": { "Player": { "name": "Player" } } }

 17:57:58 2017-03-04T17:57:58.488Z 18fa40e8-0104-11e7-8a79-59166935dcbd Session is {"new":true,"sessionId":"SessionId.04e0a212-eb64-4815-b22c-7fc01571889a","application":{"applicationId":"amzn1.ask.skill.xxxx-xxx-xxxx-xxxx"},"attributes":{},"user":{"userId":"amzn1.ask.account.xxxxxxxxxxxxxxxxxxxxxx 17:57:58 2017-03-04T17:57:58.494Z 18fa40e8-0104-11e7-8a79-59166935dcbd TypeError: Cannot read property 'replace' of undefined at normalizePlayer (/var/task/muzak.js:568:28) at findPlayerObject (/var/task/muzak.js:540:12) at dispatchIntent (/var/task/muzak.js:150:22) at /var/task/muzak.js:121:17 at /var/task/node_modules/squeezenode-lordpengwin/server.js:80:13 at handle (/var/task/no  17:57:58

cthierman commented 7 years ago

Found an issue with a routine and commented it out. seems to have fixed the problem.

MikeDeSantis commented 7 years ago

Hey cthierman, What routine/line did you comment? Any other info you can provide for your specific implementation that would help correct the bug?

-Mike

cthierman commented 7 years ago

Hi Mike.

In Muzak.js inside the function normalizePlayer. I commented out the first three lines of code as the replace was failing and I noticed you explicitly did it for a device called livingroom, where my device already had the space in it so I figured it was not needed. Not sure why the replace was failing.

Sent from my iPhone

On Mar 6, 2017, at 7:29 AM, Mike notifications@github.com wrote:

Hey cthierman, What routine/line did you comment? Any other info you can provide for your specific implementation that would help correct the bug?

-Mike

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

heylookltsme commented 7 years ago

I have a fix for this in this PR - https://github.com/MikeDeSantis/muzak/pull/3