|
@@ -1,5 +1,4 @@
|
|
-using MediaBrowser.Common.IO;
|
|
|
|
-using MediaBrowser.Common.Kernel;
|
|
|
|
|
|
+using MediaBrowser.Common.Kernel;
|
|
using MediaBrowser.Common.Plugins;
|
|
using MediaBrowser.Common.Plugins;
|
|
using MediaBrowser.Controller.Drawing;
|
|
using MediaBrowser.Controller.Drawing;
|
|
using MediaBrowser.Controller.Entities;
|
|
using MediaBrowser.Controller.Entities;
|
|
@@ -16,14 +15,10 @@ using MediaBrowser.Controller.ScheduledTasks;
|
|
using MediaBrowser.Controller.Updates;
|
|
using MediaBrowser.Controller.Updates;
|
|
using MediaBrowser.Controller.Weather;
|
|
using MediaBrowser.Controller.Weather;
|
|
using MediaBrowser.Model.Configuration;
|
|
using MediaBrowser.Model.Configuration;
|
|
-using MediaBrowser.Model.IO;
|
|
|
|
using MediaBrowser.Model.Logging;
|
|
using MediaBrowser.Model.Logging;
|
|
-using MediaBrowser.Model.MediaInfo;
|
|
|
|
using MediaBrowser.Model.System;
|
|
using MediaBrowser.Model.System;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
-using System.ComponentModel.Composition;
|
|
|
|
-using System.ComponentModel.Composition.Hosting;
|
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
@@ -178,32 +173,34 @@ namespace MediaBrowser.Controller
|
|
get { return KernelContext.Server; }
|
|
get { return KernelContext.Server; }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Gets the list of Localized string files
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <value>The string files.</value>
|
|
|
|
+ public IEnumerable<LocalizedStringData> StringFiles { get; private set; }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the list of plugin configuration pages
|
|
/// Gets the list of plugin configuration pages
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The configuration pages.</value>
|
|
/// <value>The configuration pages.</value>
|
|
- [ImportMany(typeof(IPluginConfigurationPage))]
|
|
|
|
public IEnumerable<IPluginConfigurationPage> PluginConfigurationPages { get; private set; }
|
|
public IEnumerable<IPluginConfigurationPage> PluginConfigurationPages { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the intro providers.
|
|
/// Gets the intro providers.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The intro providers.</value>
|
|
/// <value>The intro providers.</value>
|
|
- [ImportMany(typeof(IIntroProvider))]
|
|
|
|
public IEnumerable<IIntroProvider> IntroProviders { get; private set; }
|
|
public IEnumerable<IIntroProvider> IntroProviders { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the list of currently registered weather prvoiders
|
|
/// Gets the list of currently registered weather prvoiders
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The weather providers.</value>
|
|
/// <value>The weather providers.</value>
|
|
- [ImportMany(typeof(IWeatherProvider))]
|
|
|
|
public IEnumerable<IWeatherProvider> WeatherProviders { get; private set; }
|
|
public IEnumerable<IWeatherProvider> WeatherProviders { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the list of currently registered metadata prvoiders
|
|
/// Gets the list of currently registered metadata prvoiders
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The metadata providers enumerable.</value>
|
|
/// <value>The metadata providers enumerable.</value>
|
|
- [ImportMany(typeof(BaseMetadataProvider))]
|
|
|
|
public BaseMetadataProvider[] MetadataProviders { get; private set; }
|
|
public BaseMetadataProvider[] MetadataProviders { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -211,28 +208,24 @@ namespace MediaBrowser.Controller
|
|
/// Image processors are specialized metadata providers that run after the normal ones
|
|
/// Image processors are specialized metadata providers that run after the normal ones
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The image enhancers.</value>
|
|
/// <value>The image enhancers.</value>
|
|
- [ImportMany(typeof(BaseImageEnhancer))]
|
|
|
|
- public BaseImageEnhancer[] ImageEnhancers { get; private set; }
|
|
|
|
|
|
+ public IEnumerable<IImageEnhancer> ImageEnhancers { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the list of currently registered entity resolvers
|
|
/// Gets the list of currently registered entity resolvers
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The entity resolvers enumerable.</value>
|
|
/// <value>The entity resolvers enumerable.</value>
|
|
- [ImportMany(typeof(IBaseItemResolver))]
|
|
|
|
- internal IBaseItemResolver[] EntityResolvers { get; private set; }
|
|
|
|
|
|
+ internal IEnumerable<IBaseItemResolver> EntityResolvers { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the list of BasePluginFolders added by plugins
|
|
/// Gets the list of BasePluginFolders added by plugins
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The plugin folders.</value>
|
|
/// <value>The plugin folders.</value>
|
|
- [ImportMany(typeof(BasePluginFolder))]
|
|
|
|
- internal IEnumerable<BasePluginFolder> PluginFolders { get; private set; }
|
|
|
|
|
|
+ internal IEnumerable<IVirtualFolderCreator> PluginFolderCreators { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the list of available user repositories
|
|
/// Gets the list of available user repositories
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The user repositories.</value>
|
|
/// <value>The user repositories.</value>
|
|
- [ImportMany(typeof(IUserRepository))]
|
|
|
|
private IEnumerable<IUserRepository> UserRepositories { get; set; }
|
|
private IEnumerable<IUserRepository> UserRepositories { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -251,7 +244,6 @@ namespace MediaBrowser.Controller
|
|
/// Gets the list of available item repositories
|
|
/// Gets the list of available item repositories
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The item repositories.</value>
|
|
/// <value>The item repositories.</value>
|
|
- [ImportMany(typeof(IItemRepository))]
|
|
|
|
private IEnumerable<IItemRepository> ItemRepositories { get; set; }
|
|
private IEnumerable<IItemRepository> ItemRepositories { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -264,22 +256,19 @@ namespace MediaBrowser.Controller
|
|
/// Gets the list of available item repositories
|
|
/// Gets the list of available item repositories
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The user data repositories.</value>
|
|
/// <value>The user data repositories.</value>
|
|
- [ImportMany(typeof(IUserDataRepository))]
|
|
|
|
private IEnumerable<IUserDataRepository> UserDataRepositories { get; set; }
|
|
private IEnumerable<IUserDataRepository> UserDataRepositories { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the list of available DisplayPreferencesRepositories
|
|
/// Gets the list of available DisplayPreferencesRepositories
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The display preferences repositories.</value>
|
|
/// <value>The display preferences repositories.</value>
|
|
- [ImportMany(typeof(IDisplayPreferencesRepository))]
|
|
|
|
private IEnumerable<IDisplayPreferencesRepository> DisplayPreferencesRepositories { get; set; }
|
|
private IEnumerable<IDisplayPreferencesRepository> DisplayPreferencesRepositories { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the list of entity resolution ignore rules
|
|
/// Gets the list of entity resolution ignore rules
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <value>The entity resolution ignore rules.</value>
|
|
/// <value>The entity resolution ignore rules.</value>
|
|
- [ImportMany(typeof(BaseResolutionIgnoreRule))]
|
|
|
|
- internal IEnumerable<BaseResolutionIgnoreRule> EntityResolutionIgnoreRules { get; private set; }
|
|
|
|
|
|
+ internal IEnumerable<IResolutionIgnoreRule> EntityResolutionIgnoreRules { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Gets the active user data repository
|
|
/// Gets the active user data repository
|
|
@@ -302,48 +291,16 @@ namespace MediaBrowser.Controller
|
|
get { return 7359; }
|
|
get { return 7359; }
|
|
}
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
|
- /// Gets or sets the zip client.
|
|
|
|
- /// </summary>
|
|
|
|
- /// <value>The zip client.</value>
|
|
|
|
- private IZipClient ZipClient { get; set; }
|
|
|
|
-
|
|
|
|
- /// <summary>
|
|
|
|
- /// Gets or sets the bluray examiner.
|
|
|
|
- /// </summary>
|
|
|
|
- /// <value>The bluray examiner.</value>
|
|
|
|
- private IBlurayExaminer BlurayExaminer { get; set; }
|
|
|
|
-
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Creates a kernel based on a Data path, which is akin to our current programdata path
|
|
/// Creates a kernel based on a Data path, which is akin to our current programdata path
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="appHost">The app host.</param>
|
|
/// <param name="appHost">The app host.</param>
|
|
- /// <param name="isoManager">The iso manager.</param>
|
|
|
|
- /// <param name="zipClient">The zip client.</param>
|
|
|
|
- /// <param name="blurayExaminer">The bluray examiner.</param>
|
|
|
|
/// <param name="logger">The logger.</param>
|
|
/// <param name="logger">The logger.</param>
|
|
/// <exception cref="System.ArgumentNullException">isoManager</exception>
|
|
/// <exception cref="System.ArgumentNullException">isoManager</exception>
|
|
- public Kernel(IApplicationHost appHost, IIsoManager isoManager, IZipClient zipClient, IBlurayExaminer blurayExaminer, ILogger logger)
|
|
|
|
- : base(appHost, isoManager, logger)
|
|
|
|
|
|
+ public Kernel(IApplicationHost appHost, ILogger logger)
|
|
|
|
+ : base(appHost, logger)
|
|
{
|
|
{
|
|
- if (isoManager == null)
|
|
|
|
- {
|
|
|
|
- throw new ArgumentNullException("isoManager");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (zipClient == null)
|
|
|
|
- {
|
|
|
|
- throw new ArgumentNullException("zipClient");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (blurayExaminer == null)
|
|
|
|
- {
|
|
|
|
- throw new ArgumentNullException("blurayExaminer");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
Instance = this;
|
|
Instance = this;
|
|
- ZipClient = zipClient;
|
|
|
|
- BlurayExaminer = blurayExaminer;
|
|
|
|
|
|
|
|
// For now there's no real way to inject this properly
|
|
// For now there's no real way to inject this properly
|
|
BaseItem.Logger = logger;
|
|
BaseItem.Logger = logger;
|
|
@@ -356,13 +313,43 @@ namespace MediaBrowser.Controller
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Composes the exported values.
|
|
/// Composes the exported values.
|
|
/// </summary>
|
|
/// </summary>
|
|
- /// <param name="container">The container.</param>
|
|
|
|
- protected override void ComposeExportedValues(CompositionContainer container)
|
|
|
|
|
|
+ protected override void RegisterExportedValues()
|
|
{
|
|
{
|
|
- base.ComposeExportedValues(container);
|
|
|
|
|
|
+ ApplicationHost.Register(this);
|
|
|
|
+
|
|
|
|
+ base.RegisterExportedValues();
|
|
|
|
+ }
|
|
|
|
|
|
- container.ComposeExportedValue("kernel", this);
|
|
|
|
- container.ComposeExportedValue("blurayExaminer", BlurayExaminer);
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Composes the parts with ioc container.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="allTypes">All types.</param>
|
|
|
|
+ protected override void FindParts(Type[] allTypes)
|
|
|
|
+ {
|
|
|
|
+ InstallationManager = (InstallationManager)ApplicationHost.CreateInstance(typeof(InstallationManager));
|
|
|
|
+ FFMpegManager = (FFMpegManager)ApplicationHost.CreateInstance(typeof(FFMpegManager));
|
|
|
|
+ LibraryManager = (LibraryManager)ApplicationHost.CreateInstance(typeof(LibraryManager));
|
|
|
|
+ UserManager = (UserManager)ApplicationHost.CreateInstance(typeof(UserManager));
|
|
|
|
+ ImageManager = (ImageManager)ApplicationHost.CreateInstance(typeof(ImageManager));
|
|
|
|
+ ProviderManager = (ProviderManager)ApplicationHost.CreateInstance(typeof(ProviderManager));
|
|
|
|
+ UserDataManager = (UserDataManager)ApplicationHost.CreateInstance(typeof(UserDataManager));
|
|
|
|
+ PluginSecurityManager = (PluginSecurityManager)ApplicationHost.CreateInstance(typeof(PluginSecurityManager));
|
|
|
|
+
|
|
|
|
+ base.FindParts(allTypes);
|
|
|
|
+
|
|
|
|
+ EntityResolutionIgnoreRules = GetExports<IResolutionIgnoreRule>(allTypes);
|
|
|
|
+ UserDataRepositories = GetExports<IUserDataRepository>(allTypes);
|
|
|
|
+ UserRepositories = GetExports<IUserRepository>(allTypes);
|
|
|
|
+ DisplayPreferencesRepositories = GetExports<IDisplayPreferencesRepository>(allTypes);
|
|
|
|
+ ItemRepositories = GetExports<IItemRepository>(allTypes);
|
|
|
|
+ WeatherProviders = GetExports<IWeatherProvider>(allTypes);
|
|
|
|
+ IntroProviders = GetExports<IIntroProvider>(allTypes);
|
|
|
|
+ PluginConfigurationPages = GetExports<IPluginConfigurationPage>(allTypes);
|
|
|
|
+ ImageEnhancers = GetExports<IImageEnhancer>(allTypes).OrderBy(e => e.Priority).ToArray();
|
|
|
|
+ PluginFolderCreators = GetExports<IVirtualFolderCreator>(allTypes);
|
|
|
|
+ StringFiles = GetExports<LocalizedStringData>(allTypes);
|
|
|
|
+ EntityResolvers = GetExports<IBaseItemResolver>(allTypes).OrderBy(e => e.Priority).ToArray();
|
|
|
|
+ MetadataProviders = GetExports<BaseMetadataProvider>(allTypes).OrderBy(e => e.Priority).ToArray();
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -371,24 +358,14 @@ namespace MediaBrowser.Controller
|
|
/// <returns>Task.</returns>
|
|
/// <returns>Task.</returns>
|
|
protected override async Task ReloadInternal()
|
|
protected override async Task ReloadInternal()
|
|
{
|
|
{
|
|
- Logger.Info("Extracting tools");
|
|
|
|
-
|
|
|
|
// Reset these so that they can be lazy loaded again
|
|
// Reset these so that they can be lazy loaded again
|
|
Users = null;
|
|
Users = null;
|
|
RootFolder = null;
|
|
RootFolder = null;
|
|
|
|
|
|
- ReloadResourcePools();
|
|
|
|
- InstallationManager = new InstallationManager(this, ZipClient, Logger);
|
|
|
|
- LibraryManager = new LibraryManager(this, Logger);
|
|
|
|
- UserManager = new UserManager(this, Logger);
|
|
|
|
- FFMpegManager = new FFMpegManager(this, ZipClient, Logger);
|
|
|
|
- ImageManager = new ImageManager(this, Logger);
|
|
|
|
- ProviderManager = new ProviderManager(this, Logger);
|
|
|
|
- UserDataManager = new UserDataManager(this, Logger);
|
|
|
|
- PluginSecurityManager = new PluginSecurityManager(this);
|
|
|
|
-
|
|
|
|
await base.ReloadInternal().ConfigureAwait(false);
|
|
await base.ReloadInternal().ConfigureAwait(false);
|
|
|
|
|
|
|
|
+ ReloadResourcePools();
|
|
|
|
+
|
|
ReloadFileSystemManager();
|
|
ReloadFileSystemManager();
|
|
|
|
|
|
await UserManager.RefreshUsersMetadata(CancellationToken.None).ConfigureAwait(false);
|
|
await UserManager.RefreshUsersMetadata(CancellationToken.None).ConfigureAwait(false);
|
|
@@ -456,15 +433,6 @@ namespace MediaBrowser.Controller
|
|
DisplayPreferencesRepository = GetRepository(DisplayPreferencesRepositories, Configuration.DisplayPreferencesRepository);
|
|
DisplayPreferencesRepository = GetRepository(DisplayPreferencesRepositories, Configuration.DisplayPreferencesRepository);
|
|
var displayPreferencesRepoTask = DisplayPreferencesRepository.Initialize();
|
|
var displayPreferencesRepoTask = DisplayPreferencesRepository.Initialize();
|
|
|
|
|
|
- // Sort the resolvers by priority
|
|
|
|
- EntityResolvers = EntityResolvers.OrderBy(e => e.Priority).ToArray();
|
|
|
|
-
|
|
|
|
- // Sort the providers by priority
|
|
|
|
- MetadataProviders = MetadataProviders.OrderBy(e => e.Priority).ToArray();
|
|
|
|
-
|
|
|
|
- // Sort the image processors by priority
|
|
|
|
- ImageEnhancers = ImageEnhancers.OrderBy(e => e.Priority).ToArray();
|
|
|
|
-
|
|
|
|
await Task.WhenAll(itemRepoTask, userRepoTask, userDataRepoTask, displayPreferencesRepoTask).ConfigureAwait(false);
|
|
await Task.WhenAll(itemRepoTask, userRepoTask, userDataRepoTask, displayPreferencesRepoTask).ConfigureAwait(false);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -503,7 +471,7 @@ namespace MediaBrowser.Controller
|
|
{
|
|
{
|
|
DisposeFileSystemManager();
|
|
DisposeFileSystemManager();
|
|
|
|
|
|
- FileSystemManager = new FileSystemManager(this, Logger);
|
|
|
|
|
|
+ FileSystemManager = new FileSystemManager(this, Logger, TaskManager);
|
|
FileSystemManager.StartWatchers();
|
|
FileSystemManager.StartWatchers();
|
|
}
|
|
}
|
|
|
|
|