From af7aa597c35279e286ee88641854db69744e7b15 Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Thu, 28 Feb 2013 14:32:41 -0500 Subject: referenced core plugins, fixed some dashboard issues, extracted library manager --- MediaBrowser.Controller/Kernel.cs | 96 ++------------------------------------- 1 file changed, 5 insertions(+), 91 deletions(-) (limited to 'MediaBrowser.Controller/Kernel.cs') diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index e41b7c4877..46f4a33293 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -36,12 +36,6 @@ namespace MediaBrowser.Controller /// The instance. public static Kernel Instance { get; private set; } - /// - /// Gets the library manager. - /// - /// The library manager. - public LibraryManager LibraryManager { get; private set; } - /// /// Gets the image manager. /// @@ -72,40 +66,6 @@ namespace MediaBrowser.Controller /// The provider manager. public ProviderManager ProviderManager { get; private set; } - /// - /// The _root folder - /// - private AggregateFolder _rootFolder; - /// - /// The _root folder sync lock - /// - private object _rootFolderSyncLock = new object(); - /// - /// The _root folder initialized - /// - private bool _rootFolderInitialized; - /// - /// Gets the root folder. - /// - /// The root folder. - public AggregateFolder RootFolder - { - get - { - LazyInitializer.EnsureInitialized(ref _rootFolder, ref _rootFolderInitialized, ref _rootFolderSyncLock, LibraryManager.CreateRootFolder); - return _rootFolder; - } - private set - { - _rootFolder = value; - - if (value == null) - { - _rootFolderInitialized = false; - } - } - } - /// /// Gets the kernel context. /// @@ -156,13 +116,13 @@ namespace MediaBrowser.Controller /// Gets the list of currently registered entity resolvers /// /// The entity resolvers enumerable. - internal IEnumerable EntityResolvers { get; private set; } + public IEnumerable EntityResolvers { get; private set; } /// /// Gets the list of BasePluginFolders added by plugins /// /// The plugin folders. - internal IEnumerable PluginFolderCreators { get; private set; } + public IEnumerable PluginFolderCreators { get; private set; } /// /// Gets the list of available user repositories @@ -210,7 +170,7 @@ namespace MediaBrowser.Controller /// Gets the list of entity resolution ignore rules /// /// The entity resolution ignore rules. - internal IEnumerable EntityResolutionIgnoreRules { get; private set; } + public IEnumerable EntityResolutionIgnoreRules { get; private set; } /// /// Gets the active user data repository @@ -233,7 +193,6 @@ namespace MediaBrowser.Controller /// The app host. /// The app paths. /// The XML serializer. - /// The task manager. /// The logger. /// isoManager public Kernel(IApplicationHost appHost, IServerApplicationPaths appPaths, IXmlSerializer xmlSerializer, ILogger logger) @@ -255,11 +214,11 @@ namespace MediaBrowser.Controller protected override void FindParts() { // For now there's no real way to inject this properly + BaseItem.LibraryManager = ApplicationHost.Resolve(); User.UserManager = ApplicationHost.Resolve(); InstallationManager = (InstallationManager)ApplicationHost.CreateInstance(typeof(InstallationManager)); FFMpegManager = (FFMpegManager)ApplicationHost.CreateInstance(typeof(FFMpegManager)); - LibraryManager = (LibraryManager)ApplicationHost.CreateInstance(typeof(LibraryManager)); ImageManager = (ImageManager)ApplicationHost.CreateInstance(typeof(ImageManager)); ProviderManager = (ProviderManager)ApplicationHost.CreateInstance(typeof(ProviderManager)); SecurityManager = (PluginSecurityManager)ApplicationHost.CreateInstance(typeof(PluginSecurityManager)); @@ -287,9 +246,6 @@ namespace MediaBrowser.Controller /// Task. protected override async Task ReloadInternal() { - // Reset these so that they can be lazy loaded again - RootFolder = null; - await base.ReloadInternal().ConfigureAwait(false); ReloadResourcePools(); @@ -399,52 +355,10 @@ namespace MediaBrowser.Controller { DisposeFileSystemManager(); - FileSystemManager = new FileSystemManager(this, Logger, ApplicationHost.Resolve()); + FileSystemManager = new FileSystemManager(this, Logger, ApplicationHost.Resolve(), ApplicationHost.Resolve()); FileSystemManager.StartWatchers(); } - /// - /// Finds a library item by Id and UserId. - /// - /// The id. - /// The user id. - /// The user manager. - /// BaseItem. - /// id - public BaseItem GetItemById(Guid id, Guid userId, IUserManager userManager) - { - if (id == Guid.Empty) - { - throw new ArgumentNullException("id"); - } - - if (userId == Guid.Empty) - { - throw new ArgumentNullException("userId"); - } - - var user = userManager.GetUserById(userId); - var userRoot = user.RootFolder; - - return userRoot.FindItemById(id, user); - } - - /// - /// Gets the item by id. - /// - /// The id. - /// BaseItem. - /// id - public BaseItem GetItemById(Guid id) - { - if (id == Guid.Empty) - { - throw new ArgumentNullException("id"); - } - - return RootFolder.FindItemById(id, null); - } - /// /// Completely overwrites the current configuration with a new copy /// -- cgit v1.2.3