[banshee: 33/57] Moved the logic of chunking 500 items and introducing to GUI to recursive browse as search never nee



commit 9cbf52b3ffeead835b78f3a316d6e6b8e7070e10
Author: Tobias Arrskog <topfs2 xbmc org>
Date:   Thu Jul 14 19:32:14 2011 +0200

    Moved the logic of chunking 500 items and introducing to GUI to recursive browse as search never needed it

 .../Banshee.UPnPClient/UPnPServerSource.cs         |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPServerSource.cs b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPServerSource.cs
index d99bf72..7dd3bf1 100644
--- a/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPServerSource.cs
+++ b/src/Extensions/Banshee.UPnPClient/Banshee.UPnPClient/UPnPServerSource.cs
@@ -99,7 +99,6 @@ namespace Banshee.UPnPClient
         void Parse (ContentDirectoryController contentDirectory)
         {
             RemoteContentDirectory remoteContentDirectory = new RemoteContentDirectory (contentDirectory);
-            List<MusicTrack> musicTracks = new List<MusicTrack>();
             DateTime begin = DateTime.Now;
             Container root = remoteContentDirectory.GetRootObject();
             bool recursiveBrowse = !contentDirectory.CanSearch;
@@ -111,6 +110,7 @@ namespace Banshee.UPnPClient
                     HandleResults<MusicTrack> (remoteContentDirectory.Search<MusicTrack>(root, visitor => visitor.VisitDerivedFrom("upnp:class", "object.item.audioItem.musicTrack"), new ResultsSettings()),
                                                remoteContentDirectory,
                                                chunk => {
+                                                            List<MusicTrack> musicTracks = new List<MusicTrack>();
                                                             foreach (var item in chunk)
                                                                 musicTracks.Add(item as MusicTrack);
 
@@ -124,15 +124,15 @@ namespace Banshee.UPnPClient
             if (recursiveBrowse) {
                 try {
                     Hyena.Log.Debug ("Not searchable, lets recursive browse");
+                    List<MusicTrack> musicTracks = new List<MusicTrack>();
                     ParseContainer (remoteContentDirectory, root, 0, musicTracks);
+                    if (musicTracks.Count > 0)
+                        music_source.AddTracks (musicTracks);
                 } catch (Exception exception) {
                     Hyena.Log.Exception (exception);
                 }
             }
 
-            if (musicTracks.Count > 0)
-                music_source.AddTracks (musicTracks);
-
             Hyena.Log.Debug ("Found all items on the service, took " + (DateTime.Now - begin).ToString());
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]