aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Api/GamesService.cs2
-rw-r--r--MediaBrowser.Api/LibraryService.cs4
-rw-r--r--MediaBrowser.Api/MediaBrowser.Api.csproj1
-rw-r--r--MediaBrowser.Api/UserLibrary/GenresService.cs2
-rw-r--r--MediaBrowser.Api/UserLibrary/PersonsService.cs2
-rw-r--r--MediaBrowser.Api/UserLibrary/StudiosService.cs2
-rw-r--r--MediaBrowser.Api/WeatherService.cs41
-rw-r--r--MediaBrowser.Controller/Dto/DtoBuilder.cs11
-rw-r--r--MediaBrowser.Controller/Kernel.cs8
-rw-r--r--MediaBrowser.Controller/MediaBrowser.Controller.csproj1
-rw-r--r--MediaBrowser.Controller/Weather/IWeatherProvider.cs20
-rw-r--r--MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj12
-rw-r--r--MediaBrowser.Model/ApiClient/IApiClient.cs17
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs13
-rw-r--r--MediaBrowser.Model/MediaBrowser.Model.csproj4
-rw-r--r--MediaBrowser.Model/Weather/WeatherForecast.cs46
-rw-r--r--MediaBrowser.Model/Weather/WeatherInfo.cs29
-rw-r--r--MediaBrowser.Model/Weather/WeatherStatus.cs84
-rw-r--r--MediaBrowser.Model/Weather/WeatherUnits.cs18
-rw-r--r--MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj1
-rw-r--r--MediaBrowser.Server.Implementations/WorldWeatherOnline/WeatherProvider.cs360
-rw-r--r--MediaBrowser.ServerApplication/ApplicationHost.cs2
-rw-r--r--MediaBrowser.WebDashboard/ApiClient.js18
-rw-r--r--MediaBrowser.WebDashboard/packages.config2
24 files changed, 15 insertions, 685 deletions
diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.cs
index 49c24fe51..4529a9c53 100644
--- a/MediaBrowser.Api/GamesService.cs
+++ b/MediaBrowser.Api/GamesService.cs
@@ -62,7 +62,7 @@ namespace MediaBrowser.Api
_libraryManager,
_userDataRepository,
Logger,
- request, item => item is BaseGame,
+ request, item => item is Game,
SimilarItemsHelper.GetSimiliarityScore);
return ToOptimizedResult(result);
diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs
index 341ca2f42..04774cbe0 100644
--- a/MediaBrowser.Api/LibraryService.cs
+++ b/MediaBrowser.Api/LibraryService.cs
@@ -189,7 +189,7 @@ namespace MediaBrowser.Api
{
AlbumCount = items.OfType<MusicAlbum>().Count(),
EpisodeCount = items.OfType<Episode>().Count(),
- GameCount = items.OfType<BaseGame>().Count(),
+ GameCount = items.OfType<Game>().Count(),
MovieCount = items.OfType<Movie>().Count(),
SeriesCount = items.OfType<Series>().Count(),
SongCount = items.OfType<Audio>().Count(),
@@ -285,7 +285,7 @@ namespace MediaBrowser.Api
item.ProviderIds = request.ProviderIds;
- var game = item as BaseGame;
+ var game = item as Game;
if (game != null)
{
diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj
index 171f2316c..5323231f4 100644
--- a/MediaBrowser.Api/MediaBrowser.Api.csproj
+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj
@@ -115,7 +115,6 @@
<Compile Include="UserService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VideosService.cs" />
- <Compile Include="WeatherService.cs" />
<Compile Include="WebSocket\LogFileWebSocketListener.cs" />
<Compile Include="WebSocket\SessionInfoWebSocketListener.cs" />
<Compile Include="WebSocket\SystemInfoWebSocketListener.cs" />
diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs
index 7c49501ab..4c383f0d7 100644
--- a/MediaBrowser.Api/UserLibrary/GenresService.cs
+++ b/MediaBrowser.Api/UserLibrary/GenresService.cs
@@ -169,7 +169,7 @@ namespace MediaBrowser.Api.UserLibrary
SeriesCount = items.OfType<Series>().Count(),
- GameCount = items.OfType<BaseGame>().Count()
+ GameCount = items.OfType<Game>().Count()
};
return ToOptimizedResult(counts);
diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs
index 06aa3111d..2d555e001 100644
--- a/MediaBrowser.Api/UserLibrary/PersonsService.cs
+++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs
@@ -160,7 +160,7 @@ namespace MediaBrowser.Api.UserLibrary
SeriesCount = items.OfType<Series>().Count(),
- GameCount = items.OfType<BaseGame>().Count(),
+ GameCount = items.OfType<Game>().Count(),
SongCount = items.OfType<Audio>().Count(),
diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs
index 687e237bd..26a13a4b8 100644
--- a/MediaBrowser.Api/UserLibrary/StudiosService.cs
+++ b/MediaBrowser.Api/UserLibrary/StudiosService.cs
@@ -132,7 +132,7 @@ namespace MediaBrowser.Api.UserLibrary
SeriesCount = items.OfType<Series>().Count(),
- GameCount = items.OfType<BaseGame>().Count(),
+ GameCount = items.OfType<Game>().Count(),
SongCount = items.OfType<Audio>().Count(),
diff --git a/MediaBrowser.Api/WeatherService.cs b/MediaBrowser.Api/WeatherService.cs
deleted file mode 100644
index 25f6d237a..000000000
--- a/MediaBrowser.Api/WeatherService.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using MediaBrowser.Controller;
-using MediaBrowser.Model.Weather;
-using ServiceStack.ServiceHost;
-using System.Linq;
-using System.Threading;
-
-namespace MediaBrowser.Api
-{
- /// <summary>
- /// Class Weather
- /// </summary>
- [Route("/Weather", "GET")]
- [Api(Description = "Gets weather information for a given location")]
- public class GetWeather : IReturn<WeatherInfo>
- {
- /// <summary>
- /// Gets or sets the location.
- /// </summary>
- /// <value>The location.</value>
- [ApiMember(Name = "Location", Description = "Us zip / City, State, Country / City, Country", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
- public string Location { get; set; }
- }
-
- /// <summary>
- /// Class WeatherService
- /// </summary>
- public class WeatherService : BaseApiService
- {
- /// <summary>
- /// Gets the specified request.
- /// </summary>
- /// <param name="request">The request.</param>
- /// <returns>System.Object.</returns>
- public object Get(GetWeather request)
- {
- var result = Kernel.Instance.WeatherProviders.First().GetWeatherInfoAsync(request.Location, CancellationToken.None).Result;
-
- return ToOptimizedResult(result);
- }
- }
-}
diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs
index 17a5995b8..5868e34cd 100644
--- a/MediaBrowser.Controller/Dto/DtoBuilder.cs
+++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs
@@ -514,15 +514,20 @@ namespace MediaBrowser.Controller.Dto
}
}
- var game = item as BaseGame;
+ var game = item as Game;
if (game != null)
{
- dto.Players = game.PlayersSupported;
- dto.GameSystem = game.GameSystem;
+ SetGameProperties(dto, game);
}
}
+ private void SetGameProperties(BaseItemDto dto, Game item)
+ {
+ dto.Players = item.PlayersSupported;
+ dto.GameSystem = item.GameSystem;
+ }
+
/// <summary>
/// Since it can be slow to make all of these calculations independently, this method will provide a way to do them all at once
/// </summary>
diff --git a/MediaBrowser.Controller/Kernel.cs b/MediaBrowser.Controller/Kernel.cs
index d7b24a0cc..5bf485229 100644
--- a/MediaBrowser.Controller/Kernel.cs
+++ b/MediaBrowser.Controller/Kernel.cs
@@ -1,7 +1,5 @@
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.MediaInfo;
-using MediaBrowser.Controller.Weather;
-using System.Collections.Generic;
namespace MediaBrowser.Controller
{
@@ -29,12 +27,6 @@ namespace MediaBrowser.Controller
public FFMpegManager FFMpegManager { get; set; }
/// <summary>
- /// Gets the list of currently registered weather prvoiders
- /// </summary>
- /// <value>The weather providers.</value>
- public IEnumerable<IWeatherProvider> WeatherProviders { get; set; }
-
- /// <summary>
/// Creates a kernel based on a Data path, which is akin to our current programdata path
/// </summary>
public Kernel()
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index 0fa04adcc..0bd82eaa7 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -161,7 +161,6 @@
<Compile Include="Sorting\IBaseItemComparer.cs" />
<Compile Include="Sorting\IUserBaseItemComparer.cs" />
<Compile Include="Updates\IInstallationManager.cs" />
- <Compile Include="Weather\IWeatherProvider.cs" />
<Compile Include="Providers\BaseItemXmlParser.cs" />
</ItemGroup>
<ItemGroup>
diff --git a/MediaBrowser.Controller/Weather/IWeatherProvider.cs b/MediaBrowser.Controller/Weather/IWeatherProvider.cs
deleted file mode 100644
index 9060e5b9c..000000000
--- a/MediaBrowser.Controller/Weather/IWeatherProvider.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-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);
- }
-}
diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
index 940d023b6..e6eb01cd7 100644
--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj
@@ -316,18 +316,6 @@
<Compile Include="..\MediaBrowser.Model\Updates\PackageVersionInfo.cs">
<Link>Updates\PackageVersionInfo.cs</Link>
</Compile>
- <Compile Include="..\MediaBrowser.Model\Weather\WeatherForecast.cs">
- <Link>Weather\WeatherForecast.cs</Link>
- </Compile>
- <Compile Include="..\MediaBrowser.Model\Weather\WeatherInfo.cs">
- <Link>Weather\WeatherInfo.cs</Link>
- </Compile>
- <Compile Include="..\MediaBrowser.Model\Weather\WeatherStatus.cs">
- <Link>Weather\WeatherStatus.cs</Link>
- </Compile>
- <Compile Include="..\MediaBrowser.Model\Weather\WeatherUnits.cs">
- <Link>Weather\WeatherUnits.cs</Link>
- </Compile>
<Compile Include="..\MediaBrowser.Model\Web\QueryStringDictionary.cs">
<Link>Web\QueryStringDictionary.cs</Link>
</Compile>
diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs
index 8634548f2..0212c3b62 100644
--- a/MediaBrowser.Model/ApiClient/IApiClient.cs
+++ b/MediaBrowser.Model/ApiClient/IApiClient.cs
@@ -8,7 +8,6 @@ using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
-using MediaBrowser.Model.Weather;
using System;
using System.Collections.Generic;
using System.IO;
@@ -225,22 +224,6 @@ namespace MediaBrowser.Model.ApiClient
Task<List<ParentalRating>> GetParentalRatingsAsync();
/// <summary>
- /// Gets weather information for the default location as set in configuration
- /// </summary>
- /// <returns>Task{WeatherInfo}.</returns>
- Task<WeatherInfo> GetWeatherInfoAsync();
-
- /// <summary>
- /// Gets weather information for a specific location
- /// Location can be a US zipcode, or "city,state", "city,state,country", "city,country"
- /// It can also be an ip address, or "latitude,longitude"
- /// </summary>
- /// <param name="location">The location.</param>
- /// <returns>Task{WeatherInfo}.</returns>
- /// <exception cref="ArgumentNullException">location</exception>
- Task<WeatherInfo> GetWeatherInfoAsync(string location);
-
- /// <summary>
/// Gets local trailers for an item
/// </summary>
/// <param name="userId">The user id.</param>
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 72a80ffad..0446046c2 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -1,5 +1,4 @@
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Weather;
using System;
namespace MediaBrowser.Model.Configuration
@@ -34,12 +33,6 @@ namespace MediaBrowser.Model.Configuration
public bool EnableInternetProviders { get; set; }
/// <summary>
- /// Gets or sets the zip code to use when displaying weather
- /// </summary>
- /// <value>The weather location.</value>
- public string WeatherLocation { get; set; }
-
- /// <summary>
/// Gets or sets the item by name path.
/// </summary>
/// <value>The item by name path.</value>
@@ -50,12 +43,6 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
/// <value>The display name of the season zero.</value>
public string SeasonZeroDisplayName { get; set; }
-
- /// <summary>
- /// Gets or sets the weather unit to use when displaying weather
- /// </summary>
- /// <value>The weather unit.</value>
- public WeatherUnits WeatherUnit { get; set; }
/// <summary>
/// Gets or sets the metadata refresh days.
diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj
index f3c9d714c..159ad386d 100644
--- a/MediaBrowser.Model/MediaBrowser.Model.csproj
+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj
@@ -134,10 +134,6 @@
<Compile Include="Tasks\TaskTriggerInfo.cs" />
<Compile Include="Updates\PackageInfo.cs" />
<Compile Include="Updates\PackageVersionInfo.cs" />
- <Compile Include="Weather\WeatherForecast.cs" />
- <Compile Include="Weather\WeatherInfo.cs" />
- <Compile Include="Weather\WeatherStatus.cs" />
- <Compile Include="Weather\WeatherUnits.cs" />
<Compile Include="Web\QueryStringDictionary.cs" />
<None Include="FodyWeavers.xml" />
</ItemGroup>
diff --git a/MediaBrowser.Model/Weather/WeatherForecast.cs b/MediaBrowser.Model/Weather/WeatherForecast.cs
deleted file mode 100644
index 0f9ecba5b..000000000
--- a/MediaBrowser.Model/Weather/WeatherForecast.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-
-namespace MediaBrowser.Model.Weather
-{
- /// <summary>
- /// Represents a weather forecast for a specific date
- /// </summary>
- public class WeatherForecast
- {
- /// <summary>
- /// Gets or sets the date.
- /// </summary>
- /// <value>The date.</value>
- public DateTime Date { get; set; }
-
- /// <summary>
- /// Gets or sets the high temperature fahrenheit.
- /// </summary>
- /// <value>The high temperature fahrenheit.</value>
- public int HighTemperatureFahrenheit { get; set; }
-
- /// <summary>
- /// Gets or sets the low temperature fahrenheit.
- /// </summary>
- /// <value>The low temperature fahrenheit.</value>
- public int LowTemperatureFahrenheit { get; set; }
-
- /// <summary>
- /// Gets or sets the high temperature celsius.
- /// </summary>
- /// <value>The high temperature celsius.</value>
- public int HighTemperatureCelsius { get; set; }
-
- /// <summary>
- /// Gets or sets the low temperature celsius.
- /// </summary>
- /// <value>The low temperature celsius.</value>
- public int LowTemperatureCelsius { get; set; }
-
- /// <summary>
- /// Gets or sets the condition.
- /// </summary>
- /// <value>The condition.</value>
- public WeatherConditions Condition { get; set; }
- }
-}
diff --git a/MediaBrowser.Model/Weather/WeatherInfo.cs b/MediaBrowser.Model/Weather/WeatherInfo.cs
deleted file mode 100644
index 8aad52cb2..000000000
--- a/MediaBrowser.Model/Weather/WeatherInfo.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-
-namespace MediaBrowser.Model.Weather
-{
- /// <summary>
- /// Class WeatherInfo
- /// </summary>
- public class WeatherInfo
- {
- /// <summary>
- /// Gets or sets the current weather.
- /// </summary>
- /// <value>The current weather.</value>
- public WeatherStatus CurrentWeather { get; set; }
-
- /// <summary>
- /// Gets or sets the forecasts.
- /// </summary>
- /// <value>The forecasts.</value>
- public WeatherForecast[] Forecasts { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="WeatherInfo"/> class.
- /// </summary>
- public WeatherInfo()
- {
- Forecasts = new WeatherForecast[] {};
- }
- }
-}
diff --git a/MediaBrowser.Model/Weather/WeatherStatus.cs b/MediaBrowser.Model/Weather/WeatherStatus.cs
deleted file mode 100644
index 36f27b631..000000000
--- a/MediaBrowser.Model/Weather/WeatherStatus.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-
-namespace MediaBrowser.Model.Weather
-{
- /// <summary>
- /// Represents the current weather status
- /// </summary>
- public class WeatherStatus
- {
- /// <summary>
- /// Gets or sets the temperature fahrenheit.
- /// </summary>
- /// <value>The temperature fahrenheit.</value>
- public int TemperatureFahrenheit { get; set; }
-
- /// <summary>
- /// Gets or sets the temperature celsius.
- /// </summary>
- /// <value>The temperature celsius.</value>
- public int TemperatureCelsius { get; set; }
-
- /// <summary>
- /// Gets or sets the humidity.
- /// </summary>
- /// <value>The humidity.</value>
- public int Humidity { get; set; }
-
- /// <summary>
- /// Gets or sets the condition.
- /// </summary>
- /// <value>The condition.</value>
- public WeatherConditions Condition { get; set; }
- }
-
- /// <summary>
- /// Enum WeatherConditions
- /// </summary>
- public enum WeatherConditions
- {
- /// <summary>
- /// The sunny
- /// </summary>
- Sunny,
- /// <summary>
- /// The partly cloudy
- /// </summary>
- PartlyCloudy,
- /// <summary>
- /// The cloudy
- /// </summary>
- Cloudy,
- /// <summary>
- /// The overcast
- /// </summary>
- Overcast,
- /// <summary>
- /// The mist
- /// </summary>
- Mist,
- /// <summary>
- /// The snow
- /// </summary>
- Snow,
- /// <summary>
- /// The rain
- /// </summary>
- Rain,
- /// <summary>
- /// The sleet
- /// </summary>
- Sleet,
- /// <summary>
- /// The fog
- /// </summary>
- Fog,
- /// <summary>
- /// The blizzard
- /// </summary>
- Blizzard,
- /// <summary>
- /// The thunderstorm
- /// </summary>
- Thunderstorm
- }
-}
diff --git a/MediaBrowser.Model/Weather/WeatherUnits.cs b/MediaBrowser.Model/Weather/WeatherUnits.cs
deleted file mode 100644
index 86c11ce37..000000000
--- a/MediaBrowser.Model/Weather/WeatherUnits.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-
-namespace MediaBrowser.Model.Weather
-{
- /// <summary>
- /// Enum WeatherUnits
- /// </summary>
- public enum WeatherUnits
- {
- /// <summary>
- /// The fahrenheit
- /// </summary>
- Fahrenheit,
- /// <summary>
- /// The celsius
- /// </summary>
- Celsius
- }
-}
diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
index fde1b77b3..4cf892c9a 100644
--- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
+++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj
@@ -185,7 +185,6 @@
<Compile Include="Updates\InstallationManager.cs" />
<Compile Include="WebSocket\AlchemyServer.cs" />
<Compile Include="WebSocket\AlchemyWebSocket.cs" />
- <Compile Include="WorldWeatherOnline\WeatherProvider.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MediaBrowser.Common.Implementations\MediaBrowser.Common.Implementations.csproj">
diff --git a/MediaBrowser.Server.Implementations/WorldWeatherOnline/WeatherProvider.cs b/MediaBrowser.Server.Implementations/WorldWeatherOnline/WeatherProvider.cs
deleted file mode 100644
index 9f6ece175..000000000
--- a/MediaBrowser.Server.Implementations/WorldWeatherOnline/WeatherProvider.cs
+++ /dev/null
@@ -1,360 +0,0 @@
-using System.Globalization;
-using MediaBrowser.Common.Net;
-using MediaBrowser.Controller.Weather;
-using MediaBrowser.Model.Logging;
-using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.Weather;
-using System;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace MediaBrowser.Server.Implementations.WorldWeatherOnline
-{
- /// <summary>
- /// 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
- /// </summary>
- public class WeatherProvider : IWeatherProvider
- {
- /// <summary>
- /// Gets or sets the logger.
- /// </summary>
- /// <value>The logger.</value>
- private ILogger Logger { get; set; }
-
- /// <summary>
- /// Gets the json serializer.
- /// </summary>
- /// <value>The json serializer.</value>
- protected IJsonSerializer JsonSerializer { get; private set; }
-
- /// <summary>
- /// The _HTTP client
- /// </summary>
- private IHttpClient HttpClient { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="WeatherProvider" /> class.
- /// </summary>
- /// <param name="jsonSerializer">The json serializer.</param>
- /// <param name="httpClient">The HTTP client.</param>
- /// <param name="logger">The logger.</param>
- /// <exception cref="System.ArgumentNullException">logger</exception>
- public WeatherProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger)
- {
- if (logger == null)
- {
- throw new ArgumentNullException("logger");
- }
- if (httpClient == null)
- {
- throw new ArgumentNullException("httpClient");
- }
- if (jsonSerializer == null)
- {
- throw new ArgumentNullException("jsonSerializer");
- }
-
- JsonSerializer = jsonSerializer;
- HttpClient = httpClient;
- Logger = logger;
- }
-
- /// <summary>
- /// The _weather semaphore
- /// </summary>
- private readonly SemaphoreSlim _weatherSemaphore = new SemaphoreSlim(10, 10);
-
- /// <summary>
- /// Gets the weather info async.
- /// </summary>
- /// <param name="location">The location.</param>
- /// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task{WeatherInfo}.</returns>
- /// <exception cref="System.ArgumentNullException">location</exception>
- public async Task<WeatherInfo> GetWeatherInfoAsync(string location, CancellationToken cancellationToken)
- {
- if (string.IsNullOrWhiteSpace(location))
- {
- throw new ArgumentNullException("location");
- }
-
- if (cancellationToken == null)
- {
- throw new ArgumentNullException("cancellationToken");
- }
-
- const int numDays = 5;
- const string apiKey = "24902f60f1231941120109";
-
- var url = "http://free.worldweatheronline.com/feed/weather.ashx?q=" + location + "&format=json&num_of_days=" + numDays + "&key=" + apiKey;
-
- Logger.Info("Accessing weather from " + url);
-
- using (var stream = await HttpClient.Get(url, _weatherSemaphore, cancellationToken).ConfigureAwait(false))
- {
- var data = JsonSerializer.DeserializeFromStream<WeatherResult>(stream).data;
-
- return GetWeatherInfo(data);
- }
- }
-
- /// <summary>
- /// Converst the json output to our WeatherInfo model class
- /// </summary>
- /// <param name="data">The data.</param>
- /// <returns>WeatherInfo.</returns>
- private WeatherInfo GetWeatherInfo(WeatherData data)
- {
- var info = new WeatherInfo();
-
- if (data.current_condition != null)
- {
- var condition = data.current_condition.FirstOrDefault();
-
- if (condition != null)
- {
- info.CurrentWeather = condition.ToWeatherStatus();
- }
- }
-
- if (data.weather != null)
- {
- info.Forecasts = data.weather.Select(w => w.ToWeatherForecast()).ToArray();
- }
-
- return info;
- }
- }
-
- /// <summary>
- /// Class WeatherResult
- /// </summary>
- class WeatherResult
- {
- /// <summary>
- /// Gets or sets the data.
- /// </summary>
- /// <value>The data.</value>
- public WeatherData data { get; set; }
- }
-
- /// <summary>
- /// Class WeatherData
- /// </summary>
- public class WeatherData
- {
- /// <summary>
- /// Gets or sets the current_condition.
- /// </summary>
- /// <value>The current_condition.</value>
- public WeatherCondition[] current_condition { get; set; }
- /// <summary>
- /// Gets or sets the weather.
- /// </summary>
- /// <value>The weather.</value>
- public DailyWeatherInfo[] weather { get; set; }
- }
-
- /// <summary>
- /// Class WeatherCondition
- /// </summary>
- public class WeatherCondition
- {
- /// <summary>
- /// Gets or sets the temp_ C.
- /// </summary>
- /// <value>The temp_ C.</value>
- public string temp_C { get; set; }
- /// <summary>
- /// Gets or sets the temp_ F.
- /// </summary>
- /// <value>The temp_ F.</value>
- public string temp_F { get; set; }
- /// <summary>
- /// Gets or sets the humidity.
- /// </summary>
- /// <value>The humidity.</value>
- public string humidity { get; set; }
- /// <summary>
- /// Gets or sets the weather code.
- /// </summary>
- /// <value>The weather code.</value>
- public string weatherCode { get; set; }
-
- protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
- /// <summary>
- /// To the weather status.
- /// </summary>
- /// <returns>WeatherStatus.</returns>
- public WeatherStatus ToWeatherStatus()
- {
- return new WeatherStatus
- {
- TemperatureCelsius = int.Parse(temp_C, UsCulture),
- TemperatureFahrenheit = int.Parse(temp_F, UsCulture),
- Humidity = int.Parse(humidity, UsCulture),
- Condition = DailyWeatherInfo.GetCondition(weatherCode)
- };
- }
- }
-
- /// <summary>
- /// Class DailyWeatherInfo
- /// </summary>
- public class DailyWeatherInfo
- {
- /// <summary>
- /// Gets or sets the date.
- /// </summary>
- /// <value>The date.</value>
- public string date { get; set; }
- /// <summary>
- /// Gets or sets the precip MM.
- /// </summary>
- /// <value>The precip MM.</value>
- public string precipMM { get; set; }
- /// <summary>
- /// Gets or sets the temp max C.
- /// </summary>
- /// <value>The temp max C.</value>
- public string tempMaxC { get; set; }
- /// <summary>
- /// Gets or sets the temp max F.
- /// </summary>
- /// <value>The temp max F.</value>
- public string tempMaxF { get; set; }
- /// <summary>
- /// Gets or sets the temp min C.
- /// </summary>
- /// <value>The temp min C.</value>
- public string tempMinC { get; set; }
- /// <summary>
- /// Gets or sets the temp min F.
- /// </summary>
- /// <value>The temp min F.</value>
- public string tempMinF { get; set; }
- /// <summary>
- /// Gets or sets the weather code.
- /// </summary>
- /// <value>The weather code.</value>
- public string weatherCode { get; set; }
- /// <summary>
- /// Gets or sets the winddir16 point.
- /// </summary>
- /// <value>The winddir16 point.</value>
- public string winddir16Point { get; set; }
- /// <summary>
- /// Gets or sets the winddir degree.
- /// </summary>
- /// <value>The winddir degree.</value>
- public string winddirDegree { get; set; }
- /// <summary>
- /// Gets or sets the winddirection.
- /// </summary>
- /// <value>The winddirection.</value>
- public string winddirection { get; set; }
- /// <summary>
- /// Gets or sets the windspeed KMPH.
- /// </summary>
- /// <value>The windspeed KMPH.</value>
- public string windspeedKmph { get; set; }
- /// <summary>
- /// Gets or sets the windspeed miles.
- /// </summary>
- /// <value>The windspeed miles.</value>
- public string windspeedMiles { get; set; }
-
- protected static readonly CultureInfo UsCulture = new CultureInfo("en-US");
-
- /// <summary>
- /// To the weather forecast.
- /// </summary>
- /// <returns>WeatherForecast.</returns>
- public WeatherForecast ToWeatherForecast()
- {
- return new WeatherForecast
- {
- Date = DateTime.Parse(date, UsCulture),
- HighTemperatureCelsius = int.Parse(tempMaxC, UsCulture),
- HighTemperatureFahrenheit = int.Parse(tempMaxF, UsCulture),
- LowTemperatureCelsius = int.Parse(tempMinC, UsCulture),
- LowTemperatureFahrenheit = int.Parse(tempMinF, UsCulture),
- Condition = GetCondition(weatherCode)
- };
- }
-
- /// <summary>
- /// Gets the condition.
- /// </summary>
- /// <param name="weatherCode">The weather code.</param>
- /// <returns>WeatherConditions.</returns>
- public static WeatherConditions GetCondition(string weatherCode)
- {
- switch (weatherCode)
- {
- case "362":
- case "365":
- case "320":
- case "317":
- case "182":
- return WeatherConditions.Sleet;
- case "338":
- case "335":
- case "332":
- case "329":
- case "326":
- case "323":
- case "377":
- case "374":
- case "371":
- case "368":
- case "395":
- case "392":
- case "350":
- case "227":
- case "179":
- return WeatherConditions.Snow;
- case "314":
- case "311":
- case "308":
- case "305":
- case "302":
- case "299":
- case "296":
- case "293":
- case "284":
- case "281":
- case "266":
- case "263":
- case "359":
- case "356":
- case "353":
- case "185":
- case "176":
- return WeatherConditions.Rain;
- case "260":
- case "248":
- return WeatherConditions.Fog;
- case "389":
- case "386":
- case "200":
- return WeatherConditions.Thunderstorm;
- case "230":
- return WeatherConditions.Blizzard;
- case "143":
- return WeatherConditions.Mist;
- case "122":
- return WeatherConditions.Overcast;
- case "119":
- return WeatherConditions.Cloudy;
- case "115":
- return WeatherConditions.PartlyCloudy;
- default:
- return WeatherConditions.Sunny;
- }
- }
- }
-} \ No newline at end of file
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index c260087b8..9f28006ba 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -23,7 +23,6 @@ using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Controller.Updates;
-using MediaBrowser.Controller.Weather;
using MediaBrowser.IsoMounter;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
@@ -311,7 +310,6 @@ namespace MediaBrowser.ServerApplication
ApplicationPaths, ItemRepository);
Parallel.Invoke(
() => ServerKernel.FFMpegManager = new FFMpegManager(ApplicationPaths, MediaEncoder, LibraryManager, Logger, ItemRepository),
- () => ServerKernel.WeatherProviders = GetExports<IWeatherProvider>(),
() => ServerKernel.ImageManager.ImageEnhancers = GetExports<IImageEnhancer>().OrderBy(e => e.Priority).ToArray(),
() => LocalizedStrings.StringFiles = GetExports<LocalizedStringData>(),
SetStaticProperties
diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js
index 31d11c945..f047501d2 100644
--- a/MediaBrowser.WebDashboard/ApiClient.js
+++ b/MediaBrowser.WebDashboard/ApiClient.js
@@ -1246,24 +1246,6 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
};
/**
- * Gets weather info
- * @param {String} location - us zip code / city, state, country / city, country
- * Omit location to get weather info using stored server configuration value
- */
- self.getWeatherInfo = function (location) {
-
- var url = self.getUrl("weather", {
- location: location
- });
-
- return self.ajax({
- type: "GET",
- url: url,
- dataType: "json"
- });
- };
-
- /**
* Gets all users from the server
*/
self.getUsers = function () {
diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.config
index 1d3d4e10f..fa2c71701 100644
--- a/MediaBrowser.WebDashboard/packages.config
+++ b/MediaBrowser.WebDashboard/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="MediaBrowser.ApiClient.Javascript" version="3.0.124" targetFramework="net45" />
+ <package id="MediaBrowser.ApiClient.Javascript" version="3.0.125" targetFramework="net45" />
<package id="ServiceStack.Common" version="3.9.54" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.54" targetFramework="net45" />
</packages> \ No newline at end of file