[banshee: 35/57] Added code to only use suitable resource (only consider http based ones for now)
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee: 35/57] Added code to only use suitable resource (only consider http based ones for now)
- Date: Mon, 13 Feb 2012 20:30:46 +0000 (UTC)
commit b969dc16d8554372aaacd3bd61a58db9d2001f84
Author: Tobias Arrskog <topfs2 xbmc org>
Date: Thu Jul 14 21:08:53 2011 +0200
Added code to only use suitable resource (only consider http based ones for now)
.../Banshee.UPnPClient/UPnPTrackInfo.cs | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPTrackInfo.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPTrackInfo.cs
index c71510f..0c09ef8 100644
--- a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPTrackInfo.cs
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPTrackInfo.cs
@@ -27,6 +27,8 @@
//
using System;
+using System.Collections.Generic;
+
using Mono.Unix;
using Mono.Upnp.Dcp.MediaServer1.ContentDirectory1;
using Mono.Upnp.Dcp.MediaServer1.ContentDirectory1.AV;
@@ -62,10 +64,10 @@ namespace Banshee.UPnPClient
TrackTitle = track.Title;
- if (track.Resources.Count > 0)
- {
- Resource resource = track.Resources[0];
+ Resource resource = FindSuitableResource(track.Resources);
+ if (resource != null)
+ {
BitRate = (int)resource.BitRate.GetValueOrDefault();
BitsPerSample = (int)resource.BitsPerSample.GetValueOrDefault();
Duration = resource.Duration.GetValueOrDefault();
@@ -81,5 +83,15 @@ namespace Banshee.UPnPClient
PrimarySource = source;
}
+
+ private Resource FindSuitableResource (IList<Resource> resources)
+ {
+ foreach (Resource resource in resources) {
+ if (resource.Uri != null && resource.Uri.Scheme == System.Uri.UriSchemeHttp)
+ return resource;
+ }
+
+ return null;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]