diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-21 01:02:10 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-21 01:02:10 -0500 |
| commit | ae4ffa75be378497d8db210c6864cde40f7c75f9 (patch) | |
| tree | 14d7a0610ff5117f3ea92ddaee71c219bbbc4865 | |
| parent | acf5b0b6ed173a3a9540d0585bd491a119d524cf (diff) | |
isolated weather and moved drawing classes up to the controller project
21 files changed, 252 insertions, 81 deletions
diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index 5fbd751cd..546cf4492 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -39,10 +39,6 @@ <Reference Include="MoreLinq"> <HintPath>..\packages\morelinq.1.0.15631-beta\lib\net35\MoreLinq.dll</HintPath> </Reference> - <Reference Include="protobuf-net, Version=2.0.0.621, Culture=neutral, PublicKeyToken=257b51d87d2e4d67, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\packages\protobuf-net.2.0.0.621\lib\net40\protobuf-net.dll</HintPath> - </Reference> <Reference Include="ServiceStack"> <HintPath>..\packages\ServiceStack.3.9.37\lib\net35\ServiceStack.dll</HintPath> </Reference> diff --git a/MediaBrowser.Api/packages.config b/MediaBrowser.Api/packages.config index c8efad540..ee47118ad 100644 --- a/MediaBrowser.Api/packages.config +++ b/MediaBrowser.Api/packages.config @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="morelinq" version="1.0.15631-beta" targetFramework="net45" /> - <package id="protobuf-net" version="2.0.0.621" targetFramework="net45" /> <package id="ServiceStack" version="3.9.37" targetFramework="net45" /> <package id="ServiceStack.Common" version="3.9.37" targetFramework="net45" /> <package id="ServiceStack.OrmLite.SqlServer" version="3.9.37" targetFramework="net45" /> diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs index 95e6d05d6..088acbedd 100644 --- a/MediaBrowser.Common/Kernel/BaseKernel.cs +++ b/MediaBrowser.Common/Kernel/BaseKernel.cs @@ -441,7 +441,7 @@ namespace MediaBrowser.Common.Kernel AddLogTarget(logFile, "ApplicationLogFile"); - Logging.Logger.LoggerInstance = Logging.LogManager.GetLogger("Global"); + Logging.Logger.LoggerInstance = Logging.LogManager.GetLogger("App"); OnLoggerLoaded(); } @@ -484,6 +484,7 @@ namespace MediaBrowser.Common.Kernel CompositionContainer = MefUtils.GetSafeCompositionContainer(Assemblies.Select(i => new AssemblyCatalog(i))); CompositionContainer.ComposeExportedValue("kernel", this); + CompositionContainer.ComposeExportedValue("logger", Logging.LogManager.GetLogger("App")); CompositionContainer.ComposeParts(this); diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index 21502f5c5..8929f4bd5 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -95,7 +95,6 @@ <Reference Include="System.Configuration" /> <Reference Include="System.Core" /> <Reference Include="System.Deployment" /> - <Reference Include="System.Drawing" /> <Reference Include="System.Management" /> <Reference Include="System.Net" /> <Reference Include="System.Net.Http" /> @@ -118,7 +117,6 @@ <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xaml" /> <Reference Include="System.Xml.Linq" /> - <Reference Include="System.Data.DataSetExtensions" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> @@ -129,8 +127,6 @@ <Compile Include="Api\ScheduledTasks\ScheduledTaskService.cs" /> <Compile Include="Api\ScheduledTasks\ScheduledTasksWebSocketListener.cs" /> <Compile Include="Api\SystemInfoWebSocketListener.cs" /> - <Compile Include="Drawing\ImageExtensions.cs" /> - <Compile Include="Drawing\ImageHeader.cs" /> <Compile Include="Events\EventHelper.cs" /> <Compile Include="Extensions\BaseExtensions.cs" /> <Compile Include="Events\GenericEventArgs.cs" /> diff --git a/MediaBrowser.Common/Drawing/ImageExtensions.cs b/MediaBrowser.Controller/Drawing/ImageExtensions.cs index 02c0f93dd..cecbfe74a 100644 --- a/MediaBrowser.Common/Drawing/ImageExtensions.cs +++ b/MediaBrowser.Controller/Drawing/ImageExtensions.cs @@ -5,7 +5,7 @@ using System.Drawing.Imaging; using System.IO; using System.Linq; -namespace MediaBrowser.Common.Drawing +namespace MediaBrowser.Controller.Drawing { /// <summary> /// Class ImageExtensions diff --git a/MediaBrowser.Common/Drawing/ImageHeader.cs b/MediaBrowser.Controller/Drawing/ImageHeader.cs index 97121cbc8..7cc63eee9 100644 --- a/MediaBrowser.Common/Drawing/ImageHeader.cs +++ b/MediaBrowser.Controller/Drawing/ImageHeader.cs @@ -5,7 +5,7 @@ using System.Drawing; using System.IO; using System.Linq; -namespace MediaBrowser.Common.Drawing +namespace MediaBrowser.Controller.Drawing { /// <summary> /// Taken from http://stackoverflow.com/questions/111345/getting-image-dimensions-without-reading-the-entire-file/111349 diff --git a/MediaBrowser.Controller/Drawing/ImageManager.cs b/MediaBrowser.Controller/Drawing/ImageManager.cs index b493a97af..6dd641cba 100644 --- a/MediaBrowser.Controller/Drawing/ImageManager.cs +++ b/MediaBrowser.Controller/Drawing/ImageManager.cs @@ -1,10 +1,8 @@ -using MediaBrowser.Common.Drawing; -using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; using MediaBrowser.Common.Kernel; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs index 22c241fd4..f8f48d8de 100644 --- a/MediaBrowser.Controller/Kernel.cs +++ b/MediaBrowser.Controller/Kernel.cs @@ -192,8 +192,8 @@ namespace MediaBrowser.Controller /// Gets the list of currently registered weather prvoiders /// </summary> /// <value>The weather providers.</value> - [ImportMany(typeof(BaseWeatherProvider))] - public IEnumerable<BaseWeatherProvider> WeatherProviders { get; private set; } + [ImportMany(typeof(IWeatherProvider))] + public IEnumerable<IWeatherProvider> WeatherProviders { get; private set; } /// <summary> /// Gets the list of currently registered metadata prvoiders diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index f911f190d..da2bc23e8 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -76,6 +76,8 @@ <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> + <Compile Include="Drawing\ImageExtensions.cs" /> + <Compile Include="Drawing\ImageHeader.cs" /> <Compile Include="Drawing\ImageManager.cs" /> <Compile Include="Entities\AggregateFolder.cs" /> <Compile Include="Entities\Audio\Audio.cs" /> @@ -197,8 +199,7 @@ <Compile Include="Sorting\BaseItemComparer.cs" /> <Compile Include="Sorting\SortOrder.cs" /> <Compile Include="Updates\InstallationManager.cs" /> - <Compile Include="Weather\BaseWeatherProvider.cs" /> - <Compile Include="Weather\WeatherProvider.cs" /> + <Compile Include="Weather\IWeatherProvider.cs" /> <Compile Include="Providers\BaseItemXmlParser.cs" /> </ItemGroup> <ItemGroup> diff --git a/MediaBrowser.Controller/Plugins/PluginSecurityManager.cs b/MediaBrowser.Controller/Plugins/PluginSecurityManager.cs index 341e3582b..5dbd6cbc6 100644 --- a/MediaBrowser.Controller/Plugins/PluginSecurityManager.cs +++ b/MediaBrowser.Controller/Plugins/PluginSecurityManager.cs @@ -6,12 +6,28 @@ using System.Threading.Tasks; namespace MediaBrowser.Controller.Plugins { + /// <summary> + /// Class PluginSecurityManager + /// </summary> public class PluginSecurityManager : BaseManager<Kernel> { + /// <summary> + /// The _is MB supporter + /// </summary> private bool? _isMBSupporter; + /// <summary> + /// The _is MB supporter initialized + /// </summary> private bool _isMBSupporterInitialized; + /// <summary> + /// The _is MB supporter sync lock + /// </summary> private object _isMBSupporterSyncLock = new object(); - + + /// <summary> + /// Gets a value indicating whether this instance is MB supporter. + /// </summary> + /// <value><c>true</c> if this instance is MB supporter; otherwise, <c>false</c>.</value> public bool IsMBSupporter { get @@ -21,15 +37,29 @@ namespace MediaBrowser.Controller.Plugins } } + /// <summary> + /// Initializes a new instance of the <see cref="PluginSecurityManager" /> class. + /// </summary> + /// <param name="kernel">The kernel.</param> public PluginSecurityManager(Kernel kernel) : base(kernel) { } + /// <summary> + /// Gets the registration status. + /// </summary> + /// <param name="feature">The feature.</param> + /// <param name="mb2Equivalent">The MB2 equivalent.</param> + /// <returns>Task{MBRegistrationRecord}.</returns> public async Task<MBRegistrationRecord> GetRegistrationStatus(string feature, string mb2Equivalent = null) { return await MBRegistration.GetRegistrationStatus(feature, mb2Equivalent).ConfigureAwait(false); } + /// <summary> + /// Gets or sets the supporter key. + /// </summary> + /// <value>The supporter key.</value> public string SupporterKey { get { return MBRegistration.SupporterKey; } @@ -46,6 +76,10 @@ namespace MediaBrowser.Controller.Plugins } } + /// <summary> + /// Gets or sets the legacy key. + /// </summary> + /// <value>The legacy key.</value> public string LegacyKey { get { return MBRegistration.LegacyKey; } @@ -56,6 +90,9 @@ namespace MediaBrowser.Controller.Plugins } } + /// <summary> + /// Resets the supporter info. + /// </summary> private void ResetSupporterInfo() { _isMBSupporter = null; diff --git a/MediaBrowser.Controller/Weather/BaseWeatherProvider.cs b/MediaBrowser.Controller/Weather/BaseWeatherProvider.cs deleted file mode 100644 index 4ae7a3991..000000000 --- a/MediaBrowser.Controller/Weather/BaseWeatherProvider.cs +++ /dev/null @@ -1,37 +0,0 @@ -using MediaBrowser.Model.Weather; -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Weather -{ - /// <summary> - /// Class BaseWeatherProvider - /// </summary> - public abstract class BaseWeatherProvider : IDisposable - { - /// <summary> - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// </summary> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// <summary> - /// Releases unmanaged and - optionally - managed resources. - /// </summary> - /// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool dispose) - { - } - - /// <summary> - /// Gets the weather info async. - /// </summary> - /// <param name="location">The location.</param> - /// <returns>Task{WeatherInfo}.</returns> - public abstract Task<WeatherInfo> GetWeatherInfoAsync(string location, CancellationToken cancellationToken); - } -} diff --git a/MediaBrowser.Controller/Weather/IWeatherProvider.cs b/MediaBrowser.Controller/Weather/IWeatherProvider.cs new file mode 100644 index 000000000..9060e5b9c --- /dev/null +++ b/MediaBrowser.Controller/Weather/IWeatherProvider.cs @@ -0,0 +1,20 @@ +using MediaBrowser.Model.Weather; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Weather +{ + /// <summary> + /// Interface IWeatherProvider + /// </summary> + public interface IWeatherProvider + { + /// <summary> + /// Gets the weather info async. + /// </summary> + /// <param name="location">The location.</param> + /// <param name="cancellationToken">The cancellation token.</param> + /// <returns>Task{WeatherInfo}.</returns> + Task<WeatherInfo> GetWeatherInfoAsync(string location, CancellationToken cancellationToken); + } +} diff --git a/MediaBrowser.IsoMounter/PismoIsoManager.cs b/MediaBrowser.IsoMounter/PismoIsoManager.cs index b3a1889f0..3ad3a413e 100644 --- a/MediaBrowser.IsoMounter/PismoIsoManager.cs +++ b/MediaBrowser.IsoMounter/PismoIsoManager.cs @@ -1,10 +1,9 @@ using MediaBrowser.Common.IO; +using MediaBrowser.Model.Logging; using System; using System.IO; using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Common.Logging; -using MediaBrowser.Model.Logging; namespace MediaBrowser.IsoMounter { @@ -13,8 +12,6 @@ namespace MediaBrowser.IsoMounter /// </summary> public class PismoIsoManager : IIsoManager { - private ILogger Logger = LogManager.GetLogger("IsoManager"); - /// <summary> /// The mount semaphore - limit to four at a time. /// </summary> @@ -69,8 +66,15 @@ namespace MediaBrowser.IsoMounter /// </summary> private bool _hasInitialized; - public PismoIsoManager() + /// <summary> + /// Gets or sets the logger. + /// </summary> + /// <value>The logger.</value> + private ILogger Logger { get; set; } + + public PismoIsoManager(ILogger logger) { + Logger = logger; } /// <summary> @@ -144,7 +148,7 @@ namespace MediaBrowser.IsoMounter throw new IOException("Unable to start mount for " + isoPath); } - return new PismoMount(mount, isoPath, this); + return new PismoMount(mount, isoPath, this, Logger); } public void Dispose() diff --git a/MediaBrowser.IsoMounter/PismoMount.cs b/MediaBrowser.IsoMounter/PismoMount.cs index 1e3dbb881..f63db8dcf 100644 --- a/MediaBrowser.IsoMounter/PismoMount.cs +++ b/MediaBrowser.IsoMounter/PismoMount.cs @@ -1,5 +1,4 @@ using MediaBrowser.Common.IO; -using MediaBrowser.Common.Logging; using MediaBrowser.Model.Logging; using System; @@ -11,11 +10,6 @@ namespace MediaBrowser.IsoMounter internal class PismoMount : IIsoMount { /// <summary> - /// The logger - /// </summary> - private static readonly ILogger Logger = LogManager.GetLogger("IsoMount"); - - /// <summary> /// Gets or sets the iso path. /// </summary> /// <value>The iso path.</value> @@ -38,16 +32,24 @@ namespace MediaBrowser.IsoMounter private readonly PismoIsoManager _isoManager; /// <summary> + /// Gets or sets the logger. + /// </summary> + /// <value>The logger.</value> + private ILogger Logger { get; set; } + + /// <summary> /// Prevents a default instance of the <see cref="PismoMount" /> class from being created. /// </summary> /// <param name="mount">The mount.</param> /// <param name="isoPath">The iso path.</param> /// <param name="isoManager">The iso manager.</param> - internal PismoMount(PfmFileMount mount, string isoPath, PismoIsoManager isoManager) + /// <param name="logger">The logger.</param> + internal PismoMount(PfmFileMount mount, string isoPath, PismoIsoManager isoManager, ILogger logger) { _pfmFileMount = mount; IsoPath = isoPath; _isoManager = isoManager; + Logger = logger; MountedPath = mount.GetMount().GetUncName(); } diff --git a/MediaBrowser.Server.WorldWeatherOnline/MediaBrowser.Server.WorldWeatherOnline.csproj b/MediaBrowser.Server.WorldWeatherOnline/MediaBrowser.Server.WorldWeatherOnline.csproj new file mode 100644 index 000000000..941666770 --- /dev/null +++ b/MediaBrowser.Server.WorldWeatherOnline/MediaBrowser.Server.WorldWeatherOnline.csproj @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{973CA45C-8362-490B-8327-C68098FD4891}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>MediaBrowser.Server.WorldWeatherOnline</RootNamespace> + <AssemblyName>MediaBrowser.Server.WorldWeatherOnline</AssemblyName> + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup> + <RunPostBuildEvent>Always</RunPostBuildEvent> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.Composition" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="WeatherProvider.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj"> + <Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project> + <Name>MediaBrowser.Common</Name> + </ProjectReference> + <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj"> + <Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project> + <Name>MediaBrowser.Controller</Name> + </ProjectReference> + <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj"> + <Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project> + <Name>MediaBrowser.Model</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <PropertyGroup> + <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\MediaBrowser.ServerApplication\CorePlugins\" /y</PostBuildEvent> + </PropertyGroup> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/MediaBrowser.Server.WorldWeatherOnline/Properties/AssemblyInfo.cs b/MediaBrowser.Server.WorldWeatherOnline/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..97f2ae6e1 --- /dev/null +++ b/MediaBrowser.Server.WorldWeatherOnline/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MediaBrowser.Server.WorldWeatherOnline")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MediaBrowser.Server.WorldWeatherOnline")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c7b294dc-b3fd-4925-9ac3-8dd16803200c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MediaBrowser.Controller/Weather/WeatherProvider.cs b/MediaBrowser.Server.WorldWeatherOnline/WeatherProvider.cs index 1560aa92c..257249793 100644 --- a/MediaBrowser.Controller/Weather/WeatherProvider.cs +++ b/MediaBrowser.Server.WorldWeatherOnline/WeatherProvider.cs @@ -1,5 +1,7 @@ -using MediaBrowser.Common.Logging; -using MediaBrowser.Common.Serialization; +using MediaBrowser.Common.Serialization; +using MediaBrowser.Controller; +using MediaBrowser.Controller.Weather; +using MediaBrowser.Model.Logging; using MediaBrowser.Model.Weather; using System; using System.ComponentModel.Composition; @@ -7,16 +9,38 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -namespace MediaBrowser.Controller.Weather +namespace MediaBrowser.Server.WorldWeatherOnline { /// <summary> /// Based on http://www.worldweatheronline.com/free-weather-feed.aspx /// The classes in this file are a reproduction of the json output, which will then be converted to our weather model classes /// </summary> - [Export(typeof(BaseWeatherProvider))] - public class WeatherProvider : BaseWeatherProvider + [Export(typeof(IWeatherProvider))] + public class WeatherProvider : IWeatherProvider { /// <summary> + /// Gets or sets the logger. + /// </summary> + /// <value>The logger.</value> + private ILogger Logger { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="WeatherProvider" /> class. + /// </summary> + /// <param name="logger">The logger.</param> + /// <exception cref="System.ArgumentNullException">logger</exception> + [ImportingConstructor] + public WeatherProvider([Import("logger")] ILogger logger) + { + if (logger == null) + { + throw new ArgumentNullException("logger"); + } + + Logger = logger; + } + + /// <summary> /// The _weather semaphore /// </summary> private readonly SemaphoreSlim _weatherSemaphore = new SemaphoreSlim(10, 10); @@ -28,7 +52,7 @@ namespace MediaBrowser.Controller.Weather /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{WeatherInfo}.</returns> /// <exception cref="System.ArgumentNullException">location</exception> - public override async Task<WeatherInfo> GetWeatherInfoAsync(string location, CancellationToken cancellationToken) + public async Task<WeatherInfo> GetWeatherInfoAsync(string location, CancellationToken cancellationToken) { if (string.IsNullOrWhiteSpace(location)) { @@ -39,13 +63,13 @@ namespace MediaBrowser.Controller.Weather { throw new ArgumentNullException("cancellationToken"); } - + const int numDays = 5; const string apiKey = "24902f60f1231941120109"; var url = "http://free.worldweatheronline.com/feed/weather.ashx?q=" + location + "&format=json&num_of_days=" + numDays + "&key=" + apiKey; - Logger.LogInfo("Accessing weather from " + url); + Logger.Info("Accessing weather from " + url); using (var stream = await Kernel.Instance.HttpManager.Get(url, _weatherSemaphore, cancellationToken).ConfigureAwait(false)) { @@ -308,4 +332,4 @@ namespace MediaBrowser.Controller.Weather } } } -} +}
\ No newline at end of file diff --git a/MediaBrowser.ServerApplication/App.xaml.cs b/MediaBrowser.ServerApplication/App.xaml.cs index e50370444..b06c8f04e 100644 --- a/MediaBrowser.ServerApplication/App.xaml.cs +++ b/MediaBrowser.ServerApplication/App.xaml.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Kernel; +using MediaBrowser.Common.Logging; using MediaBrowser.Common.UI; using MediaBrowser.Controller; using MediaBrowser.IsoMounter; @@ -169,7 +170,7 @@ namespace MediaBrowser.ServerApplication /// <returns>IKernel.</returns> protected override IKernel InstantiateKernel() { - return new Kernel(new PismoIsoManager(), new DotNetZipClient()); + return new Kernel(new PismoIsoManager(LogManager.GetLogger("PismoIsoManager")), new DotNetZipClient()); } /// <summary> diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 86ad7dcaf..cfd37904e 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -328,6 +328,9 @@ <Content Include="CorePlugins\MediaBrowser.Server.Sqlite.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> + <Content Include="CorePlugins\MediaBrowser.Server.WorldWeatherOnline.dll"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> <Content Include="CorePlugins\MediaBrowser.WebDashboard.dll"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> diff --git a/MediaBrowser.UI/App.xaml.cs b/MediaBrowser.UI/App.xaml.cs index bae133ab7..bc68df234 100644 --- a/MediaBrowser.UI/App.xaml.cs +++ b/MediaBrowser.UI/App.xaml.cs @@ -244,7 +244,7 @@ namespace MediaBrowser.UI /// <returns>IKernel.</returns> protected override IKernel InstantiateKernel() { - return new UIKernel(new PismoIsoManager()); + return new UIKernel(new PismoIsoManager(LogManager.GetLogger("PismoIsoManager"))); } /// <summary> diff --git a/MediaBrowser.sln b/MediaBrowser.sln index 9e35fdc9e..f9d2816af 100644 --- a/MediaBrowser.sln +++ b/MediaBrowser.sln @@ -47,6 +47,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Installer", "M EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Server.Sqlite", "MediaBrowser.Server.Sqlite\MediaBrowser.Server.Sqlite.csproj", "{8649ED6B-8504-4D00-BFA5-B8C73CC744DB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Server.WorldWeatherOnline", "MediaBrowser.Server.WorldWeatherOnline\MediaBrowser.Server.WorldWeatherOnline.csproj", "{973CA45C-8362-490B-8327-C68098FD4891}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -303,6 +305,20 @@ Global {8649ED6B-8504-4D00-BFA5-B8C73CC744DB}.Release|Win32.ActiveCfg = Release|Any CPU {8649ED6B-8504-4D00-BFA5-B8C73CC744DB}.Release|x64.ActiveCfg = Release|Any CPU {8649ED6B-8504-4D00-BFA5-B8C73CC744DB}.Release|x86.ActiveCfg = Release|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Debug|Any CPU.Build.0 = Debug|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Debug|Win32.ActiveCfg = Debug|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Debug|x64.ActiveCfg = Debug|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Debug|x86.ActiveCfg = Debug|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Release|Any CPU.ActiveCfg = Release|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Release|Any CPU.Build.0 = Release|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Release|Win32.ActiveCfg = Release|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Release|x64.ActiveCfg = Release|Any CPU + {973CA45C-8362-490B-8327-C68098FD4891}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE |
