[banshee: 3/57] Made UPnPClient add only real MediaServers as sources
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee: 3/57] Made UPnPClient add only real MediaServers as sources
- Date: Mon, 13 Feb 2012 20:28:04 +0000 (UTC)
commit ef700e55c87d7e639876930f4f84da4c5b9db6cb
Author: Tobias Arrskog <topfs2 xbmc org>
Date: Sun May 29 23:20:12 2011 +0200
Made UPnPClient add only real MediaServers as sources
.../Banshee.UPnPClient/UPnPService.cs | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs
index 7cdcd31..ac2e51e 100644
--- a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPService.cs
@@ -29,6 +29,9 @@
using System;
using Mono.Addins;
+using Mono.Ssdp;
+using Mono.Upnp;
+using Mono.Upnp.Dcp.MediaServer1.ContentDirectory1;
using Banshee.Base;
using Banshee.Sources.Gui;
@@ -41,15 +44,18 @@ namespace Banshee.UPnPClient
{
public class UPnPService : IExtensionService, IDisposable
{
+ private Mono.Upnp.Client client;
private UPnPContainerSource container;
void IExtensionService.Initialize ()
{
container = new UPnPContainerSource();
- container.AddChildSource (new UPnPSource("First test uPnP Client", "localhost-1"));
- container.AddChildSource (new UPnPSource("Second test uPnP Client", "localhost-2"));
-
ServiceManager.SourceManager.AddSource(container);
+
+ client = new Mono.Upnp.Client ();
+ client.DeviceAdded += DeviceAdded;
+
+ client.Browse(Mono.Upnp.Dcp.MediaServer1.MediaServer.DeviceType);
}
public void Dispose ()
@@ -63,6 +69,14 @@ namespace Banshee.UPnPClient
container = null;
}
}
+
+ void DeviceAdded (object sender, DeviceEventArgs e)
+ {
+ Hyena.Log.Debug ("UPnPService.DeviceAdded (" + e.Device.ToString() + ") (" + e.Device.Type + ")");
+ Device device = e.Device.GetDevice();
+
+ container.AddChildSource (new UPnPSource(device.FriendlyName, device.Udn));
+ }
string IService.ServiceName {
get { return "uPnP Client service"; }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]