[banshee: 5/57] Give the source both the uPnP device and the contentDirectory (if found)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee: 5/57] Give the source both the uPnP device and the contentDirectory (if found)
- Date: Mon, 13 Feb 2012 20:28:14 +0000 (UTC)
commit 5c8746c860ce7d3c12123338d16f2e244391ec14
Author: Tobias Arrskog <topfs2 xbmc org>
Date: Mon Jun 6 13:36:16 2011 +0200
Give the source both the uPnP device and the contentDirectory (if found)
.../Banshee.UPnPClient/UPnPService.cs | 13 +++++++++++--
.../Banshee.UPnPClient/UPnPSource.cs | 12 +++++++-----
2 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs
index ac2e51e..27903f9 100644
--- a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs
@@ -29,7 +29,7 @@
using System;
using Mono.Addins;
-using Mono.Ssdp;
+
using Mono.Upnp;
using Mono.Upnp.Dcp.MediaServer1.ContentDirectory1;
@@ -74,8 +74,17 @@ namespace Banshee.UPnPClient
{
Hyena.Log.Debug ("UPnPService.DeviceAdded (" + e.Device.ToString() + ") (" + e.Device.Type + ")");
Device device = e.Device.GetDevice();
+
+ RemoteContentDirectory contentDirectory = null;
+
+ foreach (Service service in device.Services) {
+ Hyena.Log.Debug ("UPnPService " + device.FriendlyName + " Implements " + service.Type);
+ if (service.Type.Equals(Mono.Upnp.Dcp.MediaServer1.ContentDirectory1.ContentDirectory.ServiceType))
+ contentDirectory = new RemoteContentDirectory(new ContentDirectoryController(service.GetController()));
+ }
- container.AddChildSource (new UPnPSource(device.FriendlyName, device.Udn));
+ if (contentDirectory != null)
+ container.AddChildSource (new UPnPSource(device, contentDirectory));
}
string IService.ServiceName {
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPSource.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPSource.cs
index 63f3e00..c3fe8f5 100644
--- a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPSource.cs
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPSource.cs
@@ -31,6 +31,10 @@ using System;
using Mono.Unix;
using Mono.Addins;
+using Mono.Upnp;
+using Mono.Upnp.Dcp.MediaServer1.ContentDirectory1;
+using Mono.Upnp.Dcp.MediaServer1.ContentDirectory1.AV;
+
using Hyena.Collections;
using Banshee.Base;
@@ -47,13 +51,11 @@ namespace Banshee.UPnPClient
public class UPnPSource : PrimarySource
{
const int sort_order = 190;
- private string uuid;
- public UPnPSource (string name, string uuid) : base (Catalog.GetString ("Music Share"), name, uuid, sort_order)
+ public UPnPSource (Device device, RemoteContentDirectory contentDirectory) : base (Catalog.GetString ("Music Share"), device.FriendlyName, device.Udn, sort_order)
{
- Hyena.Log.Information ("UPnPSource.Added(\"" + this.Name + "\", \"" + uuid + "\")");
+ Hyena.Log.Information ("UPnPSource.Added(\"" + this.Name + "\", \"" + this.UniqueId + "\")");
- this.uuid = uuid;
Properties.SetStringList ("Icon.Name", "computer", "network-server");
// Remove tracks previously associated with this source, we do this to be sure they are non-existant before we refresh.
@@ -78,7 +80,7 @@ namespace Banshee.UPnPClient
public void Disconnect()
{
- Hyena.Log.Information ("UPnPSource.Disconnect(\"" + this.Name + "\", \"" + uuid + "\")");
+ Hyena.Log.Information ("UPnPSource.Disconnect(\"" + this.Name + "\", \"" + this.UniqueId + "\")");
// Stop currently playing track if its from us.
try {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]