diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-11-13 15:45:19 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-11-13 15:45:19 -0500 |
| commit | 3e5bb74fccf02d5d540cbe4b9132a012ae7530a3 (patch) | |
| tree | 5b40df9a4e2375b6d864b2c5a2932a8d18c22597 | |
| parent | ba3f23bad4b3956a3d42bb04d21dc3f24d0384c3 (diff) | |
update i/o methods
4 files changed, 15 insertions, 10 deletions
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index 14f8c1617..f843b10e4 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -94,9 +94,9 @@ namespace MediaBrowser.Controller.Entities // Example: if \\server\movies exists, then strip out \\server\movies\action if (isPhysicalRoot) { - var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Keys); + var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Values); - fileSystemDictionary = paths.Select(FileSystem.GetDirectoryInfo).ToDictionary(i => i.FullName); + fileSystemDictionary = paths.ToDictionary(i => i.FullName); } args.FileSystemDictionary = fileSystemDictionary; diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 946d95a0b..0da253186 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -129,9 +129,9 @@ namespace MediaBrowser.Controller.Entities // Example: if \\server\movies exists, then strip out \\server\movies\action if (isPhysicalRoot) { - var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Keys); + var paths = LibraryManager.NormalizeRootPathList(fileSystemDictionary.Values); - fileSystemDictionary = paths.Select(FileSystem.GetDirectoryInfo).ToDictionary(i => i.FullName); + fileSystemDictionary = paths.ToDictionary(i => i.FullName); } args.FileSystemDictionary = fileSystemDictionary; diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index c7ab88524..2af53efa9 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -298,7 +298,7 @@ namespace MediaBrowser.Controller.Library /// </summary> /// <param name="paths">The paths.</param> /// <returns>IEnumerable{System.String}.</returns> - IEnumerable<string> NormalizeRootPathList(IEnumerable<string> paths); + IEnumerable<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths); /// <summary> /// Registers the item. diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 92acd08d1..fd9463e83 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -599,9 +599,9 @@ namespace MediaBrowser.Server.Implementations.Library // Example: if \\server\movies exists, then strip out \\server\movies\action if (isPhysicalRoot) { - var paths = NormalizeRootPathList(fileSystemDictionary.Keys); + var paths = NormalizeRootPathList(fileSystemDictionary.Values); - fileSystemDictionary = paths.Select(_fileSystem.GetDirectoryInfo).ToDictionary(i => i.FullName); + fileSystemDictionary = paths.ToDictionary(i => i.FullName); } args.FileSystemDictionary = fileSystemDictionary; @@ -616,9 +616,12 @@ namespace MediaBrowser.Server.Implementations.Library return ResolveItem(args); } - public IEnumerable<string> NormalizeRootPathList(IEnumerable<string> paths) + public IEnumerable<FileSystemMetadata> NormalizeRootPathList(IEnumerable<FileSystemMetadata> paths) { - var list = paths.Select(_fileSystem.NormalizePath) + var originalList = paths.ToList(); + + var list = originalList.Where(i => i.IsDirectory) + .Select(i => _fileSystem.NormalizePath(i.FullName)) .Distinct(StringComparer.OrdinalIgnoreCase) .ToList(); @@ -630,7 +633,9 @@ namespace MediaBrowser.Server.Implementations.Library _logger.Info("Found duplicate path: {0}", dupe); } - return list.Except(dupes, StringComparer.OrdinalIgnoreCase); + var newList = list.Except(dupes, StringComparer.OrdinalIgnoreCase).Select(_fileSystem.GetDirectoryInfo).ToList(); + newList.AddRange(originalList.Where(i => !i.IsDirectory)); + return newList; } /// <summary> |
