simojenki / bonob

sonos SMAPI implementation allowing integrating different music sources with sonos.
GNU General Public License v3.0
208 stars 15 forks source link

Enable playlist search #160

Open dhalem opened 1 year ago

dhalem commented 1 year ago

I'd love to be able to search by playlist. Happy to add it myself with some pointers.

simojenki commented 1 year ago

I'm not sure I follow, do you mean; Search for a playlist? Search within a playlist?

dhalem commented 1 year ago

I want to search for a playlist by name in the sonos app and find it on ND via bonob.

simojenki commented 1 year ago

Doesn't look like the subsonic api supports that, so would require a custom ND driver, which is a WIP. I'll look to integrate this feature into that change

dhalem commented 1 year ago

I started to play around adding this and seem to have an issue where my Sonos system isn't seeing the updated PresentationMap. Have you seen something like this? Any way to flush old service definitions that you know of?

simojenki commented 1 year ago

yes, I recall this happening. There are a few things that I have used in the past to try and make things a bit more predictable when testing.

The presentation map (and strings.xml) are versioned in the sonos device, currently bonob is up to version 23. https://github.com/simojenki/bonob/blob/master/src/sonos.ts#L30 So when either the presentation map or strings.xml changes I try to remember to bump the version so that peoples devices pull the latest config.

However when working locally in dev mode and testing it having to bump the version manually is annoying so I added the BNB_DEBUG env var which will use system time as the version. So every time you restart you get a new version. Obviously this value is much larger that 23 so it is best to use this only when register a different service than the one you use day to day. This is why yarn dev or yarn devr register a service name of z_bonobDev, so that it is not the same as my normal bonob/ND instance. see: https://github.com/simojenki/bonob/blob/master/src/sonos.ts#L27

The other thing that i recall happening is that the sonos device itself will cache things, or perhaps the client on your phone does. So in past I have closed the app and re-opened it when I restart local dev bonob. I use an iPhone, so I just close the app, thus forcing it to start up again.

Hope that helps.