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.85k stars 460 forks source link

Add ability to play an album by a given artist from the library #351

Open ppitkin opened 8 years ago

ppitkin commented 8 years ago

At the moment you can request that: 1) tracks by a specific artist are selected and played from the sonos library 2) that the tracks from an album(s) with a specific name are played from the sonos library

What is missing is the ability to play just the tracks from a specific artist from an album.

This will get around the problem of the album name not being unique. e.g. in my library I have a number of Albums titled "Gold" and currently the interface will queue up all the track from all those albums called "Gold" (and queue them in a random order).

With this request I would like to be able to request 'play the album "xxx" by artist "yyy" ' which should then cause the tracks to be queued up based on the track number on the album and will ensure I get the actual album that I'm looking for.

thanks Peter

jplourde5 commented 8 years ago

Enhancement made and proposed. Also requires acceptance of an enhancement made to sones-discovery that adds the artist name to the container search results.

jishi commented 8 years ago

I have merged the changes now. Please evaluate it. I moved the library.json to the cache folder instead, seemed more appropriate.

jplourde5 commented 8 years ago

I'll pull it down now and test it.

jplourde5 commented 8 years ago

Getting a new error on startup. Looks like you have created a setting.js to load the settings.json file.

  1. Not seeing the settings.json file. Where does it go now?
  2. I don't see the cache folder getting created
  3. It is complaining that logger is not installed

I'm going to do some further digging...

jishi commented 8 years ago

settings.json goes into the same place as before, the root of sonos-http-api. The settings.js is just to consolidate settings loading and initialization.

Where do you expect the cache folder to be created? It is created in the root folder, same level as server.js.

jishi commented 8 years ago

I pushed a fix for the logger error, it only occured if you didn't have a settings.json.

jplourde5 commented 8 years ago

It found the settings.json file. Ignore. The cache folder did not get created because of the logger exception. Ignore.

The pandora section of my settings file is choking the merge. Did the settings.json structure change?

Still digging.

jplourde5 commented 8 years ago

This is the error that is getting thrown:

TypeError: Cannot set property 'username' of undefined

This is my settings.json file

{
  "pandora": {
    "username": "xxxxxx@gmail.com",
    "password": "xxxxxxxxx"
  },
  "voicerss": "0f1fa2acxxxxxxxxxxxxxxxxxxxxxx"
}
jplourde5 commented 8 years ago

Found and fixed three bugs, two in settings.js and one in spotify.js

Everything seems to work with the fixes in place

jishi commented 8 years ago

Yeah, missed a discrepancy between Node 6 and 4, node 6 no longer requires 'use strict' it seems, it is implicitly strict. Should really get some tests up and running for the http-api to avoid these kind of mistakes in the future.

jplourde5 commented 8 years ago

This enhancement is in place

ppitkin commented 8 years ago

Sorry one further test…

“/patio/musicsearch/library/album/Chris Rea+Gold” - NOTE: no “+” sign between “Chris” and “Rea” (unlike the examples given in the help file on github. )

This returned all the tracks from the album “God’s great banana skin” by “Chris Rea”

“/patio/musicsearch/library/album/Chris+Rea+Gold” - gave no matches found

“/patio/musicsearch/library/album/Chris Rea Gold” - gave no matches found

“/patio/musicsearch/library/album/Chris Rea” - returned all the tracks form the album “Dancing with Strangers”

Tests with reversing the album and artist order also caused a no matches found.

From: Peter Pitkin [mailto:ppitkin@web.de] Sent: Friday, October 21, 2016 10:51 To: 'jishi/node-sonos-http-api'; 'jishi/node-sonos-http-api' Cc: 'Author' Subject: RE: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Guy’s first of all my thanks again for doing all this work and the fast turnaround on issues.

So here is a summary of my experiences with the latest build (downloaded this morning – European Time)…

1) Renamed my old api directory

2) Did a git clone to get latest release

3) Did npm install – production – everything went through OK with no issues

4) Copied my settings.json file across from my old install

5) Copied my preset file (test.json) into preset directory whilst at the same time removing the default one.

