soffes/sonos — pull request #26 by jasperla (2014-01-22 18:29:28+00:00)
Title: Add method to queue spotify tracks.

While it was already possible to add the spotify uri with #add_to_queue,
the metadata (artist, album, etc) would not be looked up by the Sonos device.
In order for this to be done we need to pass it a bit of DIDL metadata.

First let's add a spotify song in the "old" way, notice that the call to `queue` doesn't return any metadata:

````
irb(main):008:0> speaker.add_to_queue('x-sonos-spotify:spotify%3atrack%3a2CwulIyrmEYwbUWzcEVIhR?sid=9&flags=32')
D, [2014-01-22T19:28:09.673956 #17154] DEBUG -- : HTTPI POST request to 192.168.178.113 (httpclient)
=> 1
irb(main):009:0> speaker.queue
D, [2014-01-22T19:28:11.683893 #17154] DEBUG -- : HTTPI POST request to 192.168.178.113 (httpclient)
=> {:total=>1, :items=>[{:queue_id=>"Q:0/1", :title=>"x-sonos-spotify:spotify:track:2CwulIyrmEYwbUWzcEVIhR?sid=9&flags=32", :artist=>"", :album=>"", :album_art=>"http://192.168.178.113:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a2CwulIyrmEYwbUWzcEVIhR%3fsid%3d9%26flags%3d32", :duration=>nil, :id=>"x-sonos-spotify:spotify%3atrack%3a2CwulIyrmEYwbUWzcEVIhR?sid=9&flags=32"}]}
irb(main):010:0>
````

Now let's add the same track with the new method `add_spotify_to_queue`:

````
irb(main):005:0> speaker.add_spotify_to_queue('2CwulIyrmEYwbUWzcEVIhR')
D, [2014-01-22T19:26:54.857300 #17154] DEBUG -- : HTTPI POST request to 192.168.178.113 (httpclient)
=> 1
irb(main):006:0> speaker.queue
D, [2014-01-22T19:26:58.109215 #17154] DEBUG -- : HTTPI POST request to 192.168.178.113 (httpclient)
=> {:total=>1, :items=>[{:queue_id=>"Q:0/1", :title=>"Shotgun", :artist=>"Anton Zaslavski", :album=>"Shotgun", :album_art=>"http://192.168.178.113:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a2CwulIyrmEYwbUWzcEVIhR%3fsid%3d9%26flags%3d32", :duration=>"0:04:28", :id=>"x-sonos-spotify:spotify%3atrack%3a2CwulIyrmEYwbUWzcEVIhR?sid=9&flags=32"}]}
irb(main):007:0>
````