aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs39
1 files changed, 29 insertions, 10 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index b99bc4f97..549ea9be2 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -9,6 +9,7 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.ScheduledTasks;
using MediaBrowser.Controller.Sorting;
+using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Server.Implementations.ScheduledTasks;
@@ -121,6 +122,8 @@ namespace MediaBrowser.Server.Implementations.Library
ConfigurationManager = configurationManager;
ConfigurationManager.ConfigurationUpdated += kernel_ConfigurationUpdated;
+
+ RecordConfigurationValues(configurationManager.Configuration);
}
/// <summary>
@@ -174,6 +177,15 @@ namespace MediaBrowser.Server.Implementations.Library
}
}
+ private bool _internetProvidersEnabled;
+ private bool _peopleImageFetchingEnabled;
+
+ private void RecordConfigurationValues(ServerConfiguration configuration)
+ {
+ _internetProvidersEnabled = configuration.EnableInternetProviders;
+ _peopleImageFetchingEnabled = configuration.InternetProviderExcludeTypes == null || !configuration.InternetProviderExcludeTypes.Contains(typeof(Person).Name, StringComparer.OrdinalIgnoreCase);
+ }
+
/// <summary>
/// Handles the ConfigurationUpdated event of the kernel control.
/// </summary>
@@ -181,23 +193,30 @@ namespace MediaBrowser.Server.Implementations.Library
/// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
void kernel_ConfigurationUpdated(object sender, EventArgs e)
{
- //// Figure out whether or not we should refresh people after the update is finished
- //var refreshPeopleAfterUpdate = !oldConfiguration.EnableInternetProviders && config.EnableInternetProviders;
+ var config = ConfigurationManager.Configuration;
+
+ // Figure out whether or not we should refresh people after the update is finished
+ var refreshPeopleAfterUpdate = !_internetProvidersEnabled && config.EnableInternetProviders;
- //// This is true if internet providers has just been turned on, or if People have just been removed from InternetProviderExcludeTypes
- //if (!refreshPeopleAfterUpdate)
- //{
- // var oldConfigurationFetchesPeopleImages = oldConfiguration.InternetProviderExcludeTypes == null || !oldConfiguration.InternetProviderExcludeTypes.Contains(typeof(Person).Name, StringComparer.OrdinalIgnoreCase);
- // var newConfigurationFetchesPeopleImages = config.InternetProviderExcludeTypes == null || !config.InternetProviderExcludeTypes.Contains(typeof(Person).Name, StringComparer.OrdinalIgnoreCase);
+ // This is true if internet providers has just been turned on, or if People have just been removed from InternetProviderExcludeTypes
+ if (!refreshPeopleAfterUpdate)
+ {
+ var newConfigurationFetchesPeopleImages = config.InternetProviderExcludeTypes == null || !config.InternetProviderExcludeTypes.Contains(typeof(Person).Name, StringComparer.OrdinalIgnoreCase);
+
+ refreshPeopleAfterUpdate = newConfigurationFetchesPeopleImages && !_peopleImageFetchingEnabled;
+ }
- // refreshPeopleAfterUpdate = newConfigurationFetchesPeopleImages && !oldConfigurationFetchesPeopleImages;
- //}
+ RecordConfigurationValues(config);
Task.Run(() =>
{
// Any number of configuration settings could change the way the library is refreshed, so do that now
_taskManager.CancelIfRunningAndQueue<RefreshMediaLibraryTask>();
- _taskManager.CancelIfRunningAndQueue<PeopleValidationTask>();
+
+ if (refreshPeopleAfterUpdate)
+ {
+ _taskManager.CancelIfRunningAndQueue<PeopleValidationTask>();
+ }
});
}