From fe85655a6b3f962b464e164164ba05d9d1df7823 Mon Sep 17 00:00:00 2001 From: Henning Mosand Stephansen Date: Sat, 28 May 2016 15:20:29 +0200 Subject: [PATCH 1/3] Fixes DIDL metadata for Spotify --- lib/sonos/endpoint/a_v_transport.rb | 6 ++++-- lib/sonos/version.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/sonos/endpoint/a_v_transport.rb b/lib/sonos/endpoint/a_v_transport.rb index 5d25a1f..cb9ac8f 100644 --- a/lib/sonos/endpoint/a_v_transport.rb +++ b/lib/sonos/endpoint/a_v_transport.rb @@ -144,9 +144,11 @@ def add_spotify_to_queue(opts = {}, position = 0) # In order for the player to retrieve track duration, artist, album etc # we need to pass it some metadata ourselves. - didl_metadata = "<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="#{rand(10000000..99999999)}spotify%3a#{opts[:type]}%3a#{opts[:id]}" restricted="true"><dc:title></dc:title><upnp:class>object.item.audioItem.musicTrack</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON2311_X_#Svc2311-0-Token</desc></item></DIDL-Lite>" + didl_metadata = < Date: Sat, 28 May 2016 15:36:59 +0200 Subject: [PATCH 2/3] Fixes metadata did not correctly show up in Sonos --- lib/sonos/endpoint/a_v_transport.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sonos/endpoint/a_v_transport.rb b/lib/sonos/endpoint/a_v_transport.rb index cb9ac8f..ff9e3bb 100644 --- a/lib/sonos/endpoint/a_v_transport.rb +++ b/lib/sonos/endpoint/a_v_transport.rb @@ -145,7 +145,7 @@ def add_spotify_to_queue(opts = {}, position = 0) # In order for the player to retrieve track duration, artist, album etc # we need to pass it some metadata ourselves. didl_metadata = < Date: Sat, 28 May 2016 16:10:45 +0200 Subject: [PATCH 3/3] Changes the UPNP Class based on sonos type --- lib/sonos/endpoint/a_v_transport.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/sonos/endpoint/a_v_transport.rb b/lib/sonos/endpoint/a_v_transport.rb index ff9e3bb..bbc63f5 100644 --- a/lib/sonos/endpoint/a_v_transport.rb +++ b/lib/sonos/endpoint/a_v_transport.rb @@ -142,17 +142,13 @@ def add_spotify_to_queue(opts = {}, position = 0) return nil if opts[:type] == 'playlist' and opts[:user].nil? return nil if opts[:type] =~ /toplist_tracks/ and opts[:region].nil? - # In order for the player to retrieve track duration, artist, album etc - # we need to pass it some metadata ourselves. - didl_metadata = <0#{part}} + + puts message transport_client.call(name, soap_action: action, message: message) end end