mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-09 03:42:14 +01:00
Moved discovery of loggers and weather providers to MEF. Also added support for third-party image processors, also discovered through MEF.
This commit is contained in:
parent
01a25c48a0
commit
8b7effd6ff
34
MediaBrowser.Controller/Weather/BaseWeatherProvider.cs
Normal file
34
MediaBrowser.Controller/Weather/BaseWeatherProvider.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using MediaBrowser.Common.Logging;
|
||||
using MediaBrowser.Model.Weather;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Cache;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Controller.Weather
|
||||
{
|
||||
public abstract class BaseWeatherProvider : IDisposable
|
||||
{
|
||||
protected HttpClient HttpClient { get; private set; }
|
||||
|
||||
protected BaseWeatherProvider()
|
||||
{
|
||||
var handler = new WebRequestHandler { };
|
||||
|
||||
handler.AutomaticDecompression = DecompressionMethods.Deflate;
|
||||
handler.CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate);
|
||||
|
||||
HttpClient = new HttpClient(handler);
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
Logger.LogInfo("Disposing " + GetType().Name);
|
||||
|
||||
HttpClient.Dispose();
|
||||
}
|
||||
|
||||
public abstract Task<WeatherInfo> GetWeatherInfoAsync(string zipCode);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user