6) Copied my cached “Say” command files to the /static/tts directory

7) Added the ‘ use strict’ to Spotify.js

8) Started the server.js (npm start)

9) From a web browser on my windows machine issued a “say” command to the “patio” speaker to test it was working – This worked fine J

10) From a web browser on my windows machine issed a “/patio/musicsearch/library/load” command to load the music library – this ran through but after getting the Albums it hung the Pi for about 20 mins!!! After it came back it issued the “Killed” command again and stopped the API - L

11) It had created a 16 MB libray.json file in the /cache directory. (much smaller than before)

12) Tried to restart the API and it failed until I deleted the library.json file - L

13) Tried the same test again. Same result – but this time didn’t lock the Pi. Crashed (killed) immediately after creating the library.json file. (this time the file was 23.8 MB)

14) Tried to start the API again – again wouldn’t stay up unless I deleted the library.json file.

15) Tested again – but this time with a different player used on the load command “/kitchen/musicsearch/library/load” (both kitchen and patio are PLAY:1 devices)

16) Did get multiple “resubscribe” message due to a “socket hangup” part way through the scan but didn’t seem to affect anything.

17) Just as a side note the CPU load increases steadily as the scan progresses – not sure why it should do that

18) Died again! So the command that worked yesterday and managed to get a full load without crashing didn’t work this morning. (library.json file was 15.9 MB this time)

19) Used nvm to install node version 5.3 to see if it might be a problem using 6.9.1. Same issue.

20) Tried rebooting. Using node 6.9.1 again and the Living room speaker (Play:5) – This Time It WORKED!!!!!. Library.json file 55.4MB

21) So now try to play the album “Collected” by “10cc” – “/patio/musicsearch/library/album/10cc+Collected “ gives a “no matches were found” error.

22) Try with just the album “/patio/musicsearch/library/album/Collected “ loaded the songs from 10cc and Gerry Rafferty (as the both have an album called “Collected”.)

23) Tried “/patio/musicsearch/library/album/Scorpions+Gold “ this loaded the queue with the tracks from Chris Rea and the Scorpions (both have an album called gold).

So definitely not working correctly – at least on my system

Any suggestions for further tests?

Peter

From: jplourde5 [mailto:notifications@github.com] Sent: Friday, October 21, 2016 0:54 To: jishi/node-sonos-http-api Cc: Peter; Author Subject: Re: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Found and fixed three bugs, two in settings.js and one in spotify.js

Everything seems to work with the fixes in place

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/351#issuecomment-255250106 , or mute the thread https://github.com/notifications/unsubscribe-auth/AKyrHBZ2VzOi1JSKHa1zo9xMuNv07g8rks5q1_DrgaJpZM4KcZlg . https://github.com/notifications/beacon/AKyrHMtSRwLtfYU506e4a59-njN1Lpukks5q1_DrgaJpZM4KcZlg.gif

ppitkin commented 8 years ago

Guy’s first of all my thanks again for doing all this work and the fast turnaround on issues.

So here is a summary of my experiences with the latest build (downloaded this morning – European Time)…

1) Renamed my old api directory

2) Did a git clone to get latest release

3) Did npm install – production – everything went through OK with no issues

4) Copied my settings.json file across from my old install

5) Copied my preset file (test.json) into preset directory whilst at the same time removing the default one.

6) Copied my cached “Say” command files to the /static/tts directory

7) Added the ‘ use strict’ to Spotify.js

8) Started the server.js (npm start)

9) From a web browser on my windows machine issued a “say” command to the “patio” speaker to test it was working – This worked fine J

10) From a web browser on my windows machine issed a “/patio/musicsearch/library/load” command to load the music library – this ran through but after getting the Albums it hung the Pi for about 20 mins!!! After it came back it issued the “Killed” command again and stopped the API - L

11) It had created a 16 MB libray.json file in the /cache directory. (much smaller than before)

12) Tried to restart the API and it failed until I deleted the library.json file - L

13) Tried the same test again. Same result – but this time didn’t lock the Pi. Crashed (killed) immediately after creating the library.json file. (this time the file was 23.8 MB)

