mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-23 15:30:56 -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">
|
<Reference Include="MoreLinq">
|
||||||
<HintPath>..\packages\morelinq.1.0.15631-beta\lib\net35\MoreLinq.dll</HintPath>
|
<HintPath>..\packages\morelinq.1.0.15631-beta\lib\net35\MoreLinq.dll</HintPath>
|
||||||
</Reference>
|
</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">
|
<Reference Include="ServiceStack">
|
||||||
<HintPath>..\packages\ServiceStack.3.9.37\lib\net35\ServiceStack.dll</HintPath>
|
<HintPath>..\packages\ServiceStack.3.9.37\lib\net35\ServiceStack.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="morelinq" version="1.0.15631-beta" targetFramework="net45" />
|
<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" version="3.9.37" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Common" 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" />
|
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.37" targetFramework="net45" />
|
||||||
|
@ -441,7 +441,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
|
|
||||||
AddLogTarget(logFile, "ApplicationLogFile");
|
AddLogTarget(logFile, "ApplicationLogFile");
|
||||||
|
|
||||||
Logging.Logger.LoggerInstance = Logging.LogManager.GetLogger("Global");
|
Logging.Logger.LoggerInstance = Logging.LogManager.GetLogger("App");
|
||||||
|
|
||||||
OnLoggerLoaded();
|
OnLoggerLoaded();
|
||||||
}
|
}
|
||||||
@ -484,6 +484,7 @@ namespace MediaBrowser.Common.Kernel
|
|||||||
CompositionContainer = MefUtils.GetSafeCompositionContainer(Assemblies.Select(i => new AssemblyCatalog(i)));
|
CompositionContainer = MefUtils.GetSafeCompositionContainer(Assemblies.Select(i => new AssemblyCatalog(i)));
|
||||||
|
|
||||||
CompositionContainer.ComposeExportedValue("kernel", this);
|
CompositionContainer.ComposeExportedValue("kernel", this);
|
||||||
|
CompositionContainer.ComposeExportedValue("logger", Logging.LogManager.GetLogger("App"));
|
||||||
|
|
||||||
CompositionContainer.ComposeParts(this);
|
CompositionContainer.ComposeParts(this);
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@
|
|||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Deployment" />
|
<Reference Include="System.Deployment" />
|
||||||
<Reference Include="System.Drawing" />
|
|
||||||
<Reference Include="System.Management" />
|
<Reference Include="System.Management" />
|
||||||
<Reference Include="System.Net" />
|
<Reference Include="System.Net" />
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
@ -118,7 +117,6 @@
|
|||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.Xaml" />
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
@ -129,8 +127,6 @@
|
|||||||
<Compile Include="Api\ScheduledTasks\ScheduledTaskService.cs" />
|
<Compile Include="Api\ScheduledTasks\ScheduledTaskService.cs" />
|
||||||
<Compile Include="Api\ScheduledTasks\ScheduledTasksWebSocketListener.cs" />
|
<Compile Include="Api\ScheduledTasks\ScheduledTasksWebSocketListener.cs" />
|
||||||
<Compile Include="Api\SystemInfoWebSocketListener.cs" />
|
<Compile Include="Api\SystemInfoWebSocketListener.cs" />
|
||||||
<Compile Include="Drawing\ImageExtensions.cs" />
|
|
||||||
<Compile Include="Drawing\ImageHeader.cs" />
|
|
||||||
<Compile Include="Events\EventHelper.cs" />
|
<Compile Include="Events\EventHelper.cs" />
|
||||||
<Compile Include="Extensions\BaseExtensions.cs" />
|
<Compile Include="Extensions\BaseExtensions.cs" />
|
||||||
<Compile Include="Events\GenericEventArgs.cs" />
|
<Compile Include="Events\GenericEventArgs.cs" />
|
||||||
|
@ -5,7 +5,7 @@ using System.Drawing.Imaging;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Drawing
|
namespace MediaBrowser.Controller.Drawing
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class ImageExtensions
|
/// Class ImageExtensions
|
@ -5,7 +5,7 @@ using System.Drawing;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.Drawing
|
namespace MediaBrowser.Controller.Drawing
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Taken from http://stackoverflow.com/questions/111345/getting-image-dimensions-without-reading-the-entire-file/111349
|
/// 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.IO;
|
||||||
using MediaBrowser.Common.Kernel;
|
using MediaBrowser.Common.Kernel;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Persistence;
|
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Drawing;
|
using MediaBrowser.Model.Drawing;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
@ -192,8 +192,8 @@ namespace MediaBrowser.Controller
|
|||||||
/// 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(BaseWeatherProvider))]
|
[ImportMany(typeof(IWeatherProvider))]
|
||||||
public IEnumerable<BaseWeatherProvider> 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
|
||||||
|
@ -76,6 +76,8 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Drawing\ImageExtensions.cs" />
|
||||||
|
<Compile Include="Drawing\ImageHeader.cs" />
|
||||||
<Compile Include="Drawing\ImageManager.cs" />
|
<Compile Include="Drawing\ImageManager.cs" />
|
||||||
<Compile Include="Entities\AggregateFolder.cs" />
|
<Compile Include="Entities\AggregateFolder.cs" />
|
||||||
<Compile Include="Entities\Audio\Audio.cs" />
|
<Compile Include="Entities\Audio\Audio.cs" />
|
||||||
@ -197,8 +199,7 @@
|
|||||||
<Compile Include="Sorting\BaseItemComparer.cs" />
|
<Compile Include="Sorting\BaseItemComparer.cs" />
|
||||||
<Compile Include="Sorting\SortOrder.cs" />
|
<Compile Include="Sorting\SortOrder.cs" />
|
||||||
<Compile Include="Updates\InstallationManager.cs" />
|
<Compile Include="Updates\InstallationManager.cs" />
|
||||||
<Compile Include="Weather\BaseWeatherProvider.cs" />
|
<Compile Include="Weather\IWeatherProvider.cs" />
|
||||||
<Compile Include="Weather\WeatherProvider.cs" />
|
|
||||||
<Compile Include="Providers\BaseItemXmlParser.cs" />
|
<Compile Include="Providers\BaseItemXmlParser.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -6,12 +6,28 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace MediaBrowser.Controller.Plugins
|
namespace MediaBrowser.Controller.Plugins
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Class PluginSecurityManager
|
||||||
|
/// </summary>
|
||||||
public class PluginSecurityManager : BaseManager<Kernel>
|
public class PluginSecurityManager : BaseManager<Kernel>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The _is MB supporter
|
||||||
|
/// </summary>
|
||||||
private bool? _isMBSupporter;
|
private bool? _isMBSupporter;
|
||||||
|
/// <summary>
|
||||||
|
/// The _is MB supporter initialized
|
||||||
|
/// </summary>
|
||||||
private bool _isMBSupporterInitialized;
|
private bool _isMBSupporterInitialized;
|
||||||
|
/// <summary>
|
||||||
|
/// The _is MB supporter sync lock
|
||||||
|
/// </summary>
|
||||||
private object _isMBSupporterSyncLock = new object();
|
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
|
public bool IsMBSupporter
|
||||||
{
|
{
|
||||||
get
|
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)
|
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)
|
public async Task<MBRegistrationRecord> GetRegistrationStatus(string feature, string mb2Equivalent = null)
|
||||||
{
|
{
|
||||||
return await MBRegistration.GetRegistrationStatus(feature, mb2Equivalent).ConfigureAwait(false);
|
return await MBRegistration.GetRegistrationStatus(feature, mb2Equivalent).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the supporter key.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The supporter key.</value>
|
||||||
public string SupporterKey
|
public string SupporterKey
|
||||||
{
|
{
|
||||||
get { return MBRegistration.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
|
public string LegacyKey
|
||||||
{
|
{
|
||||||
get { return MBRegistration.LegacyKey; }
|
get { return MBRegistration.LegacyKey; }
|
||||||
@ -56,6 +90,9 @@ namespace MediaBrowser.Controller.Plugins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the supporter info.
|
||||||
|
/// </summary>
|
||||||
private void ResetSupporterInfo()
|
private void ResetSupporterInfo()
|
||||||
{
|
{
|
||||||
_isMBSupporter = null;
|
_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.Common.IO;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Logging;
|
|
||||||
using MediaBrowser.Model.Logging;
|
|
||||||
|
|
||||||
namespace MediaBrowser.IsoMounter
|
namespace MediaBrowser.IsoMounter
|
||||||
{
|
{
|
||||||
@ -13,8 +12,6 @@ namespace MediaBrowser.IsoMounter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class PismoIsoManager : IIsoManager
|
public class PismoIsoManager : IIsoManager
|
||||||
{
|
{
|
||||||
private ILogger Logger = LogManager.GetLogger("IsoManager");
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The mount semaphore - limit to four at a time.
|
/// The mount semaphore - limit to four at a time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -69,8 +66,15 @@ namespace MediaBrowser.IsoMounter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _hasInitialized;
|
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>
|
/// <summary>
|
||||||
@ -144,7 +148,7 @@ namespace MediaBrowser.IsoMounter
|
|||||||
throw new IOException("Unable to start mount for " + isoPath);
|
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()
|
public void Dispose()
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Logging;
|
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
@ -10,11 +9,6 @@ namespace MediaBrowser.IsoMounter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class PismoMount : IIsoMount
|
internal class PismoMount : IIsoMount
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// The logger
|
|
||||||
/// </summary>
|
|
||||||
private static readonly ILogger Logger = LogManager.GetLogger("IsoMount");
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the iso path.
|
/// Gets or sets the iso path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -37,17 +31,25 @@ namespace MediaBrowser.IsoMounter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly PismoIsoManager _isoManager;
|
private readonly PismoIsoManager _isoManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the logger.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The logger.</value>
|
||||||
|
private ILogger Logger { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prevents a default instance of the <see cref="PismoMount" /> class from being created.
|
/// Prevents a default instance of the <see cref="PismoMount" /> class from being created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mount">The mount.</param>
|
/// <param name="mount">The mount.</param>
|
||||||
/// <param name="isoPath">The iso path.</param>
|
/// <param name="isoPath">The iso path.</param>
|
||||||
/// <param name="isoManager">The iso manager.</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;
|
_pfmFileMount = mount;
|
||||||
IsoPath = isoPath;
|
IsoPath = isoPath;
|
||||||
_isoManager = isoManager;
|
_isoManager = isoManager;
|
||||||
|
Logger = logger;
|
||||||
|
|
||||||
MountedPath = mount.GetMount().GetUncName();
|
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 MediaBrowser.Model.Weather;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.Composition;
|
using System.ComponentModel.Composition;
|
||||||
@ -7,15 +9,37 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Weather
|
namespace MediaBrowser.Server.WorldWeatherOnline
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Based on http://www.worldweatheronline.com/free-weather-feed.aspx
|
/// 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
|
/// The classes in this file are a reproduction of the json output, which will then be converted to our weather model classes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Export(typeof(BaseWeatherProvider))]
|
[Export(typeof(IWeatherProvider))]
|
||||||
public class WeatherProvider : BaseWeatherProvider
|
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>
|
/// <summary>
|
||||||
/// The _weather semaphore
|
/// The _weather semaphore
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -28,7 +52,7 @@ namespace MediaBrowser.Controller.Weather
|
|||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task{WeatherInfo}.</returns>
|
/// <returns>Task{WeatherInfo}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException">location</exception>
|
/// <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))
|
if (string.IsNullOrWhiteSpace(location))
|
||||||
{
|
{
|
||||||
@ -39,13 +63,13 @@ namespace MediaBrowser.Controller.Weather
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("cancellationToken");
|
throw new ArgumentNullException("cancellationToken");
|
||||||
}
|
}
|
||||||
|
|
||||||
const int numDays = 5;
|
const int numDays = 5;
|
||||||
const string apiKey = "24902f60f1231941120109";
|
const string apiKey = "24902f60f1231941120109";
|
||||||
|
|
||||||
var url = "http://free.worldweatheronline.com/feed/weather.ashx?q=" + location + "&format=json&num_of_days=" + numDays + "&key=" + apiKey;
|
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))
|
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.Kernel;
|
||||||
|
using MediaBrowser.Common.Logging;
|
||||||
using MediaBrowser.Common.UI;
|
using MediaBrowser.Common.UI;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.IsoMounter;
|
using MediaBrowser.IsoMounter;
|
||||||
@ -169,7 +170,7 @@ namespace MediaBrowser.ServerApplication
|
|||||||
/// <returns>IKernel.</returns>
|
/// <returns>IKernel.</returns>
|
||||||
protected override IKernel InstantiateKernel()
|
protected override IKernel InstantiateKernel()
|
||||||
{
|
{
|
||||||
return new Kernel(new PismoIsoManager(), new DotNetZipClient());
|
return new Kernel(new PismoIsoManager(LogManager.GetLogger("PismoIsoManager")), new DotNetZipClient());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -328,6 +328,9 @@
|
|||||||
<Content Include="CorePlugins\MediaBrowser.Server.Sqlite.dll">
|
<Content Include="CorePlugins\MediaBrowser.Server.Sqlite.dll">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="CorePlugins\MediaBrowser.Server.WorldWeatherOnline.dll">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="CorePlugins\MediaBrowser.WebDashboard.dll">
|
<Content Include="CorePlugins\MediaBrowser.WebDashboard.dll">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -244,7 +244,7 @@ namespace MediaBrowser.UI
|
|||||||
/// <returns>IKernel.</returns>
|
/// <returns>IKernel.</returns>
|
||||||
protected override IKernel InstantiateKernel()
|
protected override IKernel InstantiateKernel()
|
||||||
{
|
{
|
||||||
return new UIKernel(new PismoIsoManager());
|
return new UIKernel(new PismoIsoManager(LogManager.GetLogger("PismoIsoManager")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -47,6 +47,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Installer", "M
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Server.Sqlite", "MediaBrowser.Server.Sqlite\MediaBrowser.Server.Sqlite.csproj", "{8649ED6B-8504-4D00-BFA5-B8C73CC744DB}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Server.Sqlite", "MediaBrowser.Server.Sqlite\MediaBrowser.Server.Sqlite.csproj", "{8649ED6B-8504-4D00-BFA5-B8C73CC744DB}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MediaBrowser.Server.WorldWeatherOnline", "MediaBrowser.Server.WorldWeatherOnline\MediaBrowser.Server.WorldWeatherOnline.csproj", "{973CA45C-8362-490B-8327-C68098FD4891}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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|Win32.ActiveCfg = Release|Any CPU
|
||||||
{8649ED6B-8504-4D00-BFA5-B8C73CC744DB}.Release|x64.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
|
{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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user