diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/LibraryManager.cs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index b692e97f3..2068ac0da 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -31,6 +31,8 @@ namespace MediaBrowser.Server.Implementations.Library /// </summary> public class LibraryManager : ILibraryManager { + private IEnumerable<ILibraryPrescanTask> PrescanTasks { get; set; } + /// <summary> /// Gets the intro providers. /// </summary> @@ -161,13 +163,15 @@ namespace MediaBrowser.Server.Implementations.Library IEnumerable<IVirtualFolderCreator> pluginFolders, IEnumerable<IItemResolver> resolvers, IEnumerable<IIntroProvider> introProviders, - IEnumerable<IBaseItemComparer> itemComparers) + IEnumerable<IBaseItemComparer> itemComparers, + IEnumerable<ILibraryPrescanTask> prescanTasks) { EntityResolutionIgnoreRules = rules; PluginFolderCreators = pluginFolders; EntityResolvers = resolvers.OrderBy(i => i.Priority).ToArray(); IntroProviders = introProviders; Comparers = itemComparers; + PrescanTasks = prescanTasks; } /// <summary> @@ -841,6 +845,19 @@ namespace MediaBrowser.Server.Implementations.Library await ValidateCollectionFolders(folder, cancellationToken).ConfigureAwait(false); } + // Run prescan tasks + foreach (var task in PrescanTasks) + { + try + { + await task.Run(new Progress<double>(), cancellationToken); + } + catch (Exception ex) + { + _logger.ErrorException("Error running prescan task", ex); + } + } + var innerProgress = new ActionableProgress<double>(); innerProgress.RegisterAction(pct => progress.Report(pct * .8)); |
