From 374b7f2f039211d5a8fb80348b72070841f393ec Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 22 Apr 2013 00:38:03 -0400 Subject: new Artist entity --- .../Library/LibraryManager.cs | 108 +++++++++++++++++++-- 1 file changed, 102 insertions(+), 6 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs') diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 4d66d1422..692176efc 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -1,5 +1,6 @@ using MediaBrowser.Common.Events; using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Progress; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; @@ -103,7 +104,7 @@ namespace MediaBrowser.Server.Implementations.Library private readonly IUserManager _userManager; private readonly IUserDataRepository _userDataRepository; - + /// /// Gets or sets the configuration manager. /// @@ -244,7 +245,7 @@ namespace MediaBrowser.Server.Implementations.Library { // Any number of configuration settings could change the way the library is refreshed, so do that now _taskManager.CancelIfRunningAndQueue(); - + if (refreshPeopleAfterUpdate) { _taskManager.CancelIfRunningAndQueue(); @@ -285,7 +286,7 @@ namespace MediaBrowser.Server.Implementations.Library items.AddRange(userFolders); - return new ConcurrentDictionary(items.ToDictionary(i => i.Id)); + return new ConcurrentDictionary(items.ToDictionary(i => i.Id)); } /// @@ -505,7 +506,7 @@ namespace MediaBrowser.Server.Implementations.Library { return _userRootFolders.GetOrAdd(userRootPath, key => RetrieveItem(userRootPath.GetMBId(typeof(UserRootFolder))) as UserRootFolder ?? (UserRootFolder)ResolvePath(userRootPath)); } - + /// /// Gets a Person /// @@ -560,7 +561,20 @@ namespace MediaBrowser.Server.Implementations.Library /// Task{Genre}. public Task GetArtist(string name, bool allowSlowProviders = false) { - return GetImagesByNameItem(ConfigurationManager.ApplicationPaths.ArtistsPath, name, CancellationToken.None, allowSlowProviders); + return GetArtist(name, CancellationToken.None, allowSlowProviders); + } + + /// + /// Gets the artist. + /// + /// The name. + /// The cancellation token. + /// if set to true [allow slow providers]. + /// if set to true [force creation]. + /// Task{Artist}. + private Task GetArtist(string name, CancellationToken cancellationToken, bool allowSlowProviders = false, bool forceCreation = false) + { + return GetImagesByNameItem(ConfigurationManager.ApplicationPaths.ArtistsPath, name, cancellationToken, allowSlowProviders, forceCreation); } /// @@ -764,6 +778,76 @@ namespace MediaBrowser.Server.Implementations.Library _logger.Info("People validation complete"); } + public async Task ValidateArtists(CancellationToken cancellationToken, IProgress progress) + { + const int maxTasks = 25; + + var tasks = new List(); + + var artists = RootFolder.RecursiveChildren + .OfType