|
|
@ -1,6 +1,4 @@
|
|
|
|
using MediaBrowser.Common.Extensions;
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
|
|
|
|
using MediaBrowser.Model.Logging;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
@ -44,15 +42,14 @@ namespace MediaBrowser.Controller.Localization
|
|
|
|
/// <param name="key">The key.</param>
|
|
|
|
/// <param name="key">The key.</param>
|
|
|
|
/// <param name="value">The value.</param>
|
|
|
|
/// <param name="value">The value.</param>
|
|
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
|
|
private static bool TryAdd<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
|
|
|
|
private static void TryAdd<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (dictionary.ContainsKey(key))
|
|
|
|
if (dictionary.ContainsKey(key))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dictionary.Add(key, value);
|
|
|
|
dictionary.Add(key, value);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -65,7 +62,7 @@ namespace MediaBrowser.Controller.Localization
|
|
|
|
//build our ratings dictionary from the combined local one and us one
|
|
|
|
//build our ratings dictionary from the combined local one and us one
|
|
|
|
ratingsDef = new RatingsDefinition(Path.Combine(configurationManager.ApplicationPaths.LocalizationPath, "Ratings-" + configurationManager.Configuration.MetadataCountryCode + ".txt"), configurationManager);
|
|
|
|
ratingsDef = new RatingsDefinition(Path.Combine(configurationManager.ApplicationPaths.LocalizationPath, "Ratings-" + configurationManager.Configuration.MetadataCountryCode + ".txt"), configurationManager);
|
|
|
|
//global value of None
|
|
|
|
//global value of None
|
|
|
|
var dict = new Dictionary<string, int> {{"None", -1}};
|
|
|
|
var dict = new Dictionary<string, int> { { "None", -1 } };
|
|
|
|
foreach (var pair in ratingsDef.RatingsDict)
|
|
|
|
foreach (var pair in ratingsDef.RatingsDict)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TryAdd(dict, pair.Key, pair.Value);
|
|
|
|
TryAdd(dict, pair.Key, pair.Value);
|
|
|
@ -85,7 +82,7 @@ namespace MediaBrowser.Controller.Localization
|
|
|
|
//and rating reverse lookup dictionary (non-redundant ones)
|
|
|
|
//and rating reverse lookup dictionary (non-redundant ones)
|
|
|
|
ratingsStrings.Clear();
|
|
|
|
ratingsStrings.Clear();
|
|
|
|
var lastLevel = -10;
|
|
|
|
var lastLevel = -10;
|
|
|
|
ratingsStrings.Add(-1,LocalizedStrings.Instance.GetString("Any"));
|
|
|
|
ratingsStrings.Add(-1, LocalizedStrings.Instance.GetString("Any"));
|
|
|
|
foreach (var pair in ratingsDef.RatingsDict.OrderBy(p => p.Value))
|
|
|
|
foreach (var pair in ratingsDef.RatingsDict.OrderBy(p => p.Value))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (pair.Value > lastLevel)
|
|
|
|
if (pair.Value > lastLevel)
|
|
|
|