jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.83k stars 462 forks source link

ERROR No matches were found - for some albums in the library #852

Closed WhileDekker closed 1 year ago

WhileDekker commented 1 year ago

Hi,

i am facing a strange issue. Some albums from my library cannot be found via the API. Most of my albums just work fine.

Example:

I have an album called "Zusammen sind wir stark", when I search for it in the Sonos Client it just works fine.

If I verify the album name on the mp3 file it is exactly "Zusammen sind wir stark"

when I try to call the API like this: (http://xxx:5005/Wohnzimmer/musicsearch/library/album/Zusammen%20sind%20wir%20stark)

i get this error: (I changed the server.js to get the url in the output) /Wohnzimmer/pause /Wohnzimmer/clearqueue /Wohnzimmer/musicsearch/library/album/Zusammen%20sind%20wir%20stark 2022-09-05T18:18:44.046Z ERROR No matches were found

Other API calls for other albums like: http://xxx:5005/Wohnzimmer/musicsearch/library/album/Drinnen%20ist%20was%20los work just fine. /Wohnzimmer/musicsearch/library/album/Drinnen%20ist%20was%20los

any idea would really be appreciated.

WhileDekker commented 1 year ago

Hey,

I found the issue.

After debuging the code i found out that the sonos library is cached in a file called /cache/library.json and that file was created when i first deployed the container, but after i recently added stuff to the sonos library that file wasnt updated. After deleting the library.json it got recreated and it started working. @jishi: So I guess some update mechanism would be fine, i will for now delete the file manually whenever I add stuff to Sonos.

@jishi: By debugging that issue I found two other minor things:

  1. If the album title contains a ":" the api call give a "No matches were found" error
  2. I have some albums without artists and I am using the API from the Sonos Kids Controller, here artist is never used for the API call, so it shouldnt matter if an album has no artist, but apparently albums without artist are not added to library.json, i added a fake artist to those and it started working.

Thanks