diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-08-07 17:17:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-07 17:17:05 -0400 |
| commit | 2026a682ed363338ec6a27f099b0788f33be46f8 (patch) | |
| tree | 4113625119679c2264edf13d266150a7041cfc8e /MediaBrowser.Controller | |
| parent | daf2d41c9d1ac4c6f6baf10b2ed850aa4f5b9b30 (diff) | |
| parent | a86336ebc6913489f7e30b8fdf02947397b01bcb (diff) | |
Merge pull request #2037 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Controller')
10 files changed, 25 insertions, 19 deletions
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index 588a65e98d..7b42310101 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -76,7 +76,7 @@ namespace MediaBrowser.Controller.Entities { var locations = PhysicalLocations.ToList(); - var newLocations = CreateResolveArgs(new DirectoryService(BaseItem.FileSystem), false).PhysicalLocations.ToList(); + var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList(); if (!locations.SequenceEqual(newLocations)) { diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index c7a6b75ff2..8d00f38beb 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1003,7 +1003,7 @@ namespace MediaBrowser.Controller.Entities public Task RefreshMetadata(CancellationToken cancellationToken) { - return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(FileSystem)), cancellationToken); + return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem)), cancellationToken); } /// <summary> diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 35dfd52e9d..8bf9919f25 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -82,7 +82,7 @@ namespace MediaBrowser.Controller.Entities { var locations = PhysicalLocations.ToList(); - var newLocations = CreateResolveArgs(new DirectoryService(BaseItem.FileSystem), false).PhysicalLocations.ToList(); + var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList(); if (!locations.SequenceEqual(newLocations)) { diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 6a7e279be8..bb3d4f73df 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -278,7 +278,7 @@ namespace MediaBrowser.Controller.Entities public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken) { - return ValidateChildren(progress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(FileSystem))); + return ValidateChildren(progress, cancellationToken, new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem))); } /// <summary> diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index 5c68308f5c..46da469fa5 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -213,7 +213,7 @@ namespace MediaBrowser.Controller.Entities Name = newName; - return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(FileSystem)) + return RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(Logger, FileSystem)) { ReplaceAllMetadata = true, ImageRefreshMode = ImageRefreshMode.FullRefresh, diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 70bd3f081c..ff7f2fe678 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -562,5 +562,6 @@ namespace MediaBrowser.Controller.Library QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query); QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query); QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query); + QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query); } }
\ No newline at end of file diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 05e82a16e7..1fef8bead7 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -133,5 +133,6 @@ namespace MediaBrowser.Controller.MediaEncoding Task Init(); Task UpdateEncoderPath(string path, string pathType); + bool SupportsEncoder(string encoder); } } diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 78138999c5..437f0e157a 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -169,6 +169,7 @@ namespace MediaBrowser.Controller.Persistence QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query); QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query); QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query); + QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query); } } diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index e7e3323c2b..ee2b28c60a 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -16,13 +16,16 @@ namespace MediaBrowser.Controller.Providers private readonly ConcurrentDictionary<string, Dictionary<string, FileSystemMetadata>> _cache = new ConcurrentDictionary<string, Dictionary<string, FileSystemMetadata>>(StringComparer.OrdinalIgnoreCase); - public DirectoryService(ILogger logger, IFileSystem fileSystem) + private readonly ConcurrentDictionary<string, FileSystemMetadata> _fileCache = + new ConcurrentDictionary<string, FileSystemMetadata>(StringComparer.OrdinalIgnoreCase); + + public DirectoryService(ILogger logger, IFileSystem fileSystem) { _logger = logger; _fileSystem = fileSystem; } - public DirectoryService(IFileSystem fileSystem) + public DirectoryService(IFileSystem fileSystem) : this(new NullLogger(), fileSystem) { } @@ -100,20 +103,19 @@ namespace MediaBrowser.Controller.Providers public FileSystemMetadata GetFile(string path) { - var directory = Path.GetDirectoryName(path); - - if (string.IsNullOrWhiteSpace(directory)) + FileSystemMetadata file; + if (!_fileCache.TryGetValue(path, out file)) { - _logger.Debug("Parent path is null for {0}", path); - return null; - } - - var dict = GetFileSystemDictionary(directory, false); + file = _fileSystem.GetFileInfo(path); - FileSystemMetadata entry; - dict.TryGetValue(path, out entry); + if (file != null) + { + _fileCache.TryAdd(path, file); + } + } - return entry; + return file; + //return _fileSystem.GetFileInfo(path); } public IEnumerable<FileSystemMetadata> GetDirectories(string path) diff --git a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs index 9427b2afd7..87c3b36a27 100644 --- a/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs +++ b/MediaBrowser.Controller/Providers/MetadataRefreshOptions.cs @@ -1,5 +1,6 @@ using System.Linq; using CommonIO; +using MediaBrowser.Model.Logging; using MediaBrowser.Model.Providers; namespace MediaBrowser.Controller.Providers @@ -19,7 +20,7 @@ namespace MediaBrowser.Controller.Providers public bool ForceSave { get; set; } public MetadataRefreshOptions(IFileSystem fileSystem) - : this(new DirectoryService(fileSystem)) + : this(new DirectoryService(new NullLogger(), fileSystem)) { } |