14) Tried to start the API again – again wouldn’t stay up unless I deleted the library.json file.

15) Tested again – but this time with a different player used on the load command “/kitchen/musicsearch/library/load” (both kitchen and patio are PLAY:1 devices)

16) Did get multiple “resubscribe” message due to a “socket hangup” part way through the scan but didn’t seem to affect anything.

17) Just as a side note the CPU load increases steadily as the scan progresses – not sure why it should do that

18) Died again! So the command that worked yesterday and managed to get a full load without crashing didn’t work this morning. (library.json file was 15.9 MB this time)

19) Used nvm to install node version 5.3 to see if it might be a problem using 6.9.1. Same issue.

20) Tried rebooting. Using node 6.9.1 again and the Living room speaker (Play:5) – This Time It WORKED!!!!!. Library.json file 55.4MB

21) So now try to play the album “Collected” by “10cc” – “/patio/musicsearch/library/album/10cc+Collected “ gives a “no matches were found” error.

22) Try with just the album “/patio/musicsearch/library/album/Collected “ loaded the songs from 10cc and Gerry Rafferty (as the both have an album called “Collected”.)

23) Tried “/patio/musicsearch/library/album/Scorpions+Gold “ this loaded the queue with the tracks from Chris Rea and the Scorpions (both have an album called gold).

So definitely not working correctly – at least on my system

Any suggestions for further tests?

Peter

From: jplourde5 [mailto:notifications@github.com] Sent: Friday, October 21, 2016 0:54 To: jishi/node-sonos-http-api Cc: Peter; Author Subject: Re: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Found and fixed three bugs, two in settings.js and one in spotify.js

Everything seems to work with the fixes in place

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/351#issuecomment-255250106 , or mute the thread https://github.com/notifications/unsubscribe-auth/AKyrHBZ2VzOi1JSKHa1zo9xMuNv07g8rks5q1_DrgaJpZM4KcZlg . https://github.com/notifications/beacon/AKyrHMtSRwLtfYU506e4a59-njN1Lpukks5q1_DrgaJpZM4KcZlg.gif

ppitkin commented 8 years ago

So I rebuilt my Sonos Library yesterday and now Sonos reports it doesn’t have enough space for it L

This appears to be a new error message as I’ve never seen this before.

I guess the Sonos Library is never going to work correctly for me given the size of my Library (ca 120,000 tracks.). This is disappointing, but I can understand that 99.99% of Sonos customers don’t come anywhere close to the current limits, so it’s unlikely that they will do anything to fix this limitation.

I suppose there is only 2 options that I can hope for:

1) We could get Jim’s fantastic library features to be able to use Plex

2) Wait until Sonos integrates with Amazon Music (I have my full library stored there)

Peter

From: Peter Pitkin [mailto:ppitkin@web.de] Sent: Friday, October 21, 2016 11:55 To: 'jishi/node-sonos-http-api'; 'jishi/node-sonos-http-api' Cc: 'Author' Subject: RE: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Sorry for the repeated updates but I have just spotted something strange with the Sonos system itself

When using the Windows Sonos controller – latest version – if you go to the Library and open up the list of albums it only shows a single album for each album name

i.e. on my system if you look for the Album “Gold” then you only see it listed once (in my case the Scorpions album) – The Chris Rea instance is not listed.

If however you go to the Artists list and open up Chris Rea you will see the album Gold, also for the Scorpions the album Gold is listed.

Looks like there may be a bug in the SONOS library system.

I don’t know if anyone else out there uses the new Plex integration offered by Sonos but this library lists both albums. Maybe a search on that source could be done sometime in the future.

From: Peter Pitkin [mailto:ppitkin@web.de] Sent: Friday, October 21, 2016 11:18 To: 'jishi/node-sonos-http-api'; 'jishi/node-sonos-http-api' Cc: 'Author' Subject: RE: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Sorry one further test…

“/patio/musicsearch/library/album/Chris Rea+Gold” - NOTE: no “+” sign between “Chris” and “Rea” (unlike the examples given in the help file on github. )

