Page 9 of 10

Re: SONOS Plugin Official (download here)

Posted: Tue Feb 02, 2016 11:10 pm
by techoguy
PaulBeauvais wrote:I am having the same issues. If there is anything I can do to help track down the problems let me know.
PaulBeauvais, can you tell me how many favorites is listed in your menu?

Sorry, guys I haven't been able to look at this too much. I have a 3 year old, a 3 month old that just had surgery, and I'm starting a business. I do hope to get it fixed though. If anyone is willing to help, I'm more than happy to go over any of the code and how it works. Long term, I'd really like to re-write the whole thing but I don't have time right now.
coricidin wrote:Is there a way to get currently playing track/artist information? Or better yet fire an eventghost event containing that info every time the currently playing track changes?
Technically yes, the plugin gets updated just like the app would. I believe I never fully implemented it though because there didn't seem to be too much interest and there was some effort to filter out duplicate events. To handle groups, I also wanted each individual group to trigger as well even though the actual event only comes from one player in the group. Off hand I don't recall where I left it at.

Depending on what you wanted to do with the data it could be pretty easy to just a line of code to do it but if it needs to be clean, then it might be a little different. Some of hte music sources are slightly different too.

Re: SONOS Plugin Official (download here)

Posted: Wed Feb 03, 2016 10:32 pm
by kalinkamaen
Hello Techoguy.

You should not feel sorry for not having the time for fixing this plugin. Family is always first.
I wish both of your children the best! And thank you for making this sonos plugin happen.
I use it daily, even if I cant use the playlist part of it.

Regards Morten

Re: SONOS Plugin Official (download here)

Posted: Thu Feb 04, 2016 5:40 pm
by techoguy
kalinkamaen wrote: You should not feel sorry for not having the time for fixing this plugin. Family is always first.
I wish both of your children the best! And thank you for making this sonos plugin happen.
I use it daily, even if I cant use the playlist part of it.
Thanks Kalinkamaen, hopefully I can figure out whats going on soon.

coricidin wrote:Is there a way to get currently playing track/artist information? Or better yet fire an eventghost event containing that info every time the currently playing track changes?
Coricidin,
I took at look at this a little bit and can easily create events for new track and albums. But there are some aspects that make it much more difficult if you want it to always be accurate. What I mean by that is if you look at your SONOS app you'll notice that different sources like TuneIn vs Spotify display different things. TuneIn won't display a "title" and "artist" instead it just displays the station. The Title can sometimes be found in the information area. So right now if I were to trigger just title and artist, when listening to TuneIn the title and artist would be blank or the title will simply show the station name. But for most sources the track, album, and even the cover artwork, is easy enough to grab.

Did you have a use case or a way you'd like to see the data in the trigger? For example, one trigger that as all the artist and title data in the payload or individual triggers for each thing like title and artist?

Re: SONOS Plugin Official (download here)

Posted: Fri Apr 01, 2016 5:45 pm
by heggholmen
Been any time to identify a solution for starting playlist / favorite - just asking, now stress:)

Re: SONOS Plugin Official (download here)

Posted: Sat Apr 02, 2016 4:13 am
by techoguy
No, but I see now that it is no longer working on mine for another reason. It looks like a couple of other things have been broken after a SONOS update too. One thing I'm noticing is the way Groups were controlled has been changed. When I send "play" of a child zone player in a group it no longer successfully tells the master of the group to "play" like it did before. So it appears SONOS has changed a handful of things now.

I'll have to run more tests to see what has changed and see what it'll take to get it all fixed.

I really wish SONOS would come out with an official API. Maybe after getting rid of their product lead, the new guy will allow it?
Fingers crossed!

Edit: 4/3/2016 -
well I'm embarresed to say the problem I was having is that my computers network connection had been turned to public instead of private and so the firewall was blocking some of the broadcasts needed to control SONOS properly. So it seems to be working right again on my end.

As for the play list action, I'll have to create a special version for you guys that are having issues to test to see if I can figure out what's going on. If anyone can capture network traffic between SONOS and your EG PC with wireshark when opening the playlist action, that would be very helpful too.

Re: SONOS Plugin Official (download here)

Posted: Sun May 01, 2016 7:14 pm
by flippy
I have the same problem with Favorites. Hoping for a cure soon :)

Re: SONOS Plugin Official (download here)

Posted: Mon May 02, 2016 3:30 pm
by techoguy
is someone with the problem able to capture packets with wireshark when they try to open the Favorite Playlist configuration window?
This would help greatly as I'm not seeing the problem and can't re-create the issue on my end.

I'm looking for the request from EventGhost to the SONOS and the response from SONOS. There are a couple of requests sent when opening the Favorites Action window.

If someone can, send me the capture file and I'll look through it to see how it's different from mine to fix the plugin.

Re: SONOS Plugin Official (download here)

Posted: Tue May 03, 2016 3:58 pm
by kalinkamaen
HEllo sir. I have tried to do what you have been asking for. I am not sure if I did it the right way.
Please check the file.
https://mega.nz/#!CAVhXT5I!Uqk47Cb6_ZYE ... sgVnfn2UZM

The sonos player I tried to open favorite playlist with, ends with 192.***.**.152

Re: SONOS Plugin Official (download here)

