aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/HttpHandlers/WeatherHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/HttpHandlers/WeatherHandler.cs')
-rw-r--r--MediaBrowser.Api/HttpHandlers/WeatherHandler.cs43
1 files changed, 0 insertions, 43 deletions
diff --git a/MediaBrowser.Api/HttpHandlers/WeatherHandler.cs b/MediaBrowser.Api/HttpHandlers/WeatherHandler.cs
deleted file mode 100644
index 378e89067..000000000
--- a/MediaBrowser.Api/HttpHandlers/WeatherHandler.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using MediaBrowser.Common.Net.Handlers;
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Weather;
-using System;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Net;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Api.HttpHandlers
-{
- [Export(typeof(BaseHandler))]
- class WeatherHandler : BaseSerializationHandler<WeatherInfo>
- {
- public override bool HandlesRequest(HttpListenerRequest request)
- {
- return ApiService.IsApiUrlMatch("weather", request);
- }
-
- protected override Task<WeatherInfo> GetObjectToSerialize()
- {
- // If a specific zip code was requested on the query string, use that. Otherwise use the value from configuration
-
- string zipCode = QueryString["zipcode"];
-
- if (string.IsNullOrWhiteSpace(zipCode))
- {
- zipCode = Kernel.Instance.Configuration.WeatherZipCode;
- }
-
- return Kernel.Instance.WeatherProviders.First().GetWeatherInfoAsync(zipCode);
- }
-
- protected override async Task<ResponseInfo> GetResponseInfo()
- {
- var info = await base.GetResponseInfo().ConfigureAwait(false);
-
- info.CacheDuration = TimeSpan.FromMinutes(15);
-
- return info;
- }
- }
-}