This returned all the tracks from the album “God’s great banana skin” by “Chris Rea”

“/patio/musicsearch/library/album/Chris+Rea+Gold” - gave no matches found

“/patio/musicsearch/library/album/Chris Rea Gold” - gave no matches found

“/patio/musicsearch/library/album/Chris Rea” - returned all the tracks form the album “Dancing with Strangers”

Tests with reversing the album and artist order also caused a no matches found.

From: Peter Pitkin [mailto:ppitkin@web.de] Sent: Friday, October 21, 2016 10:51 To: 'jishi/node-sonos-http-api'; 'jishi/node-sonos-http-api' Cc: 'Author' Subject: RE: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Guy’s first of all my thanks again for doing all this work and the fast turnaround on issues.

So here is a summary of my experiences with the latest build (downloaded this morning – European Time)…

1) Renamed my old api directory

2) Did a git clone to get latest release

3) Did npm install – production – everything went through OK with no issues

4) Copied my settings.json file across from my old install

5) Copied my preset file (test.json) into preset directory whilst at the same time removing the default one.

6) Copied my cached “Say” command files to the /static/tts directory

7) Added the ‘ use strict’ to Spotify.js

8) Started the server.js (npm start)

9) From a web browser on my windows machine issued a “say” command to the “patio” speaker to test it was working – This worked fine J

10) From a web browser on my windows machine issed a “/patio/musicsearch/library/load” command to load the music library – this ran through but after getting the Albums it hung the Pi for about 20 mins!!! After it came back it issued the “Killed” command again and stopped the API - L

11) It had created a 16 MB libray.json file in the /cache directory. (much smaller than before)

12) Tried to restart the API and it failed until I deleted the library.json file - L

13) Tried the same test again. Same result – but this time didn’t lock the Pi. Crashed (killed) immediately after creating the library.json file. (this time the file was 23.8 MB)

14) Tried to start the API again – again wouldn’t stay up unless I deleted the library.json file.

15) Tested again – but this time with a different player used on the load command “/kitchen/musicsearch/library/load” (both kitchen and patio are PLAY:1 devices)

16) Did get multiple “resubscribe” message due to a “socket hangup” part way through the scan but didn’t seem to affect anything.

17) Just as a side note the CPU load increases steadily as the scan progresses – not sure why it should do that

18) Died again! So the command that worked yesterday and managed to get a full load without crashing didn’t work this morning. (library.json file was 15.9 MB this time)

19) Used nvm to install node version 5.3 to see if it might be a problem using 6.9.1. Same issue.

20) Tried rebooting. Using node 6.9.1 again and the Living room speaker (Play:5) – This Time It WORKED!!!!!. Library.json file 55.4MB

21) So now try to play the album “Collected” by “10cc” – “/patio/musicsearch/library/album/10cc+Collected “ gives a “no matches were found” error.

22) Try with just the album “/patio/musicsearch/library/album/Collected “ loaded the songs from 10cc and Gerry Rafferty (as the both have an album called “Collected”.)

23) Tried “/patio/musicsearch/library/album/Scorpions+Gold “ this loaded the queue with the tracks from Chris Rea and the Scorpions (both have an album called gold).

So definitely not working correctly – at least on my system

Any suggestions for further tests?

Peter

From: jplourde5 [mailto:notifications@github.com] Sent: Friday, October 21, 2016 0:54 To: jishi/node-sonos-http-api Cc: Peter; Author Subject: Re: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Found and fixed three bugs, two in settings.js and one in spotify.js

Everything seems to work with the fixes in place

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/351#issuecomment-255250106 , or mute the thread https://github.com/notifications/unsubscribe-auth/AKyrHBZ2VzOi1JSKHa1zo9xMuNv07g8rks5q1_DrgaJpZM4KcZlg . https://github.com/notifications/beacon/AKyrHMtSRwLtfYU506e4a59-njN1Lpukks5q1_DrgaJpZM4KcZlg.gif

ppitkin commented 8 years ago

Sorry for the repeated updates but I have just spotted something strange with the Sonos system itself

