diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-05-02 01:49:16 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-05-02 01:49:16 -0400 |
| commit | f6ef72732178db79176d238206ca83150f6c80d4 (patch) | |
| tree | 9e0a32286a6a5ff014f1fa777bb17cebc4097abe /MediaBrowser.Server.Implementations/Library/LibraryManager.cs | |
| parent | 780d5b914cc22bdf88477761e60c5de64b20504d (diff) | |
| parent | cd02373e554df232d88063f41b8aee391f3e7667 (diff) | |
Merge branch 'dev'
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/LibraryManager.cs | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index ccba293a3..87fdc56b3 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -143,6 +143,7 @@ namespace MediaBrowser.Server.Implementations.Library private readonly Func<ILibraryMonitor> _libraryMonitorFactory; private readonly Func<IProviderManager> _providerManagerFactory; private readonly Func<IUserViewManager> _userviewManager; + public bool IsScanRunning { get; private set; } /// <summary> /// The _library items cache @@ -521,29 +522,7 @@ namespace MediaBrowser.Server.Implementations.Library throw new ArgumentNullException("items"); } - var dict = new Dictionary<Guid, BaseItem>(); - - foreach (var item in items) - { - var video = item as Video; - - if (video != null) - { - if (video.PrimaryVersionId.HasValue) - { - var primary = GetItemById(video.PrimaryVersionId.Value) as Video; - - if (primary != null) - { - dict[primary.Id] = primary; - continue; - } - } - } - dict[item.Id] = item; - } - - return dict.Values; + return items.DistinctBy(i => i.PresentationUniqueKey, StringComparer.OrdinalIgnoreCase); } /// <summary> @@ -800,11 +779,12 @@ namespace MediaBrowser.Server.Implementations.Library return _userRootFolder; } - public BaseItem FindByPath(string path) + public BaseItem FindByPath(string path, bool? isFolder) { var query = new InternalItemsQuery { - Path = path + Path = path, + IsFolder = isFolder }; // Only use the database result if there's exactly one item, otherwise we run the risk of returning old data that hasn't been cleaned yet. @@ -1102,6 +1082,7 @@ namespace MediaBrowser.Server.Implementations.Library /// <returns>Task.</returns> public async Task ValidateMediaLibraryInternal(IProgress<double> progress, CancellationToken cancellationToken) { + IsScanRunning = true; _libraryMonitorFactory().Stop(); try @@ -1111,6 +1092,7 @@ namespace MediaBrowser.Server.Implementations.Library finally { _libraryMonitorFactory().Start(); + IsScanRunning = false; } } |
