Permalink
Browse files

Fix album art

  • Loading branch information...
1 parent e6ece3e commit 38c9b527f84cafea10952d69271abcdf5c26ca79 @soffes soffes committed Dec 24, 2012
Showing with 14 additions and 3 deletions.
  1. +4 −0 Changelog.markdown
  2. +0 −1 Readme.markdown
  3. +8 −1 lib/sonos/endpoint/transport.rb
  4. +1 −1 lib/sonos/version.rb
  5. +1 −0 sonos.gemspec
View
@@ -1,3 +1,7 @@
+### Version 0.2.1 — December 24, 2012
+
+* Fix album art in now playing
+
### Version 0.2.0 — December 24, 2012
* Add Loudness setting
View
@@ -70,7 +70,6 @@ There is a very limited CLI right now. You can run `sonos discover` to get the I
* Nonblocking calls with Celluloid::IO
* List other speakers
* Handle errors better
-* Fix album art in `now_playing`
* Handle line-in in `now_playing`
* Better support for stero pairs
* CLI client for everything
@@ -1,3 +1,5 @@
+require 'uri'
+
module Sonos::Endpoint::Transport
TRANSPORT_ENDPOINT = '/MediaRenderer/AVTransport/Control'
TRANSPORT_XMLNS = 'urn:schemas-upnp-org:service:AVTransport:1'
@@ -9,6 +11,11 @@ def now_playing
body = response.body[:get_position_info_response]
doc = Nokogiri::XML(body[:track_meta_data])
+ art_path = doc.xpath('//upnp:albumArtURI').inner_text
+
+ # TODO: No idea why this is necessary. Maybe its a Nokogiri thing
+ art_path.sub!('/getaa?s=1=x-sonos-http', '/getaa?s=1&u=x-sonos-http')
+
{
title: doc.xpath('//dc:title').inner_text,
artist: doc.xpath('//dc:creator').inner_text,
@@ -17,7 +24,7 @@ def now_playing
track_duration: body[:track_duration],
current_position: body[:rel_time],
uri: body[:track_uri],
- album_art: "http://#{self.ip}:#{PORT}#{doc.xpath('//upnp:albumArtURI').inner_text}"
+ album_art: "http://#{self.ip}:#{Sonos::PORT}#{art_path}"
}
end
View
@@ -1,3 +1,3 @@
module Sonos
- VERSION = '0.2.0'
+ VERSION = '0.2.1'
end
View
@@ -18,5 +18,6 @@ Gem::Specification.new do |gem|
gem.require_paths = ['lib']
gem.add_dependency 'savon', '~> 2.0.2'
+ gem.add_dependency 'nokogiri'
gem.add_dependency 'thor'
end

0 comments on commit 38c9b52

Please sign in to comment.