From 08d9004d8f361aaf13756cab70fc659e5fbb775c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 3 Jun 2013 14:15:35 -0400 Subject: a little more kernel consolidation --- MediaBrowser.Controller/Drawing/ImageManager.cs | 11 ++++- MediaBrowser.Controller/Dto/DtoBuilder.cs | 2 +- MediaBrowser.Controller/IServerApplicationHost.cs | 12 ++++++ MediaBrowser.Controller/Kernel.cs | 47 +--------------------- .../Localization/LocalizedStrings.cs | 11 ++++- 5 files changed, 33 insertions(+), 50 deletions(-) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Drawing/ImageManager.cs b/MediaBrowser.Controller/Drawing/ImageManager.cs index 807c2d1e0c..b728fe71f6 100644 --- a/MediaBrowser.Controller/Drawing/ImageManager.cs +++ b/MediaBrowser.Controller/Drawing/ImageManager.cs @@ -25,6 +25,13 @@ namespace MediaBrowser.Controller.Drawing /// public class ImageManager { + /// + /// Gets the list of currently registered image processors + /// Image processors are specialized metadata providers that run after the normal ones + /// + /// The image enhancers. + public IEnumerable ImageEnhancers { get; set; } + /// /// Gets the image size cache. /// @@ -120,7 +127,7 @@ namespace MediaBrowser.Controller.Drawing originalImagePath = await GetCroppedImage(originalImagePath, dateModified).ConfigureAwait(false); } - var supportedEnhancers = _kernel.ImageEnhancers.Where(i => + var supportedEnhancers = ImageEnhancers.Where(i => { try { @@ -621,7 +628,7 @@ namespace MediaBrowser.Controller.Drawing var dateModified = GetImageDateModified(item, imagePath); - var supportedEnhancers = _kernel.ImageEnhancers.Where(i => + var supportedEnhancers = ImageEnhancers.Where(i => { try { diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs index 5492485951..412b911f4f 100644 --- a/MediaBrowser.Controller/Dto/DtoBuilder.cs +++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs @@ -182,7 +182,7 @@ namespace MediaBrowser.Controller.Dto return; } - var supportedEnhancers = Kernel.Instance.ImageEnhancers.Where(i => + var supportedEnhancers = Kernel.Instance.ImageManager.ImageEnhancers.Where(i => { try { diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.cs index 042ef30ec4..f96c2536e6 100644 --- a/MediaBrowser.Controller/IServerApplicationHost.cs +++ b/MediaBrowser.Controller/IServerApplicationHost.cs @@ -13,5 +13,17 @@ namespace MediaBrowser.Controller /// /// SystemInfo. SystemInfo GetSystemInfo(); + + /// + /// Gets the name of the web application. + /// + /// The name of the web application. + string WebApplicationName { get; } + + /// + /// Gets the HTTP server URL prefix. + /// + /// The HTTP server URL prefix. + string HttpServerUrlPrefix { get; } } } diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index 3e1c21a505..d7b24a0cc7 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -1,8 +1,5 @@ -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Drawing; -using MediaBrowser.Controller.Localization; +using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.MediaInfo; -using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Weather; using System.Collections.Generic; @@ -31,58 +28,18 @@ namespace MediaBrowser.Controller /// The FFMPEG controller. public FFMpegManager FFMpegManager { get; set; } - /// - /// Gets the name of the web application that can be used for url building. - /// All api urls will be of the form {protocol}://{host}:{port}/{appname}/... - /// - /// The name of the web application. - public string WebApplicationName - { - get { return "mediabrowser"; } - } - - /// - /// Gets the HTTP server URL prefix. - /// - /// The HTTP server URL prefix. - public virtual string HttpServerUrlPrefix - { - get - { - return "http://+:" + _configurationManager.Configuration.HttpServerPortNumber + "/" + WebApplicationName + "/"; - } - } - - /// - /// Gets the list of Localized string files - /// - /// The string files. - public IEnumerable StringFiles { get; set; } - /// /// Gets the list of currently registered weather prvoiders /// /// The weather providers. public IEnumerable WeatherProviders { get; set; } - /// - /// Gets the list of currently registered image processors - /// Image processors are specialized metadata providers that run after the normal ones - /// - /// The image enhancers. - public IEnumerable ImageEnhancers { get; set; } - - private readonly IServerConfigurationManager _configurationManager; - /// /// Creates a kernel based on a Data path, which is akin to our current programdata path /// - /// The configuration manager. - public Kernel(IServerConfigurationManager configurationManager) + public Kernel() { Instance = this; - - _configurationManager = configurationManager; } } } diff --git a/MediaBrowser.Controller/Localization/LocalizedStrings.cs b/MediaBrowser.Controller/Localization/LocalizedStrings.cs index 31dcb2e9f4..bd82d39ea0 100644 --- a/MediaBrowser.Controller/Localization/LocalizedStrings.cs +++ b/MediaBrowser.Controller/Localization/LocalizedStrings.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Concurrent; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; @@ -13,7 +14,13 @@ namespace MediaBrowser.Controller.Localization public class LocalizedStrings { public static IServerApplicationPaths ApplicationPaths; - + + /// + /// Gets the list of Localized string files + /// + /// The string files. + public static IEnumerable StringFiles { get; set; } + /// /// The base prefix /// @@ -42,7 +49,7 @@ namespace MediaBrowser.Controller.Localization { _appPaths = appPaths; - foreach (var stringObject in Kernel.Instance.StringFiles) + foreach (var stringObject in StringFiles) { AddStringData(LoadFromFile(GetFileName(stringObject),stringObject.GetType())); } -- cgit v1.2.3