You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
958 B
35 lines
958 B
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);
|
|
}
|
|
}
|