Sonos queue feedback

Forum to ask for any help
Post Reply
Peter M
Posts: 15
Joined: Fri Sep 15, 2017 8:49 am

Sonos queue feedback

Post by Peter M » Thu Mar 15, 2018 7:11 am

I'm new to DemoPad and after many years of using iRule I've spent the last month or so re-doing the control system for my theatre room.

DemoPad support via email has been brilliant in helping me sort out a few problems.

I have a Sonos Connect for streaming CDs into the theatre system, and so I downloaded the basic Sonos commands from elsewhere on the forum and they work fine.

What I'd really love to be able to do is get some feedback from Sonos and display the next few tracks in the queue. Reading up on UPnP and SOAP has convinced me that I don't have a hope of doing it on my own.

Is anyone able to provide any guidance ?

Cheers,
Peter M

Peter M
Posts: 15
Joined: Fri Sep 15, 2017 8:49 am

Re: Sonos queue feedback

Post by Peter M » Thu Apr 19, 2018 4:34 am

After lots and lots of reading and learning the wonders of Wireshark I've been able to get Sonos queue feedback working, however it's not yet quite right. I'm tying to extract Artist and Title for the current track and five following tracks. Frustratingly I can only get the current track and four following tracks to work.

Within the XML feedback the details for each track sit between an <item></item> pair, so as an example the regex for the fourth Artist looks like this -

BrowseResponse.*?/item.*?/item.*?/item.*?dc:creator&gt;(.*?)&lt;/dc:creator

It jumps past the first three </item> and grabs the info between the next <dc:creator></dc:creator> pair. To grab all six Artists and Titles I have 12 similar pattern matches with the only difference being the number of </item> it jumps past.

All works fine for five tracks but I'm getting nothing for the sixth track, so a question for Demopad support - is there a feedback length limit that I could be hitting ?

Cheers,
Peter M

Peter M
Posts: 15
Joined: Fri Sep 15, 2017 8:49 am

Re: Sonos queue feedback

Post by Peter M » Thu Apr 19, 2018 4:38 am

Here is the full regex -

BrowseResponse.*?dc:creator&gt;(.*?)&lt;/dc:creator
BrowseResponse.*?/item.*?dc:creator&gt;(.*?)&lt;/dc:creator
BrowseResponse.*?/item.*?/item.*?dc:creator&gt;(.*?)&lt;/dc:creator
BrowseResponse.*?/item.*?/item.*?/item.*?dc:creator&gt;(.*?)&lt;/dc:creator
BrowseResponse.*?/item.*?/item.*?/item.*?/item.*?dc:creator&gt;(.*?)&lt;/dc:creator
BrowseResponse.*?/item.*?/item.*?/item.*?/item.*?/item.*?dc:creator&gt;(.*?)&lt;/dc:creator

BrowseResponse.*?dc:title&gt;(.*?)&lt;/dc:title
BrowseResponse.*?/item.*?dc:title&gt;(.*?)&lt;/dc:title
BrowseResponse.*?/item.*?/item.*?dc:title&gt;(.*?)&lt;/dc:title
BrowseResponse.*?/item.*?/item.*?/item.*?dc:title&gt;(.*?)&lt;/dc:title
BrowseResponse.*?/item.*?/item.*?/item.*?/item.*?dc:title&gt;(.*?)&lt;/dc:title
BrowseResponse.*?/item.*?/item.*?/item.*?/item.*?/item.*?dc:title&gt;(.*?)&lt;/dc:title

Each of these is a separate pattern match with extracted info going into 12 separate Labels.

Cheers,
Peter M

Peter M
Posts: 15
Joined: Fri Sep 15, 2017 8:49 am

Re: Sonos queue feedback

Post by Peter M » Sun Apr 22, 2018 4:24 am

After a LOT of trial and error I decided to cut back the queue to the current track + 3 following, as the regex above just wouldn't work reliably.

I've also got album art working in a web view by using feedback to grab the artist / album and use these in a http call to the NAS drive to get the appropriate folder.jpg.

Cheers,
Peter M

AKWillows
Posts: 53
Joined: Mon Aug 25, 2014 5:46 pm

Re: Sonos queue feedback

Post by AKWillows » Wed May 02, 2018 6:04 pm

Hi Peter

Like you, I have really enjoyed learning a lot about the various tech in my home and getting it working in Demopad. I've had success with most things (and given up on a couple!). As far as Sonos is concerned, I've been able to send basic commands but have always aspired to do exactly what you have done and get track listing/album art.

You seem to have had much more success than I have, so I wonder if you could give me some help?

Are you able to share the commands you send to Sonos to get that feedback please?

You mention that you have cut it back to current track +3, is that just by removing the bottom two rows of each section of Regex?

And..... could you elaborate on the http call you make to the NAS drive and what's the Regex for the artist/album?

I know it's a lot of questions, but I'd love to learn from what you have achieved!

Thanks :-)

Peter M
Posts: 15
Joined: Fri Sep 15, 2017 8:49 am

Re: Sonos queue feedback

Post by Peter M » Fri May 04, 2018 7:46 am

This will hopefully answer all your questions.

If not - ask away !

Cheers,
Peter
You do not have the required permissions to view the files attached to this post.

Post Reply