When using the Windows Sonos controller – latest version – if you go to the Library and open up the list of albums it only shows a single album for each album name

i.e. on my system if you look for the Album “Gold” then you only see it listed once (in my case the Scorpions album) – The Chris Rea instance is not listed.

If however you go to the Artists list and open up Chris Rea you will see the album Gold, also for the Scorpions the album Gold is listed.

Looks like there may be a bug in the SONOS library system.

I don’t know if anyone else out there uses the new Plex integration offered by Sonos but this library lists both albums. Maybe a search on that source could be done sometime in the future.

From: Peter Pitkin [mailto:ppitkin@web.de] Sent: Friday, October 21, 2016 11:18 To: 'jishi/node-sonos-http-api'; 'jishi/node-sonos-http-api' Cc: 'Author' Subject: RE: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Sorry one further test…

“/patio/musicsearch/library/album/Chris Rea+Gold” - NOTE: no “+” sign between “Chris” and “Rea” (unlike the examples given in the help file on github. )

This returned all the tracks from the album “God’s great banana skin” by “Chris Rea”

“/patio/musicsearch/library/album/Chris+Rea+Gold” - gave no matches found

“/patio/musicsearch/library/album/Chris Rea Gold” - gave no matches found

“/patio/musicsearch/library/album/Chris Rea” - returned all the tracks form the album “Dancing with Strangers”

Tests with reversing the album and artist order also caused a no matches found.

From: Peter Pitkin [mailto:ppitkin@web.de] Sent: Friday, October 21, 2016 10:51 To: 'jishi/node-sonos-http-api'; 'jishi/node-sonos-http-api' Cc: 'Author' Subject: RE: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Guy’s first of all my thanks again for doing all this work and the fast turnaround on issues.

So here is a summary of my experiences with the latest build (downloaded this morning – European Time)…

1) Renamed my old api directory

2) Did a git clone to get latest release

3) Did npm install – production – everything went through OK with no issues

4) Copied my settings.json file across from my old install

5) Copied my preset file (test.json) into preset directory whilst at the same time removing the default one.

6) Copied my cached “Say” command files to the /static/tts directory

7) Added the ‘ use strict’ to Spotify.js

8) Started the server.js (npm start)

9) From a web browser on my windows machine issued a “say” command to the “patio” speaker to test it was working – This worked fine J

10) From a web browser on my windows machine issed a “/patio/musicsearch/library/load” command to load the music library – this ran through but after getting the Albums it hung the Pi for about 20 mins!!! After it came back it issued the “Killed” command again and stopped the API - L

11) It had created a 16 MB libray.json file in the /cache directory. (much smaller than before)

12) Tried to restart the API and it failed until I deleted the library.json file - L

13) Tried the same test again. Same result – but this time didn’t lock the Pi. Crashed (killed) immediately after creating the library.json file. (this time the file was 23.8 MB)

14) Tried to start the API again – again wouldn’t stay up unless I deleted the library.json file.

15) Tested again – but this time with a different player used on the load command “/kitchen/musicsearch/library/load” (both kitchen and patio are PLAY:1 devices)

16) Did get multiple “resubscribe” message due to a “socket hangup” part way through the scan but didn’t seem to affect anything.

17) Just as a side note the CPU load increases steadily as the scan progresses – not sure why it should do that

18) Died again! So the command that worked yesterday and managed to get a full load without crashing didn’t work this morning. (library.json file was 15.9 MB this time)

19) Used nvm to install node version 5.3 to see if it might be a problem using 6.9.1. Same issue.

20) Tried rebooting. Using node 6.9.1 again and the Living room speaker (Play:5) – This Time It WORKED!!!!!. Library.json file 55.4MB

21) So now try to play the album “Collected” by “10cc” – “/patio/musicsearch/library/album/10cc+Collected “ gives a “no matches were found” error.

22) Try with just the album “/patio/musicsearch/library/album/Collected “ loaded the songs from 10cc and Gerry Rafferty (as the both have an album called “Collected”.)

