From 0d518ebf170eefc29fd164eabcbd8d4152177fee Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 20 Mar 2014 11:55:22 -0400 Subject: #712 - group multiple versions --- .../Entities/CollectionFolder.cs | 29 ++-------------------- MediaBrowser.Controller/Entities/Folder.cs | 29 ++++++++++++++-------- 2 files changed, 20 insertions(+), 38 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 6628ffc23..0ce88bee7 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -130,7 +130,6 @@ namespace MediaBrowser.Controller.Entities } private List _linkedChildren; - /// /// Our children are actually just references to the ones in the physical root... /// @@ -145,21 +144,9 @@ namespace MediaBrowser.Controller.Entities } private List GetLinkedChildrenInternal() { - Dictionary locationsDicionary; - - try - { - locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); - } - catch (IOException ex) - { - Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); - return new List(); - } - return LibraryManager.RootFolder.Children .OfType() - .Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path)) + .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) .SelectMany(c => c.LinkedChildren) .ToList(); } @@ -177,22 +164,10 @@ namespace MediaBrowser.Controller.Entities private IEnumerable GetActualChildren() { - Dictionary locationsDicionary; - - try - { - locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase); - } - catch (IOException ex) - { - Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path); - return new BaseItem[] { }; - } - return LibraryManager.RootFolder.Children .OfType() - .Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path)) + .Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase)) .SelectMany(c => c.Children) .ToList(); } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 45daaba0b..21b34c733 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -446,24 +446,31 @@ namespace MediaBrowser.Controller.Entities { BaseItem currentChild; - if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child)) + if (currentChildren.TryGetValue(child.Id, out currentChild)) { - var currentChildLocationType = currentChild.LocationType; - if (currentChildLocationType != LocationType.Remote && - currentChildLocationType != LocationType.Virtual) + if (IsValidFromResolver(currentChild, child)) { - currentChild.DateModified = child.DateModified; - } + var currentChildLocationType = currentChild.LocationType; + if (currentChildLocationType != LocationType.Remote && + currentChildLocationType != LocationType.Virtual) + { + currentChild.DateModified = child.DateModified; + } - currentChild.IsOffline = false; + currentChild.IsOffline = false; + validChildren.Add(currentChild); + } + else + { + validChildren.Add(child); + } } else { - //brand new item - needs to be added + // Brand new item - needs to be added newItems.Add(child); + validChildren.Add(child); } - - validChildren.Add(currentChild); } // If any items were added or removed.... @@ -736,7 +743,7 @@ namespace MediaBrowser.Controller.Entities /// BaseItem. private BaseItem RetrieveChild(Guid child) { - var item = LibraryManager.RetrieveItem(child); + var item = LibraryManager.GetItemById(child); if (item != null) { -- cgit v1.2.3