Open pini-gh opened 11 years ago
Hi again,
With this patch my snippet reports correctly the two Sonos devices on my network:
diff --git a/lib/upnp/control_point/device.rb b/lib/upnp/control_point/device.rb
index 0332867..d129ea5 100644
--- a/lib/upnp/control_point/device.rb
+++ b/lib/upnp/control_point/device.rb
@@ -254,7 +254,7 @@ module UPnP
end
def extract_spec_version
- "#{@description[:root][:specVersion][:major]}.#{@description[:root][:specVersion][:minor]}"
+ @description[:root] ? "#{@description[:root][:specVersion][:major]}.#{@description[:root][:specVersion][:minor]}" : nil
end
def start_service_extraction
@@ -341,7 +341,7 @@ module UPnP
device_list_hash = if @description.has_key? :root
log "<#{self.class}> Description has a :root key..."
- if @description[:root][:device].has_key? :deviceList
+ if @description[:root][:device][:deviceList]
@description[:root][:device][:deviceList][:device]
else
log "<#{self.class}> No child devices to extract."
diff --git a/lib/upnp/control_point/service.rb b/lib/upnp/control_point/service.rb
index 9ca3c9b..19494e9 100644
--- a/lib/upnp/control_point/service.rb
+++ b/lib/upnp/control_point/service.rb
@@ -236,7 +236,8 @@ module UPnP
end.size
=end
@action_list << action
- define_method_from_action(action[:name].to_sym, action[:argumentList][:argument])
+ args = action[:argumentList] ? action[:argumentList][:argument] : {}
+ define_method_from_action(action[:name].to_sym, args)
end
else
log "<#{self.class}> Got actionList that's not an Array or Hash."
Thanks,
_g.
Thanks a ton for logging this and finding a solution. I pushed out the changes (although the first change isn't verbatim)--would you mind pulling it down and verifying?
Steve Loveless a écrit , Le 27/12/2012 23:16:
Thanks a ton for logging this and finding a solution. I pushed out the changes (although the first change isn't verbatim)--would you mind pulling it down and verifying?
It works, thanks!
_g.
Hi,
I'm experimenting with this upnp module to interact with my Sonos devices [1].
[1] http://www.sonos.com/
Here is the first snippet I've tried:
Unfortunately it fails with the trace below:
Any help appreciated. Thanks in advance,
_g.