23) Tried “/patio/musicsearch/library/album/Scorpions+Gold “ this loaded the queue with the tracks from Chris Rea and the Scorpions (both have an album called gold).

So definitely not working correctly – at least on my system

Any suggestions for further tests?

Peter

From: jplourde5 [mailto:notifications@github.com] Sent: Friday, October 21, 2016 0:54 To: jishi/node-sonos-http-api Cc: Peter; Author Subject: Re: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Found and fixed three bugs, two in settings.js and one in spotify.js

Everything seems to work with the fixes in place

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/351#issuecomment-255250106 , or mute the thread https://github.com/notifications/unsubscribe-auth/AKyrHBZ2VzOi1JSKHa1zo9xMuNv07g8rks5q1_DrgaJpZM4KcZlg . https://github.com/notifications/beacon/AKyrHMtSRwLtfYU506e4a59-njN1Lpukks5q1_DrgaJpZM4KcZlg.gif

jplourde5 commented 8 years ago

120K is a LOT of tracks :) Earlier lockups could be due to memory starvation but it sounds like the later node version resolved that.

The current problems may be emanating from the Sonos library oddity. You might take a look at the JSON file that I'm generating to see what it is getting back from Sonos and storing. It will be interesting to see how the album "Gold" entries are stored and what the artist is for each.

As far as Amazon Prime Music is concerned, what we are missing is a search API that we can use for the search. I can add Prime support if one becomes available or is found. I've had no luck so far.

jishi commented 8 years ago

The structure didn't change, but I did make a new recursive merge function that probably didn't work correctly (doesn't initialize empty objects in target when recursing). I'll have to fix that tomorrow, need some sleep right now :(

jplourde5 commented 8 years ago

Jimmy,

That was in the unrelated spotify.js code wasn't it? Did you make a change to libraryDef.js or musicSearch.js also?

Or maybe you made a change to the browse function...

jishi commented 8 years ago

@jplourde5 not sure what this comment was targeted for...

ppitkin commented 8 years ago

Been playing around with the code a bit today to adapt it to read my music library directly (ie. Scan the files from the source directories and build the library.json file that way. Problem I have now come across is that the way sonos manages the “Albums” is problematic in that its handling it as a sort of playlist internally and I can’t create the same syntax for the URI and metadata entries L. This however highlighted a BIG deficiency in the Sonos handling of albums in that it is impossible for it to store multiple albums with the same name. Doing a bit of research I found that this is a known problem and comes about because Sonos appears to have built their complete library system to be track based. Guess we not going to get that solved in a hurry as if been out there as an issue for a number of years.

Anyway that got me looking at how it handles the same thing using the Plex library. In theory it looks like I could create the same sort of lookup library file with the Plex URI and Metadata entries (there are both album and track related formats generated) The problem is that the references are internal Plex references and don’t related to where the files are physically stored and so I will need to look into that a bit more.

I just been thinking a bit more whilst typing this and am wondering if we could probably take a slightly different approach…

What if we were to drop the “Albums” part of the library and use just the tracks section – but with some extended search fields?

i.e. we add the AlbumArtist field (maybe even adding a combined AlbumArtist+Album field) asatrributes to the tracks section and then use the search logic to return not an album entry but rather the list of individual tracks that make up the album – similar to if you were to search for just an artist. We would then just need to sort that by track order – which I assume Sonos should have stored somewhere and we could also add that to the library file.

Thoughts?

Peter

From: jplourde5 [mailto:notifications@github.com] Sent: Tuesday, October 25, 2016 20:58 To: jishi/node-sonos-http-api Cc: Peter; Author Subject: Re: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

120K is a LOT of tracks :) Earlier lockups could be due to memory starvation but it sounds like the later node version resolved that.

The current problems may be emanating from the Sonos library oddity. You might take a look at the JSON file that I'm generating to see what it is getting back from Sonos and storing. It will be interesting to see how the album "Gold" entries are stored and what the artist is for each.

As far as Amazon Prime Music is concerned, what we are missing is a search API that we can use for the search. I can add Prime support if one becomes available or is found. I've had no luck so far.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/351#issuecomment-256141181 , or mute the thread https://github.com/notifications/unsubscribe-auth/AKyrHLU85i_qCJe_PR7axNYq8KhHVb7qks5q3lFMgaJpZM4KcZlg . https://github.com/notifications/beacon/AKyrHL3RbnKKbYHF2V60_wamj-jRrHi4ks5q3lFMgaJpZM4KcZlg.gif

jplourde5 commented 8 years ago

:) That is what I had originally. The problem that I was having is that the tracks were not coming back in album order, so I recently modified it to use an album search instead.

I could build my own list of albums from the track search like you suggest, but I'm going to have the track order problem again.

If you look in the library.json file for the album Gold entries, what do you see with the Gold album name? What artists do you see by each entry?

Shifting gears... It looks like Plex can now be called from Sonos. Does it get added like another service or does it get connected through the Music Library? What can you search by if you start typing in the search box with Plex chosen?

jplourde5 commented 8 years ago

Further thoughts. I could easily create an option that would "build" the albums from the tracks if album order is not a problem.

I'm in the process of installing Plex but having some initial challenges importing my iTunes library. I have been able to add Plex to Sonos though. I probably won't have a chance to go at it again for a few days.

I'd still like to see how the Gold albums are being stored in the json file.

ppitkin commented 8 years ago

The gold albums are not being stored – or rather there is only 1 stored. The reason for this is that the SONOS library system is only able to store a single instance of an album name L - really bad design.

I’ve progresses a bit on the Plex investigation. We could to two things:

1) Build a library file in the same way as you have done for the Sonos library

