From 8ed35a00aa965da2803fa8cb08578f9e849c1aa7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 24 May 2013 23:22:45 -0400 Subject: [PATCH] for for web socket sending the root folder --- .../Entities/CollectionFolder.cs | 2 +- .../EntryPoints/LibraryChangedNotifier.cs | 21 +++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 723ab47562..4574ca3e96 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Entities { // Accessing ResolveArgs could involve file system access folderIds = ResolveArgs.PhysicalLocations - .Select(f => (f.GetMBId(typeof(Folder)))) + .Select(f => f.GetMBId(typeof(Folder))) .ToDictionary(i => i); } catch (IOException ex) diff --git a/MediaBrowser.ServerApplication/EntryPoints/LibraryChangedNotifier.cs b/MediaBrowser.ServerApplication/EntryPoints/LibraryChangedNotifier.cs index 104b09fda1..a59b152574 100644 --- a/MediaBrowser.ServerApplication/EntryPoints/LibraryChangedNotifier.cs +++ b/MediaBrowser.ServerApplication/EntryPoints/LibraryChangedNotifier.cs @@ -249,7 +249,7 @@ namespace MediaBrowser.ServerApplication.EntryPoints /// The collections. /// All recursive children. /// IEnumerable{``0}. - private IEnumerable TranslatePhysicalItemToUserLibrary(T item, User user, List collections, Dictionary allRecursiveChildren) + private IEnumerable TranslatePhysicalItemToUserLibrary(T item, User user, IEnumerable collections, Dictionary allRecursiveChildren) where T : BaseItem { // If the physical root changed, return the user root @@ -261,7 +261,24 @@ namespace MediaBrowser.ServerApplication.EntryPoints // Need to find what user collection folder this belongs to if (item.Parent is AggregateFolder) { - return new T[] { user.RootFolder as T }; + if (item.LocationType == LocationType.FileSystem) + { + return collections.Where(i => + { + + try + { + return i.LocationType == LocationType.FileSystem && + i.ResolveArgs.PhysicalLocations.Contains(item.Path); + } + catch (Exception ex) + { + _logger.ErrorException("Error getting ResolveArgs for {0}", ex, i.Path); + return false; + } + + }).Cast(); + } } // If it's a user root, return it only if it's the right one