Posted: Wed May 04, 2016 2:16 pm
by techoguy
kalinkamaen wrote:HEllo sir. I have tried to do what you have been asking for....
Thanks for the support! I've been looking at this to try and figure out what's going on. It's very odd because the response your sonos system gives is just as expected, yet in mine it works. So I'm going to try to run some more tests with the packets you sent and see if I can figure this out.

I did forget to mention, if anyone else can provide a capture file just like Kalinkamaen did, please also include the EG log output during the same time so I can see the error produced.

Also,
if you want to filter the wireshark captures and only send me the response packet here's how:
after the capture, apply this filter in wireshark: http contains upnp:artist
Then right click the packet that is found (should only be one) and select Follow > TCP stream
A new window will pop up with red and blue text. Copy all of the text and send me that text in a private message.

Thanks for the support, hopefully I can get this figured out.

Re: SONOS Plugin Official (download here)

Posted: Wed May 04, 2016 4:15 pm
by techoguy
Hey All,

I have made some changes to fix the playlist issue and I have added some track meta data information. Let me know if this fixes your problem.

https://github.com/techoguy/Full-SONOS- ... _init__.py

Re: SONOS Plugin Official (download here)

Posted: Wed May 04, 2016 5:31 pm
by kalinkamaen
Hello Techoguy. It works like a champ here now. Hopefully you found the problem :)

Re: SONOS Plugin Official (download here)

Posted: Wed May 04, 2016 6:27 pm
by pattehed01
Now it works :D and i can start a playlist (romantik)from a Philips Hue Tap and set my HUE lamps to soft and then go to sleep 8) 8) .Thanks

Re: SONOS Plugin Official (download here)

Posted: Fri May 06, 2016 7:32 am
by techoguy
Glad it's working!

There's been a couple more changes to add an event to get the cover art of the currently playing song (when ever it changes an event triggers with the URL)
https://github.com/techoguy/Full-SONOS- ... _init__.py

SONOS.RINCON_000E58D1111111400.Title u"Master BedRoom:You're in Slacker Music"
SONOS.RINCON_000E58D1111111400.Artist u"Master BedRoom:Slacker Radio"
SONOS.RINCON_000E58D1111111400.Source u"Master BedRoom:unknown source"
SONOS.RINCON_000E58D1111111400.AlbumArtWorkURL u"Master BedRoom:http://192.168.0.106:1400/getaa?s=1&u=x ... 4%26sn%3d2"

Also, if you un-comment lines 763 and 764, it'll download the cover art for your and save it in the specified location:

Code: Select all

#picfileloc = albumartloc + uuid + ".jpg" #2/3/2016 uncomment to save cover art to the albumartloc
#urllib.urlretrieve(albumarturl, picfileloc) #2/3/2016 uncomment to save cover art to the albumartloc
To change the location, change line 44:

Code: Select all

albumartloc = "C:\\SONOS_Covers\\" #make sure to include dual \\ and include it at the end.
The theory here is that you can trigger cool events like when a certain song plays, dim the lights or turn on your strobe and smoke machine :wink: or maybe more useful to beable to display current track and cover art information on a web page or GUI.

The good thing with how the events will trigger is that it'll send an event for every ZP in a group so you don't have to worry about which one is the master of the group which holds the actual meta data and cover art.

Let me know if anyone uses the new events, I'd love to hear how you use them.

Re: SONOS Plugin Official (download here)

Posted: Thu Sep 22, 2016 1:41 pm
by eirik226
Hey!

Great plugin - use it daily.

I was wondering if it's possible to get some more information from the Sonos plugin. I have everything running on a website (the webserver pluging for eventghost) and use it to turn lights on off, tv etc, and ofc sonos.

Now I want to create a "media player" on this site and was wondering if it's possible to get album art, timer of how much of the song is left and stuff like that. I've read through the forum post but did not find anything, is that at all possible? :)

Thanks in advance.

Re: SONOS Plugin Official (download here)

Posted: Thu Sep 22, 2016 8:01 pm
by techoguy
Hi Eirik226,

Thanks!

To get the album are, refer to the post right before yours. It goes over how to get the cover art. You basically have two options, you can receive the event with the URL to the sonos player cover art or you can have the plugin save the image to a local folder. This can then be displayed on your web page. Basically the event will show up anytime the media changes.

As for the actual time, this has not been implemented. The simple way to do this would be to add a duration to the events that are triggered when the album changes. Then this can be sent over to your web interface. For you to show the exact position, you would have to add that to your site to start counting when the music starts or stops. Then if you want an actual slider that can pick a time to jump to, then an action would have to be added to send that time to the player.

In theory, most of the heavy lifting would be in your web interface. But, the issues arise in that not all tracks have a time or can be adjusted (like pandora music). So how would this all be handled? If it was handled within this plugin, it would take some work to get that to handle all that properly. Web GUI could handle it as well which is what the SONOS apps does (it makes features hidden or available when they can be controlled based on the media playing).

So the easy implementation would be to not have the time and only allow transport options like play, next etc. The second option could be to at least display the duration of the song which requires adding that to the plugin. The third would be a full integration where the duration is shown and the function to start playing a specific time when it's adjusted on the web GUI. This I could only image would cause a lot of conflicts.

Another options could be for your web interface to directly communicate to sonos. You could get the "master" zone player from the plugin, then handle the requests in the web page directly to the zone player. The EG SONOS plugin could tell your web page when to update and request info again, but everything else could be handled in the web page to keep everything closer in sync.