diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-24 13:48:48 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-05-24 13:48:48 -0400 |
| commit | 7a5ba39603c2a0c970c619016686431b7ff14df1 (patch) | |
| tree | d80da83a6f8b0bfd5d59cb204a933ab90c36f219 /MediaBrowser.Controller | |
| parent | 398b658dbe72c6efa932b9d097916ea586b8eb9f (diff) | |
fixes #305 - Multiple collections
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/CollectionFolder.cs | 13 |
2 files changed, 19 insertions, 6 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index ac8688f77e..8982801106 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -384,6 +384,18 @@ namespace MediaBrowser.Controller.Entities var flattenFolderDepth = isPhysicalRoot ? 2 : 0; args.FileSystemDictionary = FileData.GetFilteredFileSystemEntries(args.Path, Logger, flattenFolderDepth: flattenFolderDepth, args: args, resolveShortcuts: isPhysicalRoot || args.IsVf); + + // Need to remove subpaths that may have been resolved from shortcuts + // Example: if \\server\movies exists, then strip out \\server\movies\action + if (isPhysicalRoot) + { + var paths = args.FileSystemDictionary.Keys.ToList(); + + foreach (var subPath in paths.Where(subPath => paths.Any(i => subPath.StartsWith(i.TrimEnd(System.IO.Path.DirectorySeparatorChar) + System.IO.Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase)))) + { + args.FileSystemDictionary.Remove(subPath); + } + } } //update our dates diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 64e5da92e7..723ab47562 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.Extensions; -using MediaBrowser.Model.Entities; using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -74,23 +73,25 @@ namespace MediaBrowser.Controller.Entities { get { - IEnumerable<Guid> folderIds; + Dictionary<Guid,Guid> folderIds; try { // Accessing ResolveArgs could involve file system access - folderIds = ResolveArgs.PhysicalLocations.Select(f => (f.GetMBId(typeof(Folder)))); + folderIds = ResolveArgs.PhysicalLocations + .Select(f => (f.GetMBId(typeof(Folder)))) + .ToDictionary(i => i); } catch (IOException ex) { Logger.ErrorException("Error creating FolderIds for {0}", ex, Path); - folderIds = new Guid[] {}; + folderIds = new Dictionary<Guid, Guid>(); } var ourChildren = - LibraryManager.RootFolder.Children.OfType<Folder>() - .Where(i => folderIds.Contains(i.Id)) + LibraryManager.RootFolder.RecursiveChildren.OfType<Folder>() + .Where(i => folderIds.ContainsKey(i.Id)) .SelectMany(c => c.Children); return new ConcurrentDictionary<Guid,BaseItem>(ourChildren.ToDictionary(i => i.Id)); |