2) Use the Plex search capability.

There are a few strange things in the URI string and Metatadata entry that need to be investigated – looks like some sort of check sum might be being added to the file name????

The big problem with plex is that there is no official API documentation provided by the development team – this is really disappointing as it is a fantastic product.

According to the forums they are currently developing an Alex interface to control it. It will also be very interesting to see what the Sonos Alexa interface supports when it is finally released.

From: jplourde5 [mailto:notifications@github.com] Sent: Friday, October 28, 2016 1:41 To: jishi/node-sonos-http-api Cc: Peter; Author Subject: Re: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

Further thoughts. I could easily create an option that would "build" the albums from the tracks if album order is not a problem.

I'm in the process of installing Plex but having some initial challenges importing my iTunes library. I have been able to add Plex to Sonos though. I probably won't have a chance to go at it again for a few days.

I'd still like to see how the Gold albums are being stored in the json file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/351#issuecomment-256800166 , or mute the thread https://github.com/notifications/unsubscribe-auth/AKyrHI0bGEOlFGaNxtru2TqaxHnFCH78ks5q4TZzgaJpZM4KcZlg . https://github.com/notifications/beacon/AKyrHPUC0J8bpeXFjS-NQRdt17hsm3RRks5q4TZzgaJpZM4KcZlg.gif

jplourde5 commented 8 years ago

Okay, so we will leave duplicate album names as a known problem that we can't fix for the Sonos Library.

Shifting to Plex... I was able to get the Plex service added to Sonos but I was having problems with getting Plex to work correctly on my Mac. But I was messing with it remotely while out of town and I'll take another look now that I'm home. I will see what the browse function returns once I get it working and try to go down the same path that I did with the Library. Sounds like that will be the only option if there is no external Plex search interface.

ppitkin commented 8 years ago

As I mentioned before there is a search capability on the plex api. You can run the search for both artists or albums.

Be aware that there are 2 different music library setups available in plex. One is the standard one and then there is an advanced one for plex passport holders - which you have probably already purchased if you are using the sonos plugin.

Pm me if you want to discuss in more detail.

Peter

Sent using the free WEB.DE iPad App

On 31/10/2016 at 17:26, jplourde5 wrote:

Okay, so we will leave duplicate album names as a known problem that we can't fix for the Sonos Library.

Shifting to Plex... I was able to get the Plex service added to Sonos but I was having problems with getting Plex to work correctly on my Mac. But I was messing with it remotely while out of town and I'll take another look now that I'm home. I will see what the browse function returns once I get it working and try to go down the same path that I did with the Library. Sounds like that will be the only option if there is no external Plex search interface.

