diff --git a/MediaBrowser.Api/LocalizationService.cs b/MediaBrowser.Api/LocalizationService.cs
index aa01f3f136..d52f94b3c8 100644
--- a/MediaBrowser.Api/LocalizationService.cs
+++ b/MediaBrowser.Api/LocalizationService.cs
@@ -1,10 +1,8 @@
using MediaBrowser.Controller.Localization;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
-using MoreLinq;
using ServiceStack.ServiceHost;
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
namespace MediaBrowser.Api
@@ -41,6 +39,20 @@ namespace MediaBrowser.Api
///
public class LocalizationService : BaseApiService
{
+ ///
+ /// The _localization
+ ///
+ private readonly ILocalizationManager _localization;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The localization.
+ public LocalizationService(ILocalizationManager localization)
+ {
+ _localization = localization;
+ }
+
///
/// Gets the specified request.
///
@@ -48,10 +60,7 @@ namespace MediaBrowser.Api
/// System.Object.
public object Get(GetParentalRatings request)
{
- var ratings =
- Ratings.RatingsDict.Select(k => new ParentalRating { Name = k.Key, Value = k.Value });
-
- var result = ratings.OrderBy(p => p.Value).Where(p => p.Value > 0).ToList();
+ var result = _localization.GetParentalRatings().ToList();
return ToOptimizedResult(result);
}
@@ -63,22 +72,7 @@ namespace MediaBrowser.Api
/// System.Object.
public object Get(GetCountries request)
{
- var result = CultureInfo.GetCultures(CultureTypes.SpecificCultures)
-
- .Select(c => new RegionInfo(c.LCID))
- .OrderBy(c => c.DisplayName)
-
- // Try to eliminate dupes
- .DistinctBy(c => c.TwoLetterISORegionName)
-
- .Select(c => new CountryInfo
- {
- Name = c.Name,
- DisplayName = c.DisplayName,
- TwoLetterISORegionName = c.TwoLetterISORegionName,
- ThreeLetterISORegionName = c.ThreeLetterISORegionName
- })
- .ToList();
+ var result = _localization.GetCountries().ToList();
return ToOptimizedResult(result);
}
@@ -90,20 +84,7 @@ namespace MediaBrowser.Api
/// System.Object.
public object Get(GetCultures request)
{
- var result = CultureInfo.GetCultures(CultureTypes.AllCultures)
- .OrderBy(c => c.DisplayName)
-
- // Try to eliminate dupes
- .DistinctBy(c => c.TwoLetterISOLanguageName + c.ThreeLetterISOLanguageName)
-
- .Select(c => new CultureDto
- {
- Name = c.Name,
- DisplayName = c.DisplayName,
- ThreeLetterISOLanguageName = c.ThreeLetterISOLanguageName,
- TwoLetterISOLanguageName = c.TwoLetterISOLanguageName
- })
- .ToList();
+ var result = _localization.GetCultures().ToList();
return ToOptimizedResult(result);
}
diff --git a/MediaBrowser.Controller/Localization/ILocalizationManager.cs b/MediaBrowser.Controller/Localization/ILocalizationManager.cs
new file mode 100644
index 0000000000..487c4a48e6
--- /dev/null
+++ b/MediaBrowser.Controller/Localization/ILocalizationManager.cs
@@ -0,0 +1,28 @@
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Globalization;
+using System.Collections.Generic;
+
+namespace MediaBrowser.Controller.Localization
+{
+ ///
+ /// Interface ILocalizationManager
+ ///
+ public interface ILocalizationManager
+ {
+ ///
+ /// Gets the cultures.
+ ///
+ /// IEnumerable{CultureDto}.
+ IEnumerable GetCultures();
+ ///
+ /// Gets the countries.
+ ///
+ /// IEnumerable{CountryInfo}.
+ IEnumerable GetCountries();
+ ///
+ /// Gets the parental ratings.
+ ///
+ /// IEnumerable{ParentalRating}.
+ IEnumerable GetParentalRatings();
+ }
+}
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index cdcc456223..04e0a31ac6 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -76,6 +76,7 @@
+
diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs
index c95f0771fa..91fd29b240 100644
--- a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs
+++ b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs
@@ -3,6 +3,7 @@ using MediaBrowser.Common.MediaInfo;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
+using MediaBrowser.Controller.Localization;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
@@ -21,7 +22,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
///
public class FFProbeVideoInfoProvider : BaseFFProbeProvider