diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-04 14:14:45 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-05-04 14:14:45 -0400 |
| commit | 696a6b34eaaee1fc906d27a968d392b7b7193c41 (patch) | |
| tree | 96b3cd854c519488bf91ed477dcb6d802a9473c9 /Emby.Server.Implementations/Library/LibraryManager.cs | |
| parent | 53024bd149c7f8e96adf86a9fb5e3cf00c883ba8 (diff) | |
improve smb support
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LibraryManager.cs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 684ad6284..685c794b7 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -1962,8 +1962,34 @@ namespace Emby.Server.Implementations.Library return new List<Folder>(); } - return GetUserRootFolder().Children - .OfType<Folder>() + return GetCollectionFoldersInternal(item, GetUserRootFolder().Children.OfType<Folder>().ToList()); + } + + public List<Folder> GetCollectionFolders(BaseItem item, List<Folder> allUserRootChildren) + { + while (item != null) + { + var parent = item.GetParent(); + + if (parent == null || parent is AggregateFolder) + { + break; + } + + item = parent; + } + + if (item == null) + { + return new List<Folder>(); + } + + return GetCollectionFoldersInternal(item, allUserRootChildren); + } + + private List<Folder> GetCollectionFoldersInternal(BaseItem item, List<Folder> allUserRootChildren) + { + return allUserRootChildren .Where(i => string.Equals(i.Path, item.Path, StringComparison.OrdinalIgnoreCase) || i.PhysicalLocations.Contains(item.Path, StringComparer.OrdinalIgnoreCase)) .ToList(); } |