You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/jishi/node-sonos-http-api/issues/351#issuecomment-257342669

jplourde5 commented 8 years ago

I found a simpler answer that I'm working on now. There is an original track number being returned by Sonos that is the album track number. I can go back to my original method of building an album from the tracks and use the track number to sort the tracks into the right album order. No need for a separate Plex interface as a result.

jplourde5 commented 8 years ago

I just submitted the fix for duplicate albums. No need for Plex in order to work around the Sonos limitation. Maintains album track order by capturing the track number and sorting by it for album searches.

ppitkin commented 8 years ago

That’s good. I can then replicate that for the version of your library.json file that I build using the share drive rather than the Sonos library (Sonos library has the 65000 track limit L ).

I have just spotted that Sonos now supports Amazon music. Its great as it gives access to my music library that I uploaded as well as all the stations and playlists that Amazon offer.

I was reading through the Sonos music API that all service providers need to support. The “Search” facility is one of the key things that must be supported and handled in a consistent manner. What I haven’t yet seen is how you can remotely trigger sonos to execute a search instruction on a specific provider. There must be a way to do it as all the user interfaces make use of this feature. Sonos knows about all the authorization information as well so if we could find the right method to call it should be really simple to search for stuff.

I looking at the moment if I can build a “man-in-the-middle” proxy to be able to decode the https into something readable so that we can look at the calls being made to sonos.amazonmusic.com. Nothings ever easy!

From: jplourde5 [mailto:notifications@github.com] Sent: Friday, November 04, 2016 1:19 To: jishi/node-sonos-http-api Cc: Peter; Author Subject: Re: [jishi/node-sonos-http-api] Add ability to play an album by a given artist from the library (#351)

I found a simpler answer that I'm working on now. There is an original track number being returned by Sonos that is the album track number. I can go back to my original method of building an album from the tracks and use the track number to sort the tracks into the right album order. No need for a separate Plex interface as a result. Working on it now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/351#issuecomment-258312687 , or mute the thread https://github.com/notifications/unsubscribe-auth/AKyrHLRu0AgW3KWRNbpqw32FWCC4hTu6ks5q6nnqgaJpZM4KcZlg . https://github.com/notifications/beacon/AKyrHOAnaRAR0BhFtMNC8R4HCazieZL_ks5q6nnqgaJpZM4KcZlg.gif

jplourde5 commented 8 years ago

That could greatly simplify things and make it easier to support man/all of the services if you can crack that code.

jishi commented 8 years ago

Just a clarification in regards to how Sonos searches all of it's music services. Each music service expose a "Sonos compliant" search interface, which standardizes the behavior for the controller.

It is the controller that is communicating with the services, and not the players. These services are also authenticated, which is the blocker here. The credentials are stored within the players after you have successfully added a service, and exchanged with the controllers upon startup. This happened in plain text previously, which was a bit odd and they eventually fixed that and is now sent encrypted.

Without the credentials (usually, an Oauth2 token or similar), we have no access to the search interfaces. It is possible to decrypt it, but I haven't had any luck in figuring this out yet. Also, when I do and publish it publically, Sonos might very well just switch encryption scheme and make that progress moot...

That is why we had to rely on public APIs for music service search, since many of these are unauthenticated. Another approach would be to implement the authentication scheme and save our own token, but that requires some work and pre-requisities from the user. With our own token, we could probably talk to the Sonos search apis directly.

There is one exception to this authentication problem, and that is services that still uses user/password authentication. They are possible to use without any problems with Sonos search interfaces, since they only require the session ID which can be fetched from the player using only username (which can be found). Unfortunately (or maybe fortunately) most services are switching over to a token based authentication schema.

jplourde5 commented 8 years ago

That is what I thought. I also see everything migrating to this approach. It appears to be the prevailing approach for cloud services. I think that the tricky part in trying to implement this standard approach is getting the partner Id for each service. The ones that I have attempted so far have an approval process for getting the ID, and if the ID is required for search, we are stuck.