-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spotify account selection if multiple exists #350
Comments
@Takkuz are you familiar with Wireshark. It would be handy if you could load up the Sonos app, queue two songs from different accounts while recording the network traffic. Then we can try to identify how the Sonos app is differentiating when loading from each account. Although I'd of thought if the accounts are in the same region then both should be able to play the music anyway. Just brain dumping but some more information would be required to continue. |
@Takkuz We have no way of verifying this. Closing this issue for now, please re-open if you got some wireshark output for us to analyze. |
If it helps I recorded the
from three different Spotify accounts in Sonos and got these envelopes:
I recognized differences at three positions:
Can it be the sn or the token which differs from one account to another? |
It's the token, I'm pretty sure. Problem is that there is no way to ask the
Sonos for those tokens, as that happens via an encrypted endpoint, which
nobody but Sonos have the key for. There was an xml page for that but they
removed it a while back.
…On Mon, 10 Aug 2020, 05:06 herennium, ***@***.***> wrote:
If it helps I recorded the
SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#AddURIToQueue"
from three different Spotify accounts in Sonos and got these envelopes:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:AddURIToQueue xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><EnqueuedURI>x-sonos-spotify:spotify%3atrack%3a4AmIsuwgVauWiF9FfS1Adu?sid=9&flags=8224&sn=7</EnqueuedURI><EnqueuedURIMetaData><DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="10032020spotify%3atrack%3a4AmIsuwgVauWiF9FfS1Adu" parentID="00020000track:Johnny Walker" restricted="true"><dc:title>Johnny Walker - Remastered</dc:title><upnp:class>object.item.audioItem.musicTrack</upnp:class><upnp:album>Keine Zeit</upnp:album><dc:creator>Westernhagen</dc:creator><upnp:albumArtURI>https://i.scdn.co/image/ab67616d0000b2731f3e034841811c4da0223c9a</upnp:albumArtURI><r:albumArtist>Westernhagen</r:albumArtist><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON2311_X_#Svc2311-23e9faa4-Token</desc></item></DIDL-Lite></EnqueuedURIMetaData><DesiredFirstTrackNumberEnqueued>4</DesiredFirstTrackNumberEnqueued><EnqueueAsNext>1</EnqueueAsNext></u:AddURIToQueue></s:Body></s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:AddURIToQueue xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><EnqueuedURI>x-sonos-spotify:spotify%3atrack%3a4AmIsuwgVauWiF9FfS1Adu?sid=9&flags=8224&sn=5</EnqueuedURI><EnqueuedURIMetaData><DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="10032020spotify%3atrack%3a4AmIsuwgVauWiF9FfS1Adu" parentID="00020000track:Johnny Walker" restricted="true"><dc:title>Johnny Walker - Remastered</dc:title><upnp:class>object.item.audioItem.musicTrack</upnp:class><upnp:album>Keine Zeit</upnp:album><dc:creator>Westernhagen</dc:creator><upnp:albumArtURI>https://i.scdn.co/image/ab67616d0000b2731f3e034841811c4da0223c9a</upnp:albumArtURI><r:albumArtist>Westernhagen</r:albumArtist><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON2311_X_#Svc2311-5a12c29c-Token</desc></item></DIDL-Lite></EnqueuedURIMetaData><DesiredFirstTrackNumberEnqueued>3</DesiredFirstTrackNumberEnqueued><EnqueueAsNext>1</EnqueueAsNext></u:AddURIToQueue></s:Body></s:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:AddURIToQueue xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><EnqueuedURI>x-sonos-spotify:spotify%3atrack%3a4AmIsuwgVauWiF9FfS1Adu?sid=9&flags=8224&sn=8</EnqueuedURI><EnqueuedURIMetaData><DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="10032020spotify%3atrack%3a4AmIsuwgVauWiF9FfS1Adu" parentID="00020000track:Johnny Walker" restricted="true"><dc:title>Johnny Walker - Remastered</dc:title><upnp:class>object.item.audioItem.musicTrack</upnp:class><upnp:album>Keine Zeit</upnp:album><dc:creator>Westernhagen</dc:creator><upnp:albumArtURI>https://i.scdn.co/image/ab67616d0000b2731f3e034841811c4da0223c9a</upnp:albumArtURI><r:albumArtist>Westernhagen</r:albumArtist><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON2311_X_#Svc2311-65273c18-Token</desc></item></DIDL-Lite></EnqueuedURIMetaData><DesiredFirstTrackNumberEnqueued>2</DesiredFirstTrackNumberEnqueued><EnqueueAsNext>1</EnqueueAsNext></u:AddURIToQueue></s:Body></s:Envelope>
I recognized differences at three positions:
1. In EnqueuedURI the value sn=
2. The numbers in SA_RINCON2311_X_#Svc2311-23e9faa4-Token
3. The field DesiredFirstTrackNumberEnqueued - this is my fault, just
added to queue...
Can it be the sn or the token which differs from one account to another?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#350 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACCK7EBODOK3VGOBNOBZ3LR733DXANCNFSM4F7V7MAQ>
.
|
Snipped the network traffic again to check if the tokens vary two days later - they don't. Also I don't know how to check in Sonos controller (Windows) or sonos.getQueue (node-sonos) what Spotify account is used on which room for playing audio. Maybe I don't understand the system. Maybe it doesn't matter which account they queued and the information isn't stored. |
I would assume that for queuing single tracks on the Sonos itself it doesn't actually matter all that much. However, the devices will use an API call and auth mechanism to retrieve the file and meta information from the 3rd party service, which might do some statistics like play count etc. Where on the Sonos side it would make a noticeable difference is for personalised radio streams or playlists that would carry the same ID, think something like "radio:favourites:mine", and the service decides the upcoming tracks by user. |
I personally don't see why you would link several accounts to your system. A year ago they stopped others accessing which services are connected, this also stops other (like this library) from accessing Spotify service to search for songs for instance. Recently I've been messing with this and I maybe found a way to mimic the old behavior. Still a work-in-progress, but currently logging in works, as is saving the account details and querying Spotify through the Sonos music api. This (and documentation) will be released if I find the time to finish it (or if I have 25 sponsors GitHub) What I found out is that most data we send to the Sonos speaker as metadata doesn't matter. If your start a Spotify song from artist a, but send artist b in the metadata, the Sonos speaker will do a new request for the metadata to the Sonos music service. Same also counts for radio streams from all services. Spotify will also stop other devices (phones/laptops) playing music on the same account if you start playing on your Sonos speaker. That would be the only reason I can think of to connect two accounts. |
Why I have different spotify accounts linked to Sonos: I build my little children a box (raspi, ir receiver, 7 segment display) where they can start spotify tracks/albums via entering numbers in a small ir remote. At the backend the raspi starts the tracks via node-sonos on the corresponding sonos device in their rooms. I now managed to seperate the rooms by monitoring the different account tokens with wireshark and editing the helpers.js in node-sonos. E.g.: Now node-sonos starts all spotify calls to sonos with the designated spotify account and even the Alexa enabled devices in living room don't interfere with the children's rooms. |
We don’t use Alexa, but we never had problems when playing two different playlists in two different rooms. Can I summarize that you actually want an easy way to set the spotify token? |
For me an "easy way" is not necessary. Nevertheless when using just one Spotify Account the playback often stopped when another machine (Amazon Echo, Alexa on Sonos, Spotify on Windows, Spotify on smartphone) starts another playback. Therefore I needed more than one account. |
So what would be an "easy" way? A getter and setter for the spotify token on a sonos instance? |
I recently came across this stackoverflow post it shows the The easiest fix is probably a static get/set on the helper because that is wat generates the metadata for track uris |
I've multiple Spotify account registered and when calling
.play(URISong)
it responds with uPNPError 711. After launching a song using official app everything starts working as expected.I didn't find any way to select Spotify account.
The text was updated successfully, but these errors were encountered: