From d3acd04e66e6f45084f7d6f6a3fb6e26688e5b5b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 12 Aug 2013 15:18:31 -0400 Subject: store chapters in xml --- .../Providers/ProviderManager.cs | 89 ---------------------- 1 file changed, 89 deletions(-) (limited to 'MediaBrowser.Server.Implementations') diff --git a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs index b7d73b515a..59217bc17d 100644 --- a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs +++ b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs @@ -2,16 +2,12 @@ using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Entities.Audio; -using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Net; using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -25,12 +21,6 @@ namespace MediaBrowser.Server.Implementations.Providers /// public class ProviderManager : IProviderManager { - /// - /// The currently running metadata providers - /// - private readonly ConcurrentDictionary> _currentlyRunningProviders = - new ConcurrentDictionary>(); - /// /// The _logger /// @@ -72,19 +62,6 @@ namespace MediaBrowser.Server.Implementations.Providers _httpClient = httpClient; ConfigurationManager = configurationManager; _directoryWatchers = directoryWatchers; - - configurationManager.ConfigurationUpdated += configurationManager_ConfigurationUpdated; - } - - /// - /// Handles the ConfigurationUpdated event of the configurationManager control. - /// - /// The source of the event. - /// The instance containing the event data. - void configurationManager_ConfigurationUpdated(object sender, EventArgs e) - { - // Validate currently executing providers, in the background - Task.Run(() => ValidateCurrentlyRunningProviders()); } /// @@ -217,8 +194,6 @@ namespace MediaBrowser.Server.Implementations.Providers // This provides the ability to cancel just this one provider var innerCancellationTokenSource = new CancellationTokenSource(); - OnProviderRefreshBeginning(provider, item, innerCancellationTokenSource); - try { var changed = await provider.FetchAsync(item, force, CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, innerCancellationTokenSource.Token).Token).ConfigureAwait(false); @@ -253,70 +228,6 @@ namespace MediaBrowser.Server.Implementations.Providers finally { innerCancellationTokenSource.Dispose(); - - OnProviderRefreshCompleted(provider, item); - } - } - - /// - /// Notifies the kernal that a provider has begun refreshing - /// - /// The provider. - /// The item. - /// The cancellation token source. - public void OnProviderRefreshBeginning(BaseMetadataProvider provider, BaseItem item, CancellationTokenSource cancellationTokenSource) - { - var key = item.Id + provider.GetType().Name; - - Tuple current; - - if (_currentlyRunningProviders.TryGetValue(key, out current)) - { - try - { - current.Item3.Cancel(); - } - catch (ObjectDisposedException) - { - - } - } - - var tuple = new Tuple(provider, item, cancellationTokenSource); - - _currentlyRunningProviders.AddOrUpdate(key, tuple, (k, v) => tuple); - } - - /// - /// Notifies the kernal that a provider has completed refreshing - /// - /// The provider. - /// The item. - public void OnProviderRefreshCompleted(BaseMetadataProvider provider, BaseItem item) - { - var key = item.Id + provider.GetType().Name; - - Tuple current; - - if (_currentlyRunningProviders.TryRemove(key, out current)) - { - current.Item3.Dispose(); - } - } - - /// - /// Validates the currently running providers and cancels any that should not be run due to configuration changes - /// - private void ValidateCurrentlyRunningProviders() - { - var enableInternetProviders = ConfigurationManager.Configuration.EnableInternetProviders; - var internetProviderExcludeTypes = ConfigurationManager.Configuration.InternetProviderExcludeTypes; - - foreach (var tuple in _currentlyRunningProviders.Values - .Where(p => p.Item1.RequiresInternet && (!enableInternetProviders || internetProviderExcludeTypes.Contains(p.Item2.GetType().Name, StringComparer.OrdinalIgnoreCase))) - .ToList()) - { - tuple.Item3.Cancel(); } } -- cgit v1.2.3