diff options
Diffstat (limited to 'MediaBrowser.Controller')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/CollectionFolder.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Folder.cs | 27 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Game.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/LinkedChild.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/TV/Season.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Entities/Video.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ILibraryManager.cs | 2 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Library/ItemResolveArgs.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Controller/Providers/DirectoryService.cs | 6 |
11 files changed, 46 insertions, 24 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 04ddb2729..70512ef65 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -288,7 +288,7 @@ namespace MediaBrowser.Controller.Entities return Path; } - return System.IO.Path.GetDirectoryName(Path); + return FileSystem.GetDirectoryName(Path); } } @@ -1917,7 +1917,7 @@ namespace MediaBrowser.Controller.Entities { var allFiles = ImageInfos .Where(i => i.IsLocalFile) - .Select(i => System.IO.Path.GetDirectoryName(i.Path)) + .Select(i => FileSystem.GetDirectoryName(i.Path)) .Distinct(StringComparer.OrdinalIgnoreCase) .SelectMany(directoryService.GetFilePaths) .ToList(); @@ -2092,7 +2092,7 @@ namespace MediaBrowser.Controller.Entities var extensions = new[] { ".nfo", ".xml", ".srt" }.ToList(); extensions.AddRange(SupportedImageExtensionsList); - return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), extensions.ToArray(), false, false) + return FileSystem.GetFiles(FileSystem.GetDirectoryName(Path), extensions.ToArray(), false, false) .Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase)) .ToList(); } diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 62ea21a79..24474ba55 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -213,7 +213,7 @@ namespace MediaBrowser.Controller.Entities .SelectMany(c => c.LinkedChildren) .ToList(); - var changed = !linkedChildren.SequenceEqual(LinkedChildren, new LinkedChildComparer()); + var changed = !linkedChildren.SequenceEqual(LinkedChildren, new LinkedChildComparer(FileSystem)); LinkedChildren = linkedChildren; @@ -332,13 +332,13 @@ namespace MediaBrowser.Controller.Entities .OfType<Folder>() .ToList(); - return PhysicalLocations.Where(i => !string.Equals(i, Path, StringComparison.OrdinalIgnoreCase)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id); + return PhysicalLocations.Where(i => !FileSystem.AreEqual(i, Path)).SelectMany(i => GetPhysicalParents(i, rootChildren)).DistinctBy(i => i.Id); } private IEnumerable<Folder> GetPhysicalParents(string path, List<Folder> rootChildren) { var result = rootChildren - .Where(i => string.Equals(i.Path, path, StringComparison.OrdinalIgnoreCase)) + .Where(i => FileSystem.AreEqual(i.Path, path)) .ToList(); if (result.Count == 0) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 268fefbd3..edac27f99 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -640,7 +640,7 @@ namespace MediaBrowser.Controller.Entities return true; } - path = System.IO.Path.GetDirectoryName(path); + path = FileSystem.GetDirectoryName(path); } return allLibraryPaths.Any(i => ContainsPath(i, originalPath)); @@ -1206,11 +1206,17 @@ namespace MediaBrowser.Controller.Entities return GetLinkedChildren(); } - var locations = user.RootFolder - .Children + if (LinkedChildren.Count == 0) + { + return new List<BaseItem>(); + } + + var allUserRootChildren = user.RootFolder.Children.OfType<Folder>().ToList(); + + var collectionFolderIds = allUserRootChildren .OfType<CollectionFolder>() .Where(i => i.IsVisible(user)) - .SelectMany(i => i.PhysicalLocations) + .Select(i => i.Id) .ToList(); return LinkedChildren @@ -1228,9 +1234,16 @@ namespace MediaBrowser.Controller.Entities return null; } } - else if (childLocationType == LocationType.FileSystem && !locations.Any(l => FileSystem.ContainsSubPath(l, child.Path))) + else if (childLocationType == LocationType.FileSystem) { - return null; + var itemCollectionFolderIds = + LibraryManager.GetCollectionFolders(child, allUserRootChildren) + .Select(f => f.Id).ToList(); + + if (!itemCollectionFolderIds.Any(collectionFolderIds.Contains)) + { + return null; + } } } @@ -1323,7 +1336,7 @@ namespace MediaBrowser.Controller.Entities } else { newShortcutLinks = new List<LinkedChild>(); } - if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer())) + if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer(FileSystem))) { Logger.Info("Shortcut links have changed for {0}", Path); diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index d19552c07..baefc9dfa 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Entities return new[] { new FileSystemMetadata { - FullName = System.IO.Path.GetDirectoryName(Path), + FullName = FileSystem.GetDirectoryName(Path), IsDirectory = true } }; diff --git a/MediaBrowser.Controller/Entities/LinkedChild.cs b/MediaBrowser.Controller/Entities/LinkedChild.cs index 4d3c13c6e..6031a2448 100644 --- a/MediaBrowser.Controller/Entities/LinkedChild.cs +++ b/MediaBrowser.Controller/Entities/LinkedChild.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities @@ -40,11 +41,18 @@ namespace MediaBrowser.Controller.Entities public class LinkedChildComparer : IEqualityComparer<LinkedChild> { + private readonly IFileSystem _fileSystem; + + public LinkedChildComparer(IFileSystem fileSystem) + { + _fileSystem = fileSystem; + } + public bool Equals(LinkedChild x, LinkedChild y) { if (x.Type == y.Type) { - return string.Equals(x.Path, y.Path, StringComparison.OrdinalIgnoreCase); + return _fileSystem.AreEqual(x.Path, y.Path); } return false; } diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index be268782d..6c97a32a0 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -125,7 +125,7 @@ namespace MediaBrowser.Controller.Entities.TV return series.Path; } - return System.IO.Path.GetDirectoryName(Path); + return FileSystem.GetDirectoryName(Path); } } diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 98f325bdc..90aa3690a 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -311,7 +311,7 @@ namespace MediaBrowser.Controller.Entities { if (IsStacked) { - return System.IO.Path.GetDirectoryName(Path); + return FileSystem.GetDirectoryName(Path); } if (!IsPlaceHolder) diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index ebebe71a3..dd2379940 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -456,6 +456,8 @@ namespace MediaBrowser.Controller.Library /// <returns>IEnumerable<Folder>.</returns> List<Folder> GetCollectionFolders(BaseItem item); + List<Folder> GetCollectionFolders(BaseItem item, List<Folder> allUserRootChildren); + LibraryOptions GetLibraryOptions(BaseItem item); /// <summary> diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 763d27eba..3aa4d4ee2 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -114,7 +114,7 @@ namespace MediaBrowser.Controller.Library return false; } - var parentDir = System.IO.Path.GetDirectoryName(Path) ?? string.Empty; + var parentDir = BaseItem.FileSystem.GetDirectoryName(Path) ?? string.Empty; return parentDir.Length > _appPaths.RootFolderPath.Length && parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase); @@ -130,7 +130,7 @@ namespace MediaBrowser.Controller.Library { get { - return IsDirectory && string.Equals(Path, _appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase); + return IsDirectory && BaseItem.FileSystem.AreEqual(Path, _appPaths.RootFolderPath); } } @@ -300,7 +300,7 @@ namespace MediaBrowser.Controller.Library if (args != null) { if (args.Path == null && Path == null) return true; - return args.Path != null && args.Path.Equals(Path, StringComparison.OrdinalIgnoreCase); + return args.Path != null && BaseItem.FileSystem.AreEqual(args.Path, Path); } return false; } diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 78ed1dc59..bac9807a9 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -126,7 +126,6 @@ namespace MediaBrowser.Controller.MediaEncoding Task UpdateEncoderPath(string path, string pathType); bool SupportsEncoder(string encoder); - bool IsDefaultEncoderPath { get; } void SetLogFilename(string name); void ClearLogFilename(); diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 40093df3a..62db007b9 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -63,11 +63,11 @@ namespace MediaBrowser.Controller.Providers //_logger.Debug("Getting files for " + path); entries = new Dictionary<string, FileSystemMetadata>(StringComparer.OrdinalIgnoreCase); - + try { // using EnumerateFileSystemInfos doesn't handle reparse points (symlinks) - var list = _fileSystem.GetFileSystemEntries(path) + var list = _fileSystem.GetFileSystemEntries(path) .ToList(); // Seeing dupes on some users file system for some reason @@ -80,7 +80,7 @@ namespace MediaBrowser.Controller.Providers { } - //var group = entries.ToLookup(i => Path.GetDirectoryName(i.FullName)).ToList(); + //var group = entries.ToLookup(i => _fileSystem.GetDirectoryName(i.FullName)).ToList(); _cache.TryAdd(path, entries); } |
