mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
34 lines
958 B
C#
34 lines
958 B
C#
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);
|
|
}
|
|
}
|