Closed jplourde5 closed 8 years ago
Repeating the answer here for future reference:
It's a correct assumption that the browse function doesn't work with music services. A few music services is possible to authenticate against using collectable data, but they are rare (Basically, the ones still using username/password authentication, IIRC). I have yet to figure out the encryption scheme for the account tokens (and I haven't spent much time on it).
I'm okay with adding fuse, seems to have 0 dependencies so it won't clutter the project that much. Are you able to search siriusXM without authenticating? What data are you actually fuzzy searching?
SiriusXM is working great. It did require some interesting work arounds, but in the end, the only special requirement is that there has to be at least one SiriusXm station setup as a Sonos Favorite. That is where I grab the credentials without having to know what they are and use them in the metadata.
Other interesting work around is that I manually loaded most of the stations in my favorites in groups of the maximum 20 (I think) favorites, sent all of their needed info to the console where I captured them, added them to a hard coded array in siriusXM.js, repeat for the next group, etc.. It was a pain but it only took maybe 30 to 60 minutes to sift through the stations. I didn’t include the play by play stations, but they could be added too. I also included two other loops for spitting out the station names and channel numbers to be used as slots for Alexa/echo-sonos. A bit of a kludge to go through, but it worked and it isn’t something that you normally have to go through. I did include the “utilities” in the siriusXM.js function so that they can be used to update the data if/when SiriusXM makes channel changes that someone wants to incorporate. I would have MUCH rather have found a way to pull a live channel list, but I could not find where someone had hacked that like has been done with Pandora. If you have any ideas, please share and I will take a look.
Pandora does have some “documented” API’s and people who have figured them out. Unlike with SiriusXM, every user will have different channel list and there are millions of possibilities, so the SiriusXM hack approach will not work here anyway. One of the things that will be required though is that the Pandora credentials will have to be stored somewhere. Is the settings.json file appropriate for that? Will adding new keys to that file hurt anything? Do you have to enter all of the standard keys also, or will the defaults still be used if only the Pandora keys are put in there?
I have Pandora working. You can play any of your Pandora stations and issue thumbs up or down.
Open questions:
User ID. Should I capture from:
a. Existing Pandora station in Favorites
b. Zoneplayer/accounts
i. Do we feel good that the RINCON/Types in accounts are consistent?
Pandora always = 3?
c. Retrieve it from a son file
Password has to be specified and stored somewhere
a. Should it just be stored in the clear in a json file? (along with the user ID & solve #1) b. Should it be specified through a Pandora/action and then encrypted and stored in a json file? c. Something else
I used https://github.com/dlom/anesidora for a node.js Pandora api.
Would you be okay with including it?
a. The above is moot if not
Leaning towards 2.a, including the user ID, and keeping it simple.
I'm not sure that you need to capture any account info at all. But if you do, I would suggest the status/accounts page.
I don't see Pandora since I'm in Sweden, there is a UPnP endpoint that would give you the service ID (the 3 you see is an incremental number, you probably added Pandora as your third service) called ListAvailableServices in the MusicServices service. Using a tool like "Device spy" from intel would reveal more info.
The relevant column is the "type" one, the ID in there is the same as in your SA_RINCON token reference, and the "sid" required for the URI is type >> 8
(bitshift 8 steps).
Is the UN column for Pandora a username, or a X_#Svc40967-0-Token kind of content? If it's a username, there might be a way around the credentials problem
The need for the credentials is primarily for the Pandora API search which requires the user ID and password. Once I have the user ID for that, I can also use it for the metadata without any funky Favorite capture, assuming that we cracked the code on the RINCON type. If we go the route of storing the Pandora credentials in a music-services.json file, I could also store the SiriusXM user ID there also, and only lean on a Favorite entry if the user ID is not specified. What do you think?
Well, my stance on configuration is that the less configuration, the better :) If we can infer the data needed from collectable data, we should do that. I will eventually build an account parser and store relevant info easily accessible, since it will be useful for other parts of the system as well.
Hopefully I will crack the encryption scheme that is used by Sonos to exchange credential data from the players eventually as well, then we can use the SMAPI endpoints for all music services, albeit they are usually slower.
Should I go with a Json file in the mean time?
Yeah, add it as a pandora object in the settings.json file. No need to introduce more files imo.
Makes sense. I'll go that route.
Any update on this? Really interested in testing thumbs up down support
I have this all working in my own build. I'll submit it later today.
Pandora is now available. See Readme.
LEGEND! How can I tell if the current song us thumbed up?
Pandora gives a song a +1 each time you give it a thumbs up and a -1 each time you give it a thumbs down. This results in a song having a positive or negative score of some number.
Given this, what would you like to see? Current score I would suppose? I could also return the current score any time a thumbs up or down is given.
I only need true false value but could be good for others.
I am making a GUI so just need the thumbs up to be highlighted if true.
@jplourde5 Any update on this, has it been added?
I thought about it, but how would you expect it to work? The current song is constantly changing and it sounds like you would want the Status action to check and indicate for every song whether it is thumbs up, down, or neutral. I don't think that is going to get added since it is Pandora specific.
Alright. I just wanted a field called Pandora state or even separate json called Pandora and I can link it to my script. It could also have artist bio and other interesting stuff.
With Apple Music behind me, I’m working on two additional capabilities that I want for Pandora and SiriusXM.
Question: Can your browse function be used to browse a user’s Pandora account or SiriusXM account? I think that the answer is no, but the Pandora API will take some time to build for Promises and I want to make sure that the browse can’t do it before I head down that path.
Another question. I actually have SXM working using brute force to build a hard coded array holding the needed channel information used in a siriusXM.js function that I built. I needed to incorporate the Fuse npm for a fuzzy search on the channel descriptions. Would you be opposed to adding the Fuse module to your solution? It will be useful for any other fuzzy searches that may be needed.