support track selection before playback

This commit is contained in:
Luke Pulverenti
2017-11-05 16:51:23 -05:00
parent b9c1f61681
commit 5cb7469028
41 changed files with 355 additions and 675 deletions

View File

@@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Localization
var localizationPath = LocalizationPath;
_fileSystem.CreateDirectory(localizationPath);
_fileSystem.CreateDirectory(localizationPath);
var existingFiles = GetRatingsFiles(localizationPath)
.Select(Path.GetFileName)
@@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.Localization
}
}
}
foreach (var file in GetRatingsFiles(localizationPath))
{
LoadRatings(file);
@@ -128,12 +128,20 @@ namespace Emby.Server.Implementations.Localization
return _textLocalizer.NormalizeFormKD(text);
}
private CultureDto[] _cultures;
/// <summary>
/// Gets the cultures.
/// </summary>
/// <returns>IEnumerable{CultureDto}.</returns>
public CultureDto[] GetCultures()
{
var result = _cultures;
if (result != null)
{
return result;
}
var type = GetType();
var path = type.Namespace + ".iso6392.txt";
@@ -166,10 +174,14 @@ namespace Emby.Server.Implementations.Localization
}
}
return list.Where(i => !string.IsNullOrWhiteSpace(i.Name) &&
!string.IsNullOrWhiteSpace(i.DisplayName) &&
!string.IsNullOrWhiteSpace(i.ThreeLetterISOLanguageName) &&
!string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray();
result = list.Where(i => !string.IsNullOrWhiteSpace(i.Name) &&
!string.IsNullOrWhiteSpace(i.DisplayName) &&
!string.IsNullOrWhiteSpace(i.ThreeLetterISOLanguageName) &&
!string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray();
_cultures = result;
return result;
}
/// <summary>
@@ -239,7 +251,7 @@ namespace Emby.Server.Implementations.Localization
/// <returns>Dictionary{System.StringParentalRating}.</returns>
private void LoadRatings(string file)
{
var dict = _fileSystem.ReadAllLines(file).Select(i =>
var dict = _fileSystem.ReadAllLines(file).Select(i =>
{
if (!string.IsNullOrWhiteSpace(i))
{
@@ -269,7 +281,7 @@ namespace Emby.Server.Implementations.Localization
_allParentalRatings.TryAdd(countryCode, dict);
}
private readonly string[] _unratedValues = {"n/a", "unrated", "not rated"};
private readonly string[] _unratedValues = { "n/a", "unrated", "not rated" };
/// <summary>
/// Gets the rating level.