mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-10-31 02:27:18 -04:00 
			
		
		
		
	isolated weather and moved drawing classes up to the controller project
This commit is contained in:
		
							parent
							
								
									acf5b0b6ed
								
							
						
					
					
						commit
						ae4ffa75be
					
				| @ -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> | ||||
|  | ||||
| @ -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" /> | ||||
|  | ||||
| @ -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); | ||||
| 
 | ||||
|  | ||||
| @ -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" /> | ||||
|  | ||||
| @ -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 | ||||
| @ -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 | ||||
| @ -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; | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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> | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
| @ -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); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										20
									
								
								MediaBrowser.Controller/Weather/IWeatherProvider.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								MediaBrowser.Controller/Weather/IWeatherProvider.cs
									
									
									
									
									
										Normal file
									
								
							| @ -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); | ||||
|     } | ||||
| } | ||||
| @ -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() | ||||
|  | ||||
| @ -1,5 +1,4 @@ | ||||
| using MediaBrowser.Common.IO; | ||||
| using MediaBrowser.Common.Logging; | ||||
| using MediaBrowser.Model.Logging; | ||||
| using System; | ||||
| 
 | ||||
| @ -10,11 +9,6 @@ namespace MediaBrowser.IsoMounter | ||||
|     /// </summary> | ||||
|     internal class PismoMount : IIsoMount | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// The logger | ||||
|         /// </summary> | ||||
|         private static readonly ILogger Logger = LogManager.GetLogger("IsoMount"); | ||||
| 
 | ||||
|         /// <summary> | ||||
|         /// Gets or sets the iso path. | ||||
|         /// </summary> | ||||
| @ -37,17 +31,25 @@ namespace MediaBrowser.IsoMounter | ||||
|         /// </summary> | ||||
|         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(); | ||||
|         } | ||||
|  | ||||
| @ -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> | ||||
| @ -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")] | ||||
| @ -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,15 +9,37 @@ 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> | ||||
| @ -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 | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -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> | ||||
|  | ||||
| @ -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> | ||||
|  | ||||
| @ -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> | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user