From 2ca4b7d03adfa3cc7c9c6a597a11762142d5b34b Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Mon, 4 Mar 2013 00:43:06 -0500 Subject: Created IConfigurationManager --- .../Configuration/IServerConfigurationManager.cs | 23 ++++ MediaBrowser.Controller/Drawing/ImageManager.cs | 12 +- MediaBrowser.Controller/Entities/BaseItem.cs | 13 ++- MediaBrowser.Controller/Entities/User.cs | 14 ++- MediaBrowser.Controller/IO/DirectoryWatchers.cs | 20 ++-- MediaBrowser.Controller/IO/FileSystemManager.cs | 10 +- MediaBrowser.Controller/IServerApplicationPaths.cs | 3 +- MediaBrowser.Controller/Kernel.cs | 99 ++++++---------- MediaBrowser.Controller/Library/DtoBuilder.cs | 34 ------ MediaBrowser.Controller/Library/ItemResolveArgs.cs | 24 +++- .../Localization/LocalizedStrings.cs | 25 ++-- MediaBrowser.Controller/Localization/Ratings.cs | 12 +- .../Localization/RatingsDefinition.cs | 19 +-- .../MediaBrowser.Controller.csproj | 5 +- MediaBrowser.Controller/MediaInfo/FFMpegManager.cs | 18 ++- .../Plugins/PluginSecurityManager.cs | 130 --------------------- .../Providers/BaseMetadataProvider.cs | 13 ++- .../Providers/FanartBaseProvider.cs | 7 +- .../Providers/FolderProviderFromXml.cs | 5 +- .../Providers/ImageFromMediaLocationProvider.cs | 5 +- .../Providers/ImagesByNameProvider.cs | 7 +- .../Providers/MediaInfo/BaseFFMpegImageProvider.cs | 5 +- .../Providers/MediaInfo/BaseFFMpegProvider.cs | 3 +- .../Providers/MediaInfo/BaseFFProbeProvider.cs | 5 +- .../MediaInfo/FFMpegAudioImageProvider.cs | 5 +- .../MediaInfo/FFMpegVideoImageProvider.cs | 9 +- .../MediaInfo/FFProbeAudioInfoProvider.cs | 3 +- .../MediaInfo/FFProbeVideoInfoProvider.cs | 54 ++++----- .../Providers/Movies/FanArtMovieProvider.cs | 64 +++++++--- .../Providers/Movies/MovieDbProvider.cs | 114 ++++++++++-------- .../Providers/Movies/MovieProviderFromJson.cs | 5 +- .../Providers/Movies/MovieProviderFromXml.cs | 5 +- .../Providers/Movies/PersonProviderFromJson.cs | 5 +- .../Providers/Movies/TmdbPersonProvider.cs | 51 ++++---- .../Providers/Music/LastfmBaseProvider.cs | 54 ++++----- .../Providers/ProviderManager.cs | 39 +++++-- .../Providers/SortNameProvider.cs | 16 +-- .../TV/EpisodeImageFromMediaLocationProvider.cs | 5 +- .../Providers/TV/EpisodeProviderFromXml.cs | 5 +- .../Providers/TV/FanArtTVProvider.cs | 28 ++--- .../Providers/TV/RemoteEpisodeProvider.cs | 33 +++--- .../Providers/TV/RemoteSeasonProvider.cs | 31 ++--- .../Providers/TV/RemoteSeriesProvider.cs | 69 +++++++---- .../Providers/TV/SeriesProviderFromXml.cs | 5 +- .../Updates/InstallationManager.cs | 7 +- 45 files changed, 543 insertions(+), 575 deletions(-) create mode 100644 MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs delete mode 100644 MediaBrowser.Controller/Plugins/PluginSecurityManager.cs (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs new file mode 100644 index 0000000000..810376f6c6 --- /dev/null +++ b/MediaBrowser.Controller/Configuration/IServerConfigurationManager.cs @@ -0,0 +1,23 @@ +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Configuration; + +namespace MediaBrowser.Controller.Configuration +{ + /// + /// Interface IServerConfigurationManager + /// + public interface IServerConfigurationManager : IConfigurationManager + { + /// + /// Gets the application paths. + /// + /// The application paths. + IServerApplicationPaths ApplicationPaths { get; } + + /// + /// Gets the configuration. + /// + /// The configuration. + ServerConfiguration Configuration { get; } + } +} diff --git a/MediaBrowser.Controller/Drawing/ImageManager.cs b/MediaBrowser.Controller/Drawing/ImageManager.cs index 766d561156..d95f72df70 100644 --- a/MediaBrowser.Controller/Drawing/ImageManager.cs +++ b/MediaBrowser.Controller/Drawing/ImageManager.cs @@ -66,23 +66,23 @@ namespace MediaBrowser.Controller.Drawing /// The _kernel /// private readonly Kernel _kernel; - + /// /// Initializes a new instance of the class. /// /// The kernel. /// The protobuf serializer. /// The logger. - public ImageManager(Kernel kernel, IProtobufSerializer protobufSerializer, ILogger logger) + public ImageManager(Kernel kernel, IProtobufSerializer protobufSerializer, ILogger logger, IServerApplicationPaths appPaths) { _protobufSerializer = protobufSerializer; _logger = logger; _kernel = kernel; - ImageSizeCache = new FileSystemRepository(Path.Combine(_kernel.ApplicationPaths.ImageCachePath, "image-sizes")); - ResizedImageCache = new FileSystemRepository(Path.Combine(_kernel.ApplicationPaths.ImageCachePath, "resized-images")); - CroppedImageCache = new FileSystemRepository(Path.Combine(_kernel.ApplicationPaths.ImageCachePath, "cropped-images")); - EnhancedImageCache = new FileSystemRepository(Path.Combine(_kernel.ApplicationPaths.ImageCachePath, "enhanced-images")); + ImageSizeCache = new FileSystemRepository(Path.Combine(appPaths.ImageCachePath, "image-sizes")); + ResizedImageCache = new FileSystemRepository(Path.Combine(appPaths.ImageCachePath, "resized-images")); + CroppedImageCache = new FileSystemRepository(Path.Combine(appPaths.ImageCachePath, "cropped-images")); + EnhancedImageCache = new FileSystemRepository(Path.Combine(appPaths.ImageCachePath, "enhanced-images")); } /// diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 47c129dea3..e80c3d71f3 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1,4 +1,6 @@ -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Localization; @@ -96,6 +98,7 @@ namespace MediaBrowser.Controller.Entities /// protected static internal ILogger Logger { get; internal set; } protected static internal ILibraryManager LibraryManager { get; internal set; } + protected static internal IServerConfigurationManager ConfigurationManager { get; internal set; } /// /// Returns a that represents this instance. @@ -311,7 +314,7 @@ namespace MediaBrowser.Controller.Entities // non file-system entries will not have a path if (string.IsNullOrEmpty(path)) { - return new ItemResolveArgs + return new ItemResolveArgs(ConfigurationManager.ApplicationPaths) { FileInfo = new WIN32_FIND_DATA() }; @@ -329,7 +332,7 @@ namespace MediaBrowser.Controller.Entities throw new IOException("Unable to retrieve file system info for " + path); } - var args = new ItemResolveArgs + var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths) { FileInfo = pathInfo.Value, Path = path, @@ -997,7 +1000,7 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentNullException(); } - return (DateTime.UtcNow - DateCreated).TotalDays < Kernel.Instance.Configuration.RecentItemDays; + return (DateTime.UtcNow - DateCreated).TotalDays < ConfigurationManager.Configuration.RecentItemDays; } /// @@ -1020,7 +1023,7 @@ namespace MediaBrowser.Controller.Entities return false; } - return (DateTime.UtcNow - data.LastPlayedDate.Value).TotalDays < Kernel.Instance.Configuration.RecentlyPlayedDays; + return (DateTime.UtcNow - data.LastPlayedDate.Value).TotalDays < ConfigurationManager.Configuration.RecentlyPlayedDays; } /// diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index bf77cdc959..ef50a08671 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Configuration; @@ -18,6 +19,7 @@ namespace MediaBrowser.Controller.Entities public class User : BaseItem { internal static IUserManager UserManager { get; set; } + internal static IXmlSerializer XmlSerializer { get; set; } /// /// The _root folder path @@ -45,7 +47,7 @@ namespace MediaBrowser.Controller.Entities } else { - _rootFolderPath = Kernel.Instance.ApplicationPaths.DefaultUserViewsPath; + _rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath; } } return _rootFolderPath; @@ -61,7 +63,7 @@ namespace MediaBrowser.Controller.Entities { var safeFolderName = FileSystem.GetValidFilename(username); - return System.IO.Path.Combine(Kernel.Instance.ApplicationPaths.RootFolderPath, safeFolderName); + return System.IO.Path.Combine(ConfigurationManager.ApplicationPaths.RootFolderPath, safeFolderName); } /// @@ -171,7 +173,7 @@ namespace MediaBrowser.Controller.Entities get { // Lazy load - LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationInitialized, ref _configurationSyncLock, () => (UserConfiguration)Kernel.Instance.GetXmlConfiguration(typeof(UserConfiguration), ConfigurationFilePath)); + LazyInitializer.EnsureInitialized(ref _configuration, ref _configurationInitialized, ref _configurationSyncLock, () => (UserConfiguration)ConfigurationHelper.GetXmlConfiguration(typeof(UserConfiguration), ConfigurationFilePath, XmlSerializer)); return _configuration; } private set @@ -321,7 +323,7 @@ namespace MediaBrowser.Controller.Entities { var safeFolderName = FileSystem.GetValidFilename(username); - return System.IO.Path.Combine(Kernel.Instance.ApplicationPaths.UserConfigurationDirectoryPath, safeFolderName); + return System.IO.Path.Combine(ConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath, safeFolderName); } /// @@ -411,7 +413,7 @@ namespace MediaBrowser.Controller.Entities { var userPath = RootFolderPath; - var defaultPath = Kernel.Instance.ApplicationPaths.DefaultUserViewsPath; + var defaultPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath; if (userPath.Equals(defaultPath, StringComparison.OrdinalIgnoreCase)) { diff --git a/MediaBrowser.Controller/IO/DirectoryWatchers.cs b/MediaBrowser.Controller/IO/DirectoryWatchers.cs index 991e4ba430..5789c0240a 100644 --- a/MediaBrowser.Controller/IO/DirectoryWatchers.cs +++ b/MediaBrowser.Controller/IO/DirectoryWatchers.cs @@ -1,5 +1,5 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.ScheduledTasks; @@ -74,16 +74,13 @@ namespace MediaBrowser.Controller.IO private ITaskManager TaskManager { get; set; } private ILibraryManager LibraryManager { get; set; } + private IServerConfigurationManager ConfigurationManager { get; set; } /// /// Initializes a new instance of the class. /// - public DirectoryWatchers(ILogger logger, ITaskManager taskManager, ILibraryManager libraryManager) + public DirectoryWatchers(ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager) { - if (logger == null) - { - throw new ArgumentNullException("logger"); - } if (taskManager == null) { throw new ArgumentNullException("taskManager"); @@ -91,7 +88,8 @@ namespace MediaBrowser.Controller.IO LibraryManager = libraryManager; TaskManager = taskManager; - Logger = logger; + Logger = logManager.GetLogger("DirectoryWatchers"); + ConfigurationManager = configurationManager; } /// @@ -335,11 +333,11 @@ namespace MediaBrowser.Controller.IO { if (updateTimer == null) { - updateTimer = new Timer(TimerStopped, null, TimeSpan.FromSeconds(Kernel.Instance.Configuration.FileWatcherDelay), TimeSpan.FromMilliseconds(-1)); + updateTimer = new Timer(TimerStopped, null, TimeSpan.FromSeconds(ConfigurationManager.Configuration.FileWatcherDelay), TimeSpan.FromMilliseconds(-1)); } else { - updateTimer.Change(TimeSpan.FromSeconds(Kernel.Instance.Configuration.FileWatcherDelay), TimeSpan.FromMilliseconds(-1)); + updateTimer.Change(TimeSpan.FromSeconds(ConfigurationManager.Configuration.FileWatcherDelay), TimeSpan.FromMilliseconds(-1)); } } } @@ -356,7 +354,7 @@ namespace MediaBrowser.Controller.IO if (affectedPaths.Any(p => IsFileLocked(p.Key))) { Logger.Info("Timer extended."); - updateTimer.Change(TimeSpan.FromSeconds(Kernel.Instance.Configuration.FileWatcherDelay), TimeSpan.FromMilliseconds(-1)); + updateTimer.Change(TimeSpan.FromSeconds(ConfigurationManager.Configuration.FileWatcherDelay), TimeSpan.FromMilliseconds(-1)); return; } diff --git a/MediaBrowser.Controller/IO/FileSystemManager.cs b/MediaBrowser.Controller/IO/FileSystemManager.cs index b1695e7b5e..4afc8265fc 100644 --- a/MediaBrowser.Controller/IO/FileSystemManager.cs +++ b/MediaBrowser.Controller/IO/FileSystemManager.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.IO; using MediaBrowser.Common.Kernel; using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Logging; @@ -33,14 +34,15 @@ namespace MediaBrowser.Controller.IO /// Initializes a new instance of the class. /// /// The kernel. - /// The logger. + /// The log manager. /// The task manager. /// The library manager. - public FileSystemManager(Kernel kernel, ILogger logger, ITaskManager taskManager, ILibraryManager libraryManager) + /// The configuration manager. + public FileSystemManager(Kernel kernel, ILogManager logManager, ITaskManager taskManager, ILibraryManager libraryManager, IServerConfigurationManager configurationManager) : base(kernel) { - _logger = logger; - DirectoryWatchers = new DirectoryWatchers(logger, taskManager, libraryManager); + _logger = logManager.GetLogger("FileSystemManager"); + DirectoryWatchers = new DirectoryWatchers(logManager, taskManager, libraryManager, configurationManager); } /// diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs index b5fcdef285..b30120d835 100644 --- a/MediaBrowser.Controller/IServerApplicationPaths.cs +++ b/MediaBrowser.Controller/IServerApplicationPaths.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Kernel; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Kernel; namespace MediaBrowser.Controller { diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index 5dbb53d0ae..9f97b1719a 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -1,5 +1,7 @@ -using MediaBrowser.Common.Kernel; +using MediaBrowser.Common; +using MediaBrowser.Common.Kernel; using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.IO; @@ -11,7 +13,6 @@ using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Updates; using MediaBrowser.Controller.Weather; -using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.System; @@ -26,7 +27,7 @@ namespace MediaBrowser.Controller /// /// Class Kernel /// - public class Kernel : BaseKernel + public class Kernel : BaseKernel, IDisposable { /// /// Gets the instance. @@ -161,23 +162,34 @@ namespace MediaBrowser.Controller get { return 7359; } } + private readonly IXmlSerializer _xmlSerializer; + + private readonly IServerConfigurationManager _configurationManager; + private readonly ILogManager _logManager; + /// /// Creates a kernel based on a Data path, which is akin to our current programdata path /// /// The app host. - /// The app paths. /// The XML serializer. - /// The logger. + /// The log manager. + /// The configuration manager. /// isoManager - public Kernel(IApplicationHost appHost, IServerApplicationPaths appPaths, IXmlSerializer xmlSerializer, ILogger logger) - : base(appHost, appPaths, xmlSerializer, logger) + public Kernel(IApplicationHost appHost, IXmlSerializer xmlSerializer, ILogManager logManager, IServerConfigurationManager configurationManager) + : base(appHost, logManager, configurationManager) { Instance = this; - // For now there's no real way to inject this properly - BaseItem.Logger = logger; - Ratings.Logger = logger; - LocalizedStrings.Logger = logger; + _configurationManager = configurationManager; + _xmlSerializer = xmlSerializer; + _logManager = logManager; + + // For now there's no real way to inject these properly + BaseItem.Logger = logManager.GetLogger("BaseItem"); + User.XmlSerializer = _xmlSerializer; + Ratings.ConfigurationManager = _configurationManager; + LocalizedStrings.ApplicationPaths = _configurationManager.ApplicationPaths; + BaseItem.ConfigurationManager = configurationManager; } /// @@ -185,14 +197,13 @@ namespace MediaBrowser.Controller /// protected void FindParts() { - // For now there's no real way to inject this properly + // For now there's no real way to inject these properly BaseItem.LibraryManager = ApplicationHost.Resolve(); User.UserManager = ApplicationHost.Resolve(); FFMpegManager = (FFMpegManager)ApplicationHost.CreateInstance(typeof(FFMpegManager)); ImageManager = (ImageManager)ApplicationHost.CreateInstance(typeof(ImageManager)); ProviderManager = (ProviderManager)ApplicationHost.CreateInstance(typeof(ProviderManager)); - SecurityManager = (PluginSecurityManager)ApplicationHost.CreateInstance(typeof(PluginSecurityManager)); UserDataRepositories = ApplicationHost.GetExports(); UserRepositories = ApplicationHost.GetExports(); @@ -217,8 +228,6 @@ namespace MediaBrowser.Controller await LoadRepositories().ConfigureAwait(false); - ReloadResourcePools(); - await ApplicationHost.Resolve().RefreshUsersMetadata(CancellationToken.None).ConfigureAwait(false); foreach (var entryPoint in ApplicationHost.GetExports()) @@ -230,42 +239,26 @@ namespace MediaBrowser.Controller } /// - /// Releases unmanaged and - optionally - managed resources. + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// - /// true to release both managed and unmanaged resources; false to release only unmanaged resources. - protected override void Dispose(bool dispose) + public void Dispose() { - if (dispose) - { - DisposeResourcePools(); - - DisposeFileSystemManager(); - } - - base.Dispose(dispose); + Dispose(true); + GC.SuppressFinalize(this); } /// - /// Disposes the resource pools. + /// Releases unmanaged and - optionally - managed resources. /// - private void DisposeResourcePools() + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool dispose) { - if (ResourcePools != null) + if (dispose) { - ResourcePools.Dispose(); - ResourcePools = null; + DisposeFileSystemManager(); } } - /// - /// Reloads the resource pools. - /// - private void ReloadResourcePools() - { - DisposeResourcePools(); - ResourcePools = new ResourcePool(); - } - /// /// Called when [composable parts loaded]. /// @@ -273,19 +266,19 @@ namespace MediaBrowser.Controller protected Task LoadRepositories() { // Get the current item repository - ItemRepository = GetRepository(ItemRepositories, Configuration.ItemRepository); + ItemRepository = GetRepository(ItemRepositories, _configurationManager.Configuration.ItemRepository); var itemRepoTask = ItemRepository.Initialize(); // Get the current user repository - UserRepository = GetRepository(UserRepositories, Configuration.UserRepository); + UserRepository = GetRepository(UserRepositories, _configurationManager.Configuration.UserRepository); var userRepoTask = UserRepository.Initialize(); // Get the current item repository - UserDataRepository = GetRepository(UserDataRepositories, Configuration.UserDataRepository); + UserDataRepository = GetRepository(UserDataRepositories, _configurationManager.Configuration.UserDataRepository); var userDataRepoTask = UserDataRepository.Initialize(); // Get the current display preferences repository - DisplayPreferencesRepository = GetRepository(DisplayPreferencesRepositories, Configuration.DisplayPreferencesRepository); + DisplayPreferencesRepository = GetRepository(DisplayPreferencesRepositories, _configurationManager.Configuration.DisplayPreferencesRepository); var displayPreferencesRepoTask = DisplayPreferencesRepository.Initialize(); return Task.WhenAll(itemRepoTask, userRepoTask, userDataRepoTask, displayPreferencesRepoTask); @@ -326,26 +319,10 @@ namespace MediaBrowser.Controller { DisposeFileSystemManager(); - FileSystemManager = new FileSystemManager(this, Logger, ApplicationHost.Resolve(), ApplicationHost.Resolve()); + FileSystemManager = new FileSystemManager(this, _logManager, ApplicationHost.Resolve(), ApplicationHost.Resolve(), _configurationManager); FileSystemManager.StartWatchers(); } - /// - /// Completely overwrites the current configuration with a new copy - /// - /// The config. - public void UpdateConfiguration(ServerConfiguration config) - { - Configuration = config; - SaveConfiguration(); - - // Validate currently executing providers, in the background - Task.Run(() => - { - ProviderManager.ValidateCurrentlyRunningProviders(); - }); - } - /// /// Gets the system info. /// diff --git a/MediaBrowser.Controller/Library/DtoBuilder.cs b/MediaBrowser.Controller/Library/DtoBuilder.cs index 0a892cbfb8..0b14bb9522 100644 --- a/MediaBrowser.Controller/Library/DtoBuilder.cs +++ b/MediaBrowser.Controller/Library/DtoBuilder.cs @@ -474,14 +474,8 @@ namespace MediaBrowser.Controller.Library /// The dto. private static void SetSpecialCounts(Folder folder, User user, BaseItemDto dto) { - var utcNow = DateTime.UtcNow; - var rcentlyAddedItemCount = 0; var recursiveItemCount = 0; - var favoriteItemsCount = 0; - var recentlyAddedUnPlayedItemCount = 0; - var resumableItemCount = 0; - var recentlyPlayedItemCount = 0; double totalPercentPlayed = 0; @@ -498,12 +492,6 @@ namespace MediaBrowser.Controller.Library if (child.IsRecentlyAdded(user)) { rcentlyAddedItemCount++; - - // Check recently added unplayed - if (userdata == null || userdata.PlayCount == 0) - { - recentlyAddedUnPlayedItemCount++; - } } // Incrememt totalPercentPlayed @@ -521,32 +509,10 @@ namespace MediaBrowser.Controller.Library } } } - - if (userdata != null) - { - if (userdata.IsFavorite) - { - favoriteItemsCount++; - } - - if (userdata.PlaybackPositionTicks > 0) - { - resumableItemCount++; - } - - if (userdata.LastPlayedDate.HasValue && (utcNow - userdata.LastPlayedDate.Value).TotalDays < Kernel.Instance.Configuration.RecentlyPlayedDays) - { - recentlyPlayedItemCount++; - } - } } dto.RecursiveItemCount = recursiveItemCount; dto.RecentlyAddedItemCount = rcentlyAddedItemCount; - dto.RecentlyAddedUnPlayedItemCount = recentlyAddedUnPlayedItemCount; - dto.ResumableItemCount = resumableItemCount; - dto.FavoriteItemCount = favoriteItemsCount; - dto.RecentlyPlayedItemCount = recentlyPlayedItemCount; if (recursiveItemCount > 0) { diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 0979c6845c..2dbbc9d83c 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -1,9 +1,9 @@ using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.IO; using System; using System.Collections.Generic; using System.IO; using System.Linq; -using MediaBrowser.Controller.IO; namespace MediaBrowser.Controller.Library { @@ -13,6 +13,20 @@ namespace MediaBrowser.Controller.Library /// public class ItemResolveArgs : EventArgs { + /// + /// The _app paths + /// + private readonly IServerApplicationPaths _appPaths; + + /// + /// Initializes a new instance of the class. + /// + /// The app paths. + public ItemResolveArgs(IServerApplicationPaths appPaths) + { + _appPaths = appPaths; + } + /// /// Gets the file system children. /// @@ -99,9 +113,9 @@ namespace MediaBrowser.Controller.Library } var parentDir = FileInfo.Path != null ? System.IO.Path.GetDirectoryName(FileInfo.Path) ?? string.Empty : string.Empty; - - return (parentDir.Length > Kernel.Instance.ApplicationPaths.RootFolderPath.Length - && parentDir.StartsWith(Kernel.Instance.ApplicationPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase)); + + return (parentDir.Length > _appPaths.RootFolderPath.Length + && parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase)); } } @@ -114,7 +128,7 @@ namespace MediaBrowser.Controller.Library { get { - return IsDirectory && Path.Equals(Kernel.Instance.ApplicationPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase); + return IsDirectory && Path.Equals(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase); } } diff --git a/MediaBrowser.Controller/Localization/LocalizedStrings.cs b/MediaBrowser.Controller/Localization/LocalizedStrings.cs index 0d583641bd..c7f4755b73 100644 --- a/MediaBrowser.Controller/Localization/LocalizedStrings.cs +++ b/MediaBrowser.Controller/Localization/LocalizedStrings.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.Logging; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Model.Logging; using System; using System.Collections.Concurrent; using System.Globalization; @@ -14,10 +15,8 @@ namespace MediaBrowser.Controller.Localization /// public class LocalizedStrings { - /// - /// The logger - /// - static internal ILogger Logger { get; set; } + internal static IServerApplicationPaths ApplicationPaths; + /// /// The base prefix /// @@ -31,17 +30,21 @@ namespace MediaBrowser.Controller.Localization /// private static LocalizedStrings _instance; + private IServerApplicationPaths _appPaths; + /// /// Gets the instance. /// /// The instance. - public static LocalizedStrings Instance { get { return _instance ?? (_instance = new LocalizedStrings()); } } + public static LocalizedStrings Instance { get { return _instance ?? (_instance = new LocalizedStrings(ApplicationPaths)); } } /// /// Initializes a new instance of the class. /// - public LocalizedStrings() + public LocalizedStrings(IServerApplicationPaths appPaths) { + _appPaths = appPaths; + foreach (var stringObject in Kernel.Instance.StringFiles) { AddStringData(LoadFromFile(GetFileName(stringObject),stringObject.GetType())); @@ -55,7 +58,7 @@ namespace MediaBrowser.Controller.Localization /// System.String. protected string GetFileName(LocalizedStringData stringObject) { - var path = Kernel.Instance.ApplicationPaths.LocalizationPath; + var path = _appPaths.LocalizationPath; var name = Path.Combine(path, stringObject.Prefix + "strings-" + CultureInfo.CurrentCulture + ".xml"); if (File.Exists(name)) { @@ -125,17 +128,17 @@ namespace MediaBrowser.Controller.Localization } catch (TargetException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } catch (FieldAccessException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } catch (NotSupportedException ex) { - Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); + //Logger.ErrorException("Error getting value for field: {0}", ex, field.Name); continue; } diff --git a/MediaBrowser.Controller/Localization/Ratings.cs b/MediaBrowser.Controller/Localization/Ratings.cs index 46368a250a..bee7b6e557 100644 --- a/MediaBrowser.Controller/Localization/Ratings.cs +++ b/MediaBrowser.Controller/Localization/Ratings.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Extensions; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.Logging; using System.Collections.Generic; using System.IO; @@ -11,7 +12,8 @@ namespace MediaBrowser.Controller.Localization /// public static class Ratings { - static internal ILogger Logger { get; set; } + internal static IServerConfigurationManager ConfigurationManager; + /// /// The ratings def /// @@ -26,7 +28,7 @@ namespace MediaBrowser.Controller.Localization /// The ratings dict. public static Dictionary RatingsDict { - get { return _ratingsDict ?? (_ratingsDict = Initialize(false)); } + get { return _ratingsDict ?? (_ratingsDict = Initialize(false, ConfigurationManager)); } } /// /// The ratings strings @@ -38,17 +40,17 @@ namespace MediaBrowser.Controller.Localization /// /// if set to true [block unrated]. /// Dictionary{System.StringSystem.Int32}. - public static Dictionary Initialize(bool blockUnrated) + public static Dictionary Initialize(bool blockUnrated, IServerConfigurationManager configurationManager) { //build our ratings dictionary from the combined local one and us one - ratingsDef = new RatingsDefinition(Path.Combine(Kernel.Instance.ApplicationPaths.LocalizationPath, "Ratings-" + Kernel.Instance.Configuration.MetadataCountryCode + ".txt"), Logger); + ratingsDef = new RatingsDefinition(Path.Combine(configurationManager.ApplicationPaths.LocalizationPath, "Ratings-" + configurationManager.Configuration.MetadataCountryCode + ".txt"), configurationManager); //global value of None var dict = new Dictionary {{"None", -1}}; foreach (var pair in ratingsDef.RatingsDict) { dict.TryAdd(pair.Key, pair.Value); } - if (Kernel.Instance.Configuration.MetadataCountryCode.ToUpper() != "US") + if (configurationManager.Configuration.MetadataCountryCode.ToUpper() != "US") { foreach (var pair in new USRatingsDictionary()) { diff --git a/MediaBrowser.Controller/Localization/RatingsDefinition.cs b/MediaBrowser.Controller/Localization/RatingsDefinition.cs index e0753da2e0..1162d2389f 100644 --- a/MediaBrowser.Controller/Localization/RatingsDefinition.cs +++ b/MediaBrowser.Controller/Localization/RatingsDefinition.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Model.Logging; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; using System.IO; @@ -10,26 +11,18 @@ namespace MediaBrowser.Controller.Localization /// public class RatingsDefinition { - /// - /// Gets or sets the logger. - /// - /// The logger. - private ILogger Logger { get; set; } - /// /// Initializes a new instance of the class. /// /// The file. /// The logger. - public RatingsDefinition(string file, ILogger logger) + /// The configuration manager. + public RatingsDefinition(string file, IServerConfigurationManager configurationManager) { - Logger = logger; - - Logger.Info("Loading Certification Ratings from file " + file); this.file = file; if (!Load()) { - Init(Kernel.Instance.Configuration.MetadataCountryCode.ToUpper()); + Init(configurationManager.Configuration.MetadataCountryCode.ToUpper()); } } @@ -108,7 +101,7 @@ namespace MediaBrowser.Controller.Localization } else { - Logger.Error("Invalid line in ratings file " + file + "(" + line + ")"); + //Logger.Error("Invalid line in ratings file " + file + "(" + line + ")"); } } } diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 319289f94a..f4be79afb1 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -53,9 +53,6 @@ MinimumRecommendedRules.ruleset - - Plugins\Mediabrowser.PluginSecurity.dll - False ..\packages\protobuf-net.2.0.0.621\lib\net40\protobuf-net.dll @@ -74,6 +71,7 @@ Properties\SharedVersion.cs + @@ -135,7 +133,6 @@ - diff --git a/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs b/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs index 0f535208b4..36fab24bb1 100644 --- a/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs +++ b/MediaBrowser.Controller/MediaInfo/FFMpegManager.cs @@ -67,6 +67,7 @@ namespace MediaBrowser.Controller.MediaInfo /// The _protobuf serializer /// private readonly IProtobufSerializer _protobufSerializer; + private readonly IServerApplicationPaths _appPaths; /// /// Initializes a new instance of the class. @@ -77,7 +78,7 @@ namespace MediaBrowser.Controller.MediaInfo /// The protobuf serializer. /// The logger. /// zipClient - public FFMpegManager(Kernel kernel, IZipClient zipClient, IJsonSerializer jsonSerializer, IProtobufSerializer protobufSerializer, ILogger logger) + public FFMpegManager(Kernel kernel, IZipClient zipClient, IJsonSerializer jsonSerializer, IProtobufSerializer protobufSerializer, ILogManager logManager, IServerApplicationPaths appPaths) { if (kernel == null) { @@ -95,16 +96,13 @@ namespace MediaBrowser.Controller.MediaInfo { throw new ArgumentNullException("protobufSerializer"); } - if (logger == null) - { - throw new ArgumentNullException("logger"); - } _kernel = kernel; _zipClient = zipClient; _jsonSerializer = jsonSerializer; _protobufSerializer = protobufSerializer; - _logger = logger; + _appPaths = appPaths; + _logger = logManager.GetLogger("FFMpegManager"); // Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS | ErrorModes.SEM_NOALIGNMENTFAULTEXCEPT | ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX); @@ -223,7 +221,7 @@ namespace MediaBrowser.Controller.MediaInfo { if (_videoImagesDataPath == null) { - _videoImagesDataPath = Path.Combine(_kernel.ApplicationPaths.DataPath, "ffmpeg-video-images"); + _videoImagesDataPath = Path.Combine(_appPaths.DataPath, "ffmpeg-video-images"); if (!Directory.Exists(_videoImagesDataPath)) { @@ -249,7 +247,7 @@ namespace MediaBrowser.Controller.MediaInfo { if (_audioImagesDataPath == null) { - _audioImagesDataPath = Path.Combine(_kernel.ApplicationPaths.DataPath, "ffmpeg-audio-images"); + _audioImagesDataPath = Path.Combine(_appPaths.DataPath, "ffmpeg-audio-images"); if (!Directory.Exists(_audioImagesDataPath)) { @@ -275,7 +273,7 @@ namespace MediaBrowser.Controller.MediaInfo { if (_subtitleCachePath == null) { - _subtitleCachePath = Path.Combine(_kernel.ApplicationPaths.CachePath, "ffmpeg-subtitles"); + _subtitleCachePath = Path.Combine(_appPaths.CachePath, "ffmpeg-subtitles"); if (!Directory.Exists(_subtitleCachePath)) { @@ -302,7 +300,7 @@ namespace MediaBrowser.Controller.MediaInfo var filename = resource.Substring(resource.IndexOf(prefix, StringComparison.OrdinalIgnoreCase) + prefix.Length); - var versionedDirectoryPath = Path.Combine(_kernel.ApplicationPaths.MediaToolsPath, Path.GetFileNameWithoutExtension(filename)); + var versionedDirectoryPath = Path.Combine(_appPaths.MediaToolsPath, Path.GetFileNameWithoutExtension(filename)); if (!Directory.Exists(versionedDirectoryPath)) { diff --git a/MediaBrowser.Controller/Plugins/PluginSecurityManager.cs b/MediaBrowser.Controller/Plugins/PluginSecurityManager.cs deleted file mode 100644 index 3a097ba1ff..0000000000 --- a/MediaBrowser.Controller/Plugins/PluginSecurityManager.cs +++ /dev/null @@ -1,130 +0,0 @@ -using MediaBrowser.Common.Security; -using MediaBrowser.Model.Serialization; -using Mediabrowser.Model.Entities; -using Mediabrowser.PluginSecurity; -using MediaBrowser.Common.Kernel; -using MediaBrowser.Common.Net; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Plugins -{ - /// - /// Class PluginSecurityManager - /// - public class PluginSecurityManager : ISecurityManager - { - /// - /// The _is MB supporter - /// - private bool? _isMBSupporter; - /// - /// The _is MB supporter initialized - /// - private bool _isMBSupporterInitialized; - /// - /// The _is MB supporter sync lock - /// - private object _isMBSupporterSyncLock = new object(); - - /// - /// Gets a value indicating whether this instance is MB supporter. - /// - /// true if this instance is MB supporter; otherwise, false. - public bool IsMBSupporter - { - get - { - LazyInitializer.EnsureInitialized(ref _isMBSupporter, ref _isMBSupporterInitialized, ref _isMBSupporterSyncLock, () => GetRegistrationStatus("MBSupporter").Result.IsRegistered); - return _isMBSupporter.Value; - } - } - - private IHttpClient _httpClient; - private IJsonSerializer _jsonSerializer; - - /// - /// The _kernel - /// - private readonly IKernel _kernel; - - /// - /// Initializes a new instance of the class. - /// - /// The kernel. - public PluginSecurityManager(IKernel kernel, IHttpClient httpClient, IJsonSerializer jsonSerializer, IApplicationPaths appPaths) - { - if (kernel == null) - { - throw new ArgumentNullException("kernel"); - } - - if (httpClient == null) - { - throw new ArgumentNullException("httpClient"); - } - - _kernel = kernel; - _httpClient = httpClient; - _jsonSerializer = jsonSerializer; - MBRegistration.Init(appPaths); - } - - /// - /// Gets the registration status. - /// - /// The feature. - /// The MB2 equivalent. - /// Task{MBRegistrationRecord}. - public async Task GetRegistrationStatus(string feature, string mb2Equivalent = null) - { - return await MBRegistration.GetRegistrationStatus(_httpClient, _jsonSerializer, feature, mb2Equivalent).ConfigureAwait(false); - } - - /// - /// Gets or sets the supporter key. - /// - /// The supporter key. - public string SupporterKey - { - get { return MBRegistration.SupporterKey; } - set - { - if (value != MBRegistration.SupporterKey) - { - MBRegistration.SupporterKey = value; - // Clear this so it will re-evaluate - ResetSupporterInfo(); - // And we'll need to restart to re-evaluate the status of plug-ins - _kernel.NotifyPendingRestart(); - - } - } - } - - /// - /// Gets or sets the legacy key. - /// - /// The legacy key. - public string LegacyKey - { - get { return MBRegistration.LegacyKey; } - set - { - MBRegistration.LegacyKey = value; - // And we'll need to restart to re-evaluate the status of plug-ins - _kernel.NotifyPendingRestart(); - } - } - - /// - /// Resets the supporter info. - /// - private void ResetSupporterInfo() - { - _isMBSupporter = null; - _isMBSupporterInitialized = false; - } - } -} diff --git a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs index f6c6ed3036..a5823c60e2 100644 --- a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs +++ b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs @@ -1,4 +1,6 @@ -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Logging; using System; @@ -19,6 +21,12 @@ namespace MediaBrowser.Controller.Providers protected ILogger Logger { get; set; } protected ILogManager LogManager { get; set; } + /// + /// Gets the configuration manager. + /// + /// The configuration manager. + protected IServerConfigurationManager ConfigurationManager { get; private set; } + // Cache these since they will be used a lot /// /// The false task result @@ -103,10 +111,11 @@ namespace MediaBrowser.Controller.Providers /// /// Initializes a new instance of the class. /// - protected BaseMetadataProvider(ILogManager logManager) + protected BaseMetadataProvider(ILogManager logManager, IServerConfigurationManager configurationManager) { Logger = logManager.GetLogger(GetType().Name); LogManager = logManager; + ConfigurationManager = configurationManager; Initialize(); } diff --git a/MediaBrowser.Controller/Providers/FanartBaseProvider.cs b/MediaBrowser.Controller/Providers/FanartBaseProvider.cs index 7a38fbb7a8..548fbd5a69 100644 --- a/MediaBrowser.Controller/Providers/FanartBaseProvider.cs +++ b/MediaBrowser.Controller/Providers/FanartBaseProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; using System; using MediaBrowser.Model.Logging; @@ -35,7 +36,7 @@ namespace MediaBrowser.Controller.Providers /// protected const string APIKey = "5c6b04c68e904cfed1e6cbc9a9e683d4"; - protected FanartBaseProvider(ILogManager logManager) : base(logManager) + protected FanartBaseProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { } @@ -49,7 +50,7 @@ namespace MediaBrowser.Controller.Providers { if (item.DontFetchMeta) return false; - return DateTime.UtcNow > (providerInfo.LastRefreshed.AddDays(Kernel.Instance.Configuration.MetadataRefreshDays)) + return DateTime.UtcNow > (providerInfo.LastRefreshed.AddDays(ConfigurationManager.Configuration.MetadataRefreshDays)) && ShouldFetch(item, providerInfo); } diff --git a/MediaBrowser.Controller/Providers/FolderProviderFromXml.cs b/MediaBrowser.Controller/Providers/FolderProviderFromXml.cs index 1baa1ed558..45a47a58da 100644 --- a/MediaBrowser.Controller/Providers/FolderProviderFromXml.cs +++ b/MediaBrowser.Controller/Providers/FolderProviderFromXml.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; using System; using System.IO; @@ -13,7 +14,7 @@ namespace MediaBrowser.Controller.Providers /// public class FolderProviderFromXml : BaseMetadataProvider { - public FolderProviderFromXml(ILogManager logManager) : base(logManager) + public FolderProviderFromXml(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { } diff --git a/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs b/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs index ddf9e3334c..4b337aadce 100644 --- a/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs +++ b/MediaBrowser.Controller/Providers/ImageFromMediaLocationProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.IO; using MediaBrowser.Model.Entities; using System; @@ -16,7 +17,7 @@ namespace MediaBrowser.Controller.Providers /// public class ImageFromMediaLocationProvider : BaseMetadataProvider { - public ImageFromMediaLocationProvider(ILogManager logManager) : base(logManager) + public ImageFromMediaLocationProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { } diff --git a/MediaBrowser.Controller/Providers/ImagesByNameProvider.cs b/MediaBrowser.Controller/Providers/ImagesByNameProvider.cs index 1521b514ce..53ff94720e 100644 --- a/MediaBrowser.Controller/Providers/ImagesByNameProvider.cs +++ b/MediaBrowser.Controller/Providers/ImagesByNameProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.IO; using System; using System.Globalization; @@ -13,7 +14,7 @@ namespace MediaBrowser.Controller.Providers /// public class ImagesByNameProvider : ImageFromMediaLocationProvider { - public ImagesByNameProvider(ILogManager logManager) : base(logManager) + public ImagesByNameProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { } @@ -82,7 +83,7 @@ namespace MediaBrowser.Controller.Providers var name = item.Name ?? string.Empty; name = invalid.Aggregate(name, (current, c) => current.Replace(c.ToString(UsCulture), string.Empty)); - return Path.Combine(Kernel.Instance.ApplicationPaths.GeneralPath, name); + return Path.Combine(ConfigurationManager.ApplicationPaths.GeneralPath, name); } /// diff --git a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFMpegImageProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFMpegImageProvider.cs index 8ca080e9b8..902fdca27b 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFMpegImageProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFMpegImageProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Logging; namespace MediaBrowser.Controller.Providers.MediaInfo @@ -6,7 +7,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo public abstract class BaseFFMpegImageProvider : BaseFFMpegProvider where T : BaseItem { - protected BaseFFMpegImageProvider(ILogManager logManager) : base(logManager) + protected BaseFFMpegImageProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { } diff --git a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFMpegProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFMpegProvider.cs index e3f0d16a74..20f59b22de 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFMpegProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFMpegProvider.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; using System; @@ -14,7 +15,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo public abstract class BaseFFMpegProvider : BaseMetadataProvider where T : BaseItem { - protected BaseFFMpegProvider(ILogManager logManager) : base(logManager) + protected BaseFFMpegProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { } diff --git a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs index e0633d97dd..9fe2a6c01f 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/BaseFFProbeProvider.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.MediaInfo; using MediaBrowser.Controller.Persistence; @@ -19,7 +20,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo public abstract class BaseFFProbeProvider : BaseFFMpegProvider where T : BaseItem { - protected BaseFFProbeProvider(ILogManager logManager) : base(logManager) + protected BaseFFProbeProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager) { } @@ -35,7 +36,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo protected override void Initialize() { base.Initialize(); - FFProbeCache = new FileSystemRepository(Path.Combine(Kernel.Instance.ApplicationPaths.CachePath, CacheDirectoryName)); + FFProbeCache = new FileSystemRepository(Path.Combine(ConfigurationManager.ApplicationPaths.CachePath, CacheDirectoryName)); } /// diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFMpegAudioImageProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFMpegAudioImageProvider.cs index 581cd4e092..aedd035377 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/FFMpegAudioImageProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/FFMpegAudioImageProvider.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Model.Entities; using System; @@ -14,7 +15,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo /// public class FFMpegAudioImageProvider : BaseFFMpegImageProvider /// The iso manager. - public FfMpegVideoImageProvider(IIsoManager isoManager, ILogManager logManager) - : base(logManager) + /// The log manager. + /// The configuration manager. + public FfMpegVideoImageProvider(IIsoManager isoManager, ILogManager logManager, IServerConfigurationManager configurationManager) + : base(logManager, configurationManager) { _isoManager = isoManager; } diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs index 3786763861..603b7dcaae 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeAudioInfoProvider.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.MediaInfo; @@ -17,7 +18,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo /// public class FFProbeAudioInfoProvider : BaseFFProbeProvider