From 51edd5d067c919800f504bfa9fe1708279faaa3f Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sun, 27 Jan 2019 10:20:05 +0100 Subject: Reworked LocalizationManager to load data async --- .../Localization/LocalizationManager.cs | 279 +++++++++------------ .../Localization/Ratings/br.csv | 6 + .../Localization/Ratings/br.txt | 6 - .../Localization/Ratings/ca.csv | 6 + .../Localization/Ratings/ca.txt | 6 - .../Localization/Ratings/co.csv | 8 + .../Localization/Ratings/co.txt | 8 - .../Localization/Ratings/dk.csv | 4 + .../Localization/Ratings/dk.txt | 4 - .../Localization/Ratings/es.csv | 6 + .../Localization/Ratings/es.txt | 6 - .../Localization/Ratings/fr.csv | 5 + .../Localization/Ratings/fr.txt | 5 - .../Localization/Ratings/gb.csv | 7 + .../Localization/Ratings/gb.txt | 7 - .../Localization/Ratings/ie.csv | 6 + .../Localization/Ratings/ie.txt | 6 - .../Localization/Ratings/jp.csv | 4 + .../Localization/Ratings/jp.txt | 4 - .../Localization/Ratings/kz.csv | 6 + .../Localization/Ratings/kz.txt | 6 - .../Localization/Ratings/mx.csv | 6 + .../Localization/Ratings/mx.txt | 6 - .../Localization/Ratings/nl.csv | 6 + .../Localization/Ratings/nl.txt | 6 - .../Localization/Ratings/nz.csv | 11 + .../Localization/Ratings/nz.txt | 11 - .../Localization/Ratings/ro.csv | 1 + .../Localization/Ratings/ro.txt | 1 - .../Localization/Ratings/uk.csv | 7 + .../Localization/Ratings/uk.txt | 7 - .../Localization/Ratings/us.csv | 23 ++ .../Localization/Ratings/us.txt | 23 -- .../Localization/TextLocalizer.cs | 63 ----- 34 files changed, 235 insertions(+), 331 deletions(-) create mode 100644 Emby.Server.Implementations/Localization/Ratings/br.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/br.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/ca.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/ca.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/co.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/co.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/dk.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/dk.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/es.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/es.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/fr.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/fr.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/gb.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/gb.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/ie.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/ie.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/jp.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/jp.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/kz.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/kz.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/mx.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/mx.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/nl.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/nl.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/nz.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/nz.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/ro.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/ro.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/uk.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/uk.txt create mode 100644 Emby.Server.Implementations/Localization/Ratings/us.csv delete mode 100644 Emby.Server.Implementations/Localization/Ratings/us.txt delete mode 100644 Emby.Server.Implementations/Localization/TextLocalizer.cs (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index c408a47f6..47834940b 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -4,12 +4,14 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Globalization; using MediaBrowser.Model.IO; -using MediaBrowser.Model.Reflection; using MediaBrowser.Model.Serialization; using Microsoft.Extensions.Logging; @@ -36,8 +38,7 @@ namespace Emby.Server.Implementations.Localization private readonly IFileSystem _fileSystem; private readonly IJsonSerializer _jsonSerializer; private readonly ILogger _logger; - private readonly IAssemblyInfo _assemblyInfo; - private readonly ITextLocalizer _textLocalizer; + private static readonly Assembly _assembly = typeof(LocalizationManager).Assembly; /// /// Initializes a new instance of the class. @@ -49,67 +50,57 @@ namespace Emby.Server.Implementations.Localization IServerConfigurationManager configurationManager, IFileSystem fileSystem, IJsonSerializer jsonSerializer, - ILoggerFactory loggerFactory, - IAssemblyInfo assemblyInfo, - ITextLocalizer textLocalizer) + ILoggerFactory loggerFactory) { _configurationManager = configurationManager; _fileSystem = fileSystem; _jsonSerializer = jsonSerializer; _logger = loggerFactory.CreateLogger(nameof(LocalizationManager)); - _assemblyInfo = assemblyInfo; - _textLocalizer = textLocalizer; - - ExtractAll(); } - private void ExtractAll() + public async Task LoadAll() { - var type = GetType(); - var resourcePath = type.Namespace + ".Ratings."; - - var localizationPath = LocalizationPath; + const string ratingsResource = "Emby.Server.Implementations.Ratings."; - _fileSystem.CreateDirectory(localizationPath); + Directory.CreateDirectory(LocalizationPath); - var existingFiles = GetRatingsFiles(localizationPath) - .Select(Path.GetFileName) - .ToList(); + var existingFiles = GetRatingsFiles(LocalizationPath).Select(Path.GetFileName); // Extract from the assembly - foreach (var resource in _assemblyInfo - .GetManifestResourceNames(type) - .Where(i => i.StartsWith(resourcePath))) + foreach (var resource in _assembly.GetManifestResourceNames() + .Where(i => i.StartsWith(ratingsResource))) { - var filename = "ratings-" + resource.Substring(resourcePath.Length); + string filename = "ratings-" + resource.Substring(ratingsResource.Length); if (!existingFiles.Contains(filename)) { - using (var stream = _assemblyInfo.GetManifestResourceStream(type, resource)) + using (var stream = _assembly.GetManifestResourceStream(resource)) { - var target = Path.Combine(localizationPath, filename); + string target = Path.Combine(LocalizationPath, filename); _logger.LogInformation("Extracting ratings to {0}", target); using (var fs = _fileSystem.GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) { - stream.CopyTo(fs); + await stream.CopyToAsync(fs); } } } } - foreach (var file in GetRatingsFiles(localizationPath)) + foreach (var file in GetRatingsFiles(LocalizationPath)) { - LoadRatings(file); + await LoadRatings(file); } LoadAdditionalRatings(); + + await LoadCultures(); } private void LoadAdditionalRatings() { - LoadRatings("au", new[] { - + LoadRatings("au", new[] + { new ParentalRating("AU-G", 1), new ParentalRating("AU-PG", 5), new ParentalRating("AU-M", 6), @@ -120,8 +111,8 @@ namespace Emby.Server.Implementations.Localization new ParentalRating("AU-RC", 11) }); - LoadRatings("be", new[] { - + LoadRatings("be", new[] + { new ParentalRating("BE-AL", 1), new ParentalRating("BE-MG6", 2), new ParentalRating("BE-6", 3), @@ -130,8 +121,8 @@ namespace Emby.Server.Implementations.Localization new ParentalRating("BE-16", 8) }); - LoadRatings("de", new[] { - + LoadRatings("de", new[] + { new ParentalRating("DE-0", 1), new ParentalRating("FSK-0", 1), new ParentalRating("DE-6", 5), @@ -144,8 +135,8 @@ namespace Emby.Server.Implementations.Localization new ParentalRating("FSK-18", 9) }); - LoadRatings("ru", new[] { - + LoadRatings("ru", new[] + { new ParentalRating("RU-0+", 1), new ParentalRating("RU-6+", 3), new ParentalRating("RU-12+", 7), @@ -159,29 +150,20 @@ namespace Emby.Server.Implementations.Localization _allParentalRatings[country] = ratings.ToDictionary(i => i.Name); } - private List GetRatingsFiles(string directory) - { - return _fileSystem.GetFilePaths(directory, false) - .Where(i => string.Equals(Path.GetExtension(i), ".txt", StringComparison.OrdinalIgnoreCase)) - .Where(i => Path.GetFileName(i).StartsWith("ratings-", StringComparison.OrdinalIgnoreCase)) - .ToList(); - } + private IEnumerable GetRatingsFiles(string directory) + => _fileSystem.GetFilePaths(directory, false) + .Where(i => string.Equals(Path.GetExtension(i), ".csv", StringComparison.OrdinalIgnoreCase)) + .Where(i => Path.GetFileName(i).StartsWith("ratings-", StringComparison.OrdinalIgnoreCase)); /// /// Gets the localization path. /// /// The localization path. - public string LocalizationPath => Path.Combine(_configurationManager.ApplicationPaths.ProgramDataPath, "localization"); - - public string RemoveDiacritics(string text) - { - return _textLocalizer.RemoveDiacritics(text); - } + public string LocalizationPath + => Path.Combine(_configurationManager.ApplicationPaths.ProgramDataPath, "localization"); public string NormalizeFormKD(string text) - { - return _textLocalizer.NormalizeFormKD(text); - } + => text.Normalize(NormalizationForm.FormKD); private CultureDto[] _cultures; @@ -190,90 +172,88 @@ namespace Emby.Server.Implementations.Localization /// /// IEnumerable{CultureDto}. public CultureDto[] GetCultures() - { - var result = _cultures; - if (result != null) - { - return result; - } + => _cultures; - var type = GetType(); - var path = type.Namespace + ".iso6392.txt"; + private async Task LoadCultures() + { + List list = new List(); - var list = new List(); + const string path = "Emby.Server.Implementations.Localization.iso6392.txt"; - using (var stream = _assemblyInfo.GetManifestResourceStream(type, path)) + using (var stream = _assembly.GetManifestResourceStream(path)) + using (var reader = new StreamReader(stream)) { - using (var reader = new StreamReader(stream)) + while (!reader.EndOfStream) { - while (!reader.EndOfStream) + var line = await reader.ReadLineAsync(); + + if (string.IsNullOrWhiteSpace(line)) + { + continue; + } + + var parts = line.Split('|'); + + if (parts.Length == 5) { - var line = reader.ReadLine(); + string name = parts[3]; + if (string.IsNullOrWhiteSpace(name)) + { + continue; + } + + string twoCharName = parts[2]; + if (string.IsNullOrWhiteSpace(twoCharName)) + { + continue; + } - if (!string.IsNullOrWhiteSpace(line)) + string[] threeletterNames; + if (string.IsNullOrWhiteSpace(parts[1])) { - var parts = line.Split('|'); - - if (parts.Length == 5) - { - var threeletterNames = new List { parts[0] }; - if (!string.IsNullOrWhiteSpace(parts[1])) - { - threeletterNames.Add(parts[1]); - } - - list.Add(new CultureDto - { - DisplayName = parts[3], - Name = parts[3], - ThreeLetterISOLanguageNames = threeletterNames.ToArray(), - TwoLetterISOLanguageName = parts[2] - }); - } + threeletterNames = new [] { parts[0] }; } + else + { + threeletterNames = new [] { parts[0], parts[1] }; + } + + list.Add(new CultureDto + { + DisplayName = name, + Name = name, + ThreeLetterISOLanguageNames = threeletterNames, + TwoLetterISOLanguageName = twoCharName + }); } } } - result = list.Where(i => !string.IsNullOrWhiteSpace(i.Name) && - !string.IsNullOrWhiteSpace(i.DisplayName) && - i.ThreeLetterISOLanguageNames.Length > 0 && - !string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray(); - - _cultures = result; - - return result; + _cultures = list.ToArray(); } public CultureDto FindLanguageInfo(string language) - { - return GetCultures() - .FirstOrDefault(i => string.Equals(i.DisplayName, language, StringComparison.OrdinalIgnoreCase) || - string.Equals(i.Name, language, StringComparison.OrdinalIgnoreCase) || - i.ThreeLetterISOLanguageNames.Contains(language, StringComparer.OrdinalIgnoreCase) || - string.Equals(i.TwoLetterISOLanguageName, language, StringComparison.OrdinalIgnoreCase)); - } + => GetCultures() + .FirstOrDefault(i => + string.Equals(i.DisplayName, language, StringComparison.OrdinalIgnoreCase) + || string.Equals(i.Name, language, StringComparison.OrdinalIgnoreCase) + || i.ThreeLetterISOLanguageNames.Contains(language, StringComparer.OrdinalIgnoreCase) + || string.Equals(i.TwoLetterISOLanguageName, language, StringComparison.OrdinalIgnoreCase)); /// /// Gets the countries. /// /// IEnumerable{CountryInfo}. - public CountryInfo[] GetCountries() - { - // ToDo: DeserializeFromStream seems broken in this case - string jsonCountries = "[{\"Name\":\"AF\",\"DisplayName\":\"Afghanistan\",\"TwoLetterISORegionName\":\"AF\",\"ThreeLetterISORegionName\":\"AFG\"},{\"Name\":\"AL\",\"DisplayName\":\"Albania\",\"TwoLetterISORegionName\":\"AL\",\"ThreeLetterISORegionName\":\"ALB\"},{\"Name\":\"DZ\",\"DisplayName\":\"Algeria\",\"TwoLetterISORegionName\":\"DZ\",\"ThreeLetterISORegionName\":\"DZA\"},{\"Name\":\"AR\",\"DisplayName\":\"Argentina\",\"TwoLetterISORegionName\":\"AR\",\"ThreeLetterISORegionName\":\"ARG\"},{\"Name\":\"AM\",\"DisplayName\":\"Armenia\",\"TwoLetterISORegionName\":\"AM\",\"ThreeLetterISORegionName\":\"ARM\"},{\"Name\":\"AU\",\"DisplayName\":\"Australia\",\"TwoLetterISORegionName\":\"AU\",\"ThreeLetterISORegionName\":\"AUS\"},{\"Name\":\"AT\",\"DisplayName\":\"Austria\",\"TwoLetterISORegionName\":\"AT\",\"ThreeLetterISORegionName\":\"AUT\"},{\"Name\":\"AZ\",\"DisplayName\":\"Azerbaijan\",\"TwoLetterISORegionName\":\"AZ\",\"ThreeLetterISORegionName\":\"AZE\"},{\"Name\":\"BH\",\"DisplayName\":\"Bahrain\",\"TwoLetterISORegionName\":\"BH\",\"ThreeLetterISORegionName\":\"BHR\"},{\"Name\":\"BD\",\"DisplayName\":\"Bangladesh\",\"TwoLetterISORegionName\":\"BD\",\"ThreeLetterISORegionName\":\"BGD\"},{\"Name\":\"BY\",\"DisplayName\":\"Belarus\",\"TwoLetterISORegionName\":\"BY\",\"ThreeLetterISORegionName\":\"BLR\"},{\"Name\":\"BE\",\"DisplayName\":\"Belgium\",\"TwoLetterISORegionName\":\"BE\",\"ThreeLetterISORegionName\":\"BEL\"},{\"Name\":\"BZ\",\"DisplayName\":\"Belize\",\"TwoLetterISORegionName\":\"BZ\",\"ThreeLetterISORegionName\":\"BLZ\"},{\"Name\":\"VE\",\"DisplayName\":\"Bolivarian Republic of Venezuela\",\"TwoLetterISORegionName\":\"VE\",\"ThreeLetterISORegionName\":\"VEN\"},{\"Name\":\"BO\",\"DisplayName\":\"Bolivia\",\"TwoLetterISORegionName\":\"BO\",\"ThreeLetterISORegionName\":\"BOL\"},{\"Name\":\"BA\",\"DisplayName\":\"Bosnia and Herzegovina\",\"TwoLetterISORegionName\":\"BA\",\"ThreeLetterISORegionName\":\"BIH\"},{\"Name\":\"BW\",\"DisplayName\":\"Botswana\",\"TwoLetterISORegionName\":\"BW\",\"ThreeLetterISORegionName\":\"BWA\"},{\"Name\":\"BR\",\"DisplayName\":\"Brazil\",\"TwoLetterISORegionName\":\"BR\",\"ThreeLetterISORegionName\":\"BRA\"},{\"Name\":\"BN\",\"DisplayName\":\"Brunei Darussalam\",\"TwoLetterISORegionName\":\"BN\",\"ThreeLetterISORegionName\":\"BRN\"},{\"Name\":\"BG\",\"DisplayName\":\"Bulgaria\",\"TwoLetterISORegionName\":\"BG\",\"ThreeLetterISORegionName\":\"BGR\"},{\"Name\":\"KH\",\"DisplayName\":\"Cambodia\",\"TwoLetterISORegionName\":\"KH\",\"ThreeLetterISORegionName\":\"KHM\"},{\"Name\":\"CM\",\"DisplayName\":\"Cameroon\",\"TwoLetterISORegionName\":\"CM\",\"ThreeLetterISORegionName\":\"CMR\"},{\"Name\":\"CA\",\"DisplayName\":\"Canada\",\"TwoLetterISORegionName\":\"CA\",\"ThreeLetterISORegionName\":\"CAN\"},{\"Name\":\"029\",\"DisplayName\":\"Caribbean\",\"TwoLetterISORegionName\":\"029\",\"ThreeLetterISORegionName\":\"029\"},{\"Name\":\"CL\",\"DisplayName\":\"Chile\",\"TwoLetterISORegionName\":\"CL\",\"ThreeLetterISORegionName\":\"CHL\"},{\"Name\":\"CO\",\"DisplayName\":\"Colombia\",\"TwoLetterISORegionName\":\"CO\",\"ThreeLetterISORegionName\":\"COL\"},{\"Name\":\"CD\",\"DisplayName\":\"Congo [DRC]\",\"TwoLetterISORegionName\":\"CD\",\"ThreeLetterISORegionName\":\"COD\"},{\"Name\":\"CR\",\"DisplayName\":\"Costa Rica\",\"TwoLetterISORegionName\":\"CR\",\"ThreeLetterISORegionName\":\"CRI\"},{\"Name\":\"HR\",\"DisplayName\":\"Croatia\",\"TwoLetterISORegionName\":\"HR\",\"ThreeLetterISORegionName\":\"HRV\"},{\"Name\":\"CZ\",\"DisplayName\":\"Czech Republic\",\"TwoLetterISORegionName\":\"CZ\",\"ThreeLetterISORegionName\":\"CZE\"},{\"Name\":\"DK\",\"DisplayName\":\"Denmark\",\"TwoLetterISORegionName\":\"DK\",\"ThreeLetterISORegionName\":\"DNK\"},{\"Name\":\"DO\",\"DisplayName\":\"Dominican Republic\",\"TwoLetterISORegionName\":\"DO\",\"ThreeLetterISORegionName\":\"DOM\"},{\"Name\":\"EC\",\"DisplayName\":\"Ecuador\",\"TwoLetterISORegionName\":\"EC\",\"ThreeLetterISORegionName\":\"ECU\"},{\"Name\":\"EG\",\"DisplayName\":\"Egypt\",\"TwoLetterISORegionName\":\"EG\",\"ThreeLetterISORegionName\":\"EGY\"},{\"Name\":\"SV\",\"DisplayName\":\"El Salvador\",\"TwoLetterISORegionName\":\"SV\",\"ThreeLetterISORegionName\":\"SLV\"},{\"Name\":\"ER\",\"DisplayName\":\"Eritrea\",\"TwoLetterISORegionName\":\"ER\",\"ThreeLetterISORegionName\":\"ERI\"},{\"Name\":\"EE\",\"DisplayName\":\"Estonia\",\"TwoLetterISORegionName\":\"EE\",\"ThreeLetterISORegionName\":\"EST\"},{\"Name\":\"ET\",\"DisplayName\":\"Ethiopia\",\"TwoLetterISORegionName\":\"ET\",\"ThreeLetterISORegionName\":\"ETH\"},{\"Name\":\"FO\",\"DisplayName\":\"Faroe Islands\",\"TwoLetterISORegionName\":\"FO\",\"ThreeLetterISORegionName\":\"FRO\"},{\"Name\":\"FI\",\"DisplayName\":\"Finland\",\"TwoLetterISORegionName\":\"FI\",\"ThreeLetterISORegionName\":\"FIN\"},{\"Name\":\"FR\",\"DisplayName\":\"France\",\"TwoLetterISORegionName\":\"FR\",\"ThreeLetterISORegionName\":\"FRA\"},{\"Name\":\"GE\",\"DisplayName\":\"Georgia\",\"TwoLetterISORegionName\":\"GE\",\"ThreeLetterISORegionName\":\"GEO\"},{\"Name\":\"DE\",\"DisplayName\":\"Germany\",\"TwoLetterISORegionName\":\"DE\",\"ThreeLetterISORegionName\":\"DEU\"},{\"Name\":\"GR\",\"DisplayName\":\"Greece\",\"TwoLetterISORegionName\":\"GR\",\"ThreeLetterISORegionName\":\"GRC\"},{\"Name\":\"GL\",\"DisplayName\":\"Greenland\",\"TwoLetterISORegionName\":\"GL\",\"ThreeLetterISORegionName\":\"GRL\"},{\"Name\":\"GT\",\"DisplayName\":\"Guatemala\",\"TwoLetterISORegionName\":\"GT\",\"ThreeLetterISORegionName\":\"GTM\"},{\"Name\":\"HT\",\"DisplayName\":\"Haiti\",\"TwoLetterISORegionName\":\"HT\",\"ThreeLetterISORegionName\":\"HTI\"},{\"Name\":\"HN\",\"DisplayName\":\"Honduras\",\"TwoLetterISORegionName\":\"HN\",\"ThreeLetterISORegionName\":\"HND\"},{\"Name\":\"HK\",\"DisplayName\":\"Hong Kong S.A.R.\",\"TwoLetterISORegionName\":\"HK\",\"ThreeLetterISORegionName\":\"HKG\"},{\"Name\":\"HU\",\"DisplayName\":\"Hungary\",\"TwoLetterISORegionName\":\"HU\",\"ThreeLetterISORegionName\":\"HUN\"},{\"Name\":\"IS\",\"DisplayName\":\"Iceland\",\"TwoLetterISORegionName\":\"IS\",\"ThreeLetterISORegionName\":\"ISL\"},{\"Name\":\"IN\",\"DisplayName\":\"India\",\"TwoLetterISORegionName\":\"IN\",\"ThreeLetterISORegionName\":\"IND\"},{\"Name\":\"ID\",\"DisplayName\":\"Indonesia\",\"TwoLetterISORegionName\":\"ID\",\"ThreeLetterISORegionName\":\"IDN\"},{\"Name\":\"IR\",\"DisplayName\":\"Iran\",\"TwoLetterISORegionName\":\"IR\",\"ThreeLetterISORegionName\":\"IRN\"},{\"Name\":\"IQ\",\"DisplayName\":\"Iraq\",\"TwoLetterISORegionName\":\"IQ\",\"ThreeLetterISORegionName\":\"IRQ\"},{\"Name\":\"IE\",\"DisplayName\":\"Ireland\",\"TwoLetterISORegionName\":\"IE\",\"ThreeLetterISORegionName\":\"IRL\"},{\"Name\":\"PK\",\"DisplayName\":\"Islamic Republic of Pakistan\",\"TwoLetterISORegionName\":\"PK\",\"ThreeLetterISORegionName\":\"PAK\"},{\"Name\":\"IL\",\"DisplayName\":\"Israel\",\"TwoLetterISORegionName\":\"IL\",\"ThreeLetterISORegionName\":\"ISR\"},{\"Name\":\"IT\",\"DisplayName\":\"Italy\",\"TwoLetterISORegionName\":\"IT\",\"ThreeLetterISORegionName\":\"ITA\"},{\"Name\":\"CI\",\"DisplayName\":\"Ivory Coast\",\"TwoLetterISORegionName\":\"CI\",\"ThreeLetterISORegionName\":\"CIV\"},{\"Name\":\"JM\",\"DisplayName\":\"Jamaica\",\"TwoLetterISORegionName\":\"JM\",\"ThreeLetterISORegionName\":\"JAM\"},{\"Name\":\"JP\",\"DisplayName\":\"Japan\",\"TwoLetterISORegionName\":\"JP\",\"ThreeLetterISORegionName\":\"JPN\"},{\"Name\":\"JO\",\"DisplayName\":\"Jordan\",\"TwoLetterISORegionName\":\"JO\",\"ThreeLetterISORegionName\":\"JOR\"},{\"Name\":\"KZ\",\"DisplayName\":\"Kazakhstan\",\"TwoLetterISORegionName\":\"KZ\",\"ThreeLetterISORegionName\":\"KAZ\"},{\"Name\":\"KE\",\"DisplayName\":\"Kenya\",\"TwoLetterISORegionName\":\"KE\",\"ThreeLetterISORegionName\":\"KEN\"},{\"Name\":\"KR\",\"DisplayName\":\"Korea\",\"TwoLetterISORegionName\":\"KR\",\"ThreeLetterISORegionName\":\"KOR\"},{\"Name\":\"KW\",\"DisplayName\":\"Kuwait\",\"TwoLetterISORegionName\":\"KW\",\"ThreeLetterISORegionName\":\"KWT\"},{\"Name\":\"KG\",\"DisplayName\":\"Kyrgyzstan\",\"TwoLetterISORegionName\":\"KG\",\"ThreeLetterISORegionName\":\"KGZ\"},{\"Name\":\"LA\",\"DisplayName\":\"Lao P.D.R.\",\"TwoLetterISORegionName\":\"LA\",\"ThreeLetterISORegionName\":\"LAO\"},{\"Name\":\"419\",\"DisplayName\":\"Latin America\",\"TwoLetterISORegionName\":\"419\",\"ThreeLetterISORegionName\":\"419\"},{\"Name\":\"LV\",\"DisplayName\":\"Latvia\",\"TwoLetterISORegionName\":\"LV\",\"ThreeLetterISORegionName\":\"LVA\"},{\"Name\":\"LB\",\"DisplayName\":\"Lebanon\",\"TwoLetterISORegionName\":\"LB\",\"ThreeLetterISORegionName\":\"LBN\"},{\"Name\":\"LY\",\"DisplayName\":\"Libya\",\"TwoLetterISORegionName\":\"LY\",\"ThreeLetterISORegionName\":\"LBY\"},{\"Name\":\"LI\",\"DisplayName\":\"Liechtenstein\",\"TwoLetterISORegionName\":\"LI\",\"ThreeLetterISORegionName\":\"LIE\"},{\"Name\":\"LT\",\"DisplayName\":\"Lithuania\",\"TwoLetterISORegionName\":\"LT\",\"ThreeLetterISORegionName\":\"LTU\"},{\"Name\":\"LU\",\"DisplayName\":\"Luxembourg\",\"TwoLetterISORegionName\":\"LU\",\"ThreeLetterISORegionName\":\"LUX\"},{\"Name\":\"MO\",\"DisplayName\":\"Macao S.A.R.\",\"TwoLetterISORegionName\":\"MO\",\"ThreeLetterISORegionName\":\"MAC\"},{\"Name\":\"MK\",\"DisplayName\":\"Macedonia (FYROM)\",\"TwoLetterISORegionName\":\"MK\",\"ThreeLetterISORegionName\":\"MKD\"},{\"Name\":\"MY\",\"DisplayName\":\"Malaysia\",\"TwoLetterISORegionName\":\"MY\",\"ThreeLetterISORegionName\":\"MYS\"},{\"Name\":\"MV\",\"DisplayName\":\"Maldives\",\"TwoLetterISORegionName\":\"MV\",\"ThreeLetterISORegionName\":\"MDV\"},{\"Name\":\"ML\",\"DisplayName\":\"Mali\",\"TwoLetterISORegionName\":\"ML\",\"ThreeLetterISORegionName\":\"MLI\"},{\"Name\":\"MT\",\"DisplayName\":\"Malta\",\"TwoLetterISORegionName\":\"MT\",\"ThreeLetterISORegionName\":\"MLT\"},{\"Name\":\"MX\",\"DisplayName\":\"Mexico\",\"TwoLetterISORegionName\":\"MX\",\"ThreeLetterISORegionName\":\"MEX\"},{\"Name\":\"MN\",\"DisplayName\":\"Mongolia\",\"TwoLetterISORegionName\":\"MN\",\"ThreeLetterISORegionName\":\"MNG\"},{\"Name\":\"ME\",\"DisplayName\":\"Montenegro\",\"TwoLetterISORegionName\":\"ME\",\"ThreeLetterISORegionName\":\"MNE\"},{\"Name\":\"MA\",\"DisplayName\":\"Morocco\",\"TwoLetterISORegionName\":\"MA\",\"ThreeLetterISORegionName\":\"MAR\"},{\"Name\":\"NP\",\"DisplayName\":\"Nepal\",\"TwoLetterISORegionName\":\"NP\",\"ThreeLetterISORegionName\":\"NPL\"},{\"Name\":\"NL\",\"DisplayName\":\"Netherlands\",\"TwoLetterISORegionName\":\"NL\",\"ThreeLetterISORegionName\":\"NLD\"},{\"Name\":\"NZ\",\"DisplayName\":\"New Zealand\",\"TwoLetterISORegionName\":\"NZ\",\"ThreeLetterISORegionName\":\"NZL\"},{\"Name\":\"NI\",\"DisplayName\":\"Nicaragua\",\"TwoLetterISORegionName\":\"NI\",\"ThreeLetterISORegionName\":\"NIC\"},{\"Name\":\"NG\",\"DisplayName\":\"Nigeria\",\"TwoLetterISORegionName\":\"NG\",\"ThreeLetterISORegionName\":\"NGA\"},{\"Name\":\"NO\",\"DisplayName\":\"Norway\",\"TwoLetterISORegionName\":\"NO\",\"ThreeLetterISORegionName\":\"NOR\"},{\"Name\":\"OM\",\"DisplayName\":\"Oman\",\"TwoLetterISORegionName\":\"OM\",\"ThreeLetterISORegionName\":\"OMN\"},{\"Name\":\"PA\",\"DisplayName\":\"Panama\",\"TwoLetterISORegionName\":\"PA\",\"ThreeLetterISORegionName\":\"PAN\"},{\"Name\":\"PY\",\"DisplayName\":\"Paraguay\",\"TwoLetterISORegionName\":\"PY\",\"ThreeLetterISORegionName\":\"PRY\"},{\"Name\":\"CN\",\"DisplayName\":\"People's Republic of China\",\"TwoLetterISORegionName\":\"CN\",\"ThreeLetterISORegionName\":\"CHN\"},{\"Name\":\"PE\",\"DisplayName\":\"Peru\",\"TwoLetterISORegionName\":\"PE\",\"ThreeLetterISORegionName\":\"PER\"},{\"Name\":\"PH\",\"DisplayName\":\"Philippines\",\"TwoLetterISORegionName\":\"PH\",\"ThreeLetterISORegionName\":\"PHL\"},{\"Name\":\"PL\",\"DisplayName\":\"Poland\",\"TwoLetterISORegionName\":\"PL\",\"ThreeLetterISORegionName\":\"POL\"},{\"Name\":\"PT\",\"DisplayName\":\"Portugal\",\"TwoLetterISORegionName\":\"PT\",\"ThreeLetterISORegionName\":\"PRT\"},{\"Name\":\"MC\",\"DisplayName\":\"Principality of Monaco\",\"TwoLetterISORegionName\":\"MC\",\"ThreeLetterISORegionName\":\"MCO\"},{\"Name\":\"PR\",\"DisplayName\":\"Puerto Rico\",\"TwoLetterISORegionName\":\"PR\",\"ThreeLetterISORegionName\":\"PRI\"},{\"Name\":\"QA\",\"DisplayName\":\"Qatar\",\"TwoLetterISORegionName\":\"QA\",\"ThreeLetterISORegionName\":\"QAT\"},{\"Name\":\"MD\",\"DisplayName\":\"Republica Moldova\",\"TwoLetterISORegionName\":\"MD\",\"ThreeLetterISORegionName\":\"MDA\"},{\"Name\":\"RE\",\"DisplayName\":\"Réunion\",\"TwoLetterISORegionName\":\"RE\",\"ThreeLetterISORegionName\":\"REU\"},{\"Name\":\"RO\",\"DisplayName\":\"Romania\",\"TwoLetterISORegionName\":\"RO\",\"ThreeLetterISORegionName\":\"ROU\"},{\"Name\":\"RU\",\"DisplayName\":\"Russia\",\"TwoLetterISORegionName\":\"RU\",\"ThreeLetterISORegionName\":\"RUS\"},{\"Name\":\"RW\",\"DisplayName\":\"Rwanda\",\"TwoLetterISORegionName\":\"RW\",\"ThreeLetterISORegionName\":\"RWA\"},{\"Name\":\"SA\",\"DisplayName\":\"Saudi Arabia\",\"TwoLetterISORegionName\":\"SA\",\"ThreeLetterISORegionName\":\"SAU\"},{\"Name\":\"SN\",\"DisplayName\":\"Senegal\",\"TwoLetterISORegionName\":\"SN\",\"ThreeLetterISORegionName\":\"SEN\"},{\"Name\":\"RS\",\"DisplayName\":\"Serbia\",\"TwoLetterISORegionName\":\"RS\",\"ThreeLetterISORegionName\":\"SRB\"},{\"Name\":\"CS\",\"DisplayName\":\"Serbia and Montenegro (Former)\",\"TwoLetterISORegionName\":\"CS\",\"ThreeLetterISORegionName\":\"SCG\"},{\"Name\":\"SG\",\"DisplayName\":\"Singapore\",\"TwoLetterISORegionName\":\"SG\",\"ThreeLetterISORegionName\":\"SGP\"},{\"Name\":\"SK\",\"DisplayName\":\"Slovakia\",\"TwoLetterISORegionName\":\"SK\",\"ThreeLetterISORegionName\":\"SVK\"},{\"Name\":\"SI\",\"DisplayName\":\"Slovenia\",\"TwoLetterISORegionName\":\"SI\",\"ThreeLetterISORegionName\":\"SVN\"},{\"Name\":\"SO\",\"DisplayName\":\"Soomaaliya\",\"TwoLetterISORegionName\":\"SO\",\"ThreeLetterISORegionName\":\"SOM\"},{\"Name\":\"ZA\",\"DisplayName\":\"South Africa\",\"TwoLetterISORegionName\":\"ZA\",\"ThreeLetterISORegionName\":\"ZAF\"},{\"Name\":\"ES\",\"DisplayName\":\"Spain\",\"TwoLetterISORegionName\":\"ES\",\"ThreeLetterISORegionName\":\"ESP\"},{\"Name\":\"LK\",\"DisplayName\":\"Sri Lanka\",\"TwoLetterISORegionName\":\"LK\",\"ThreeLetterISORegionName\":\"LKA\"},{\"Name\":\"SE\",\"DisplayName\":\"Sweden\",\"TwoLetterISORegionName\":\"SE\",\"ThreeLetterISORegionName\":\"SWE\"},{\"Name\":\"CH\",\"DisplayName\":\"Switzerland\",\"TwoLetterISORegionName\":\"CH\",\"ThreeLetterISORegionName\":\"CHE\"},{\"Name\":\"SY\",\"DisplayName\":\"Syria\",\"TwoLetterISORegionName\":\"SY\",\"ThreeLetterISORegionName\":\"SYR\"},{\"Name\":\"TW\",\"DisplayName\":\"Taiwan\",\"TwoLetterISORegionName\":\"TW\",\"ThreeLetterISORegionName\":\"TWN\"},{\"Name\":\"TJ\",\"DisplayName\":\"Tajikistan\",\"TwoLetterISORegionName\":\"TJ\",\"ThreeLetterISORegionName\":\"TAJ\"},{\"Name\":\"TH\",\"DisplayName\":\"Thailand\",\"TwoLetterISORegionName\":\"TH\",\"ThreeLetterISORegionName\":\"THA\"},{\"Name\":\"TT\",\"DisplayName\":\"Trinidad and Tobago\",\"TwoLetterISORegionName\":\"TT\",\"ThreeLetterISORegionName\":\"TTO\"},{\"Name\":\"TN\",\"DisplayName\":\"Tunisia\",\"TwoLetterISORegionName\":\"TN\",\"ThreeLetterISORegionName\":\"TUN\"},{\"Name\":\"TR\",\"DisplayName\":\"Turkey\",\"TwoLetterISORegionName\":\"TR\",\"ThreeLetterISORegionName\":\"TUR\"},{\"Name\":\"TM\",\"DisplayName\":\"Turkmenistan\",\"TwoLetterISORegionName\":\"TM\",\"ThreeLetterISORegionName\":\"TKM\"},{\"Name\":\"AE\",\"DisplayName\":\"U.A.E.\",\"TwoLetterISORegionName\":\"AE\",\"ThreeLetterISORegionName\":\"ARE\"},{\"Name\":\"UA\",\"DisplayName\":\"Ukraine\",\"TwoLetterISORegionName\":\"UA\",\"ThreeLetterISORegionName\":\"UKR\"},{\"Name\":\"GB\",\"DisplayName\":\"United Kingdom\",\"TwoLetterISORegionName\":\"GB\",\"ThreeLetterISORegionName\":\"GBR\"},{\"Name\":\"US\",\"DisplayName\":\"United States\",\"TwoLetterISORegionName\":\"US\",\"ThreeLetterISORegionName\":\"USA\"},{\"Name\":\"UY\",\"DisplayName\":\"Uruguay\",\"TwoLetterISORegionName\":\"UY\",\"ThreeLetterISORegionName\":\"URY\"},{\"Name\":\"UZ\",\"DisplayName\":\"Uzbekistan\",\"TwoLetterISORegionName\":\"UZ\",\"ThreeLetterISORegionName\":\"UZB\"},{\"Name\":\"VN\",\"DisplayName\":\"Vietnam\",\"TwoLetterISORegionName\":\"VN\",\"ThreeLetterISORegionName\":\"VNM\"},{\"Name\":\"YE\",\"DisplayName\":\"Yemen\",\"TwoLetterISORegionName\":\"YE\",\"ThreeLetterISORegionName\":\"YEM\"},{\"Name\":\"ZW\",\"DisplayName\":\"Zimbabwe\",\"TwoLetterISORegionName\":\"ZW\",\"ThreeLetterISORegionName\":\"ZWE\"}]"; - - return _jsonSerializer.DeserializeFromString(jsonCountries); - } + public Task GetCountries() + => _jsonSerializer.DeserializeFromStreamAsync( + _assembly.GetManifestResourceStream("Emby.Server.Implementations.Localization.countries.json")); /// /// Gets the parental ratings. /// /// IEnumerable{ParentalRating}. - public ParentalRating[] GetParentalRatings() - { - return GetParentalRatingsDictionary().Values.ToArray(); - } + public IEnumerable GetParentalRatings() + => GetParentalRatingsDictionary().Values; /// /// Gets the parental ratings dictionary. @@ -288,12 +268,7 @@ namespace Emby.Server.Implementations.Localization countryCode = "us"; } - var ratings = GetRatings(countryCode); - - if (ratings == null) - { - ratings = GetRatings("us"); - } + var ratings = GetRatings(countryCode) ?? GetRatings("us"); return ratings; } @@ -314,37 +289,38 @@ namespace Emby.Server.Implementations.Localization /// /// The file. /// Dictionary{System.StringParentalRating}. - private void LoadRatings(string file) + private async Task LoadRatings(string file) { - var dict = _fileSystem.ReadAllLines(file).Select(i => + Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase); + using (var str = File.OpenRead(file)) + using (var reader = new StreamReader(str)) { - if (!string.IsNullOrWhiteSpace(i)) + string line; + while ((line = await reader.ReadLineAsync()) != null) { - var parts = i.Split(','); + if (string.IsNullOrWhiteSpace(line)) + { + continue; + } - if (parts.Length == 2) + string[] parts = line.Split(','); + if (parts.Length == 2 + && int.TryParse(parts[1], NumberStyles.Integer, UsCulture, out var value)) { - if (int.TryParse(parts[1], NumberStyles.Integer, UsCulture, out var value)) - { - return new ParentalRating { Name = parts[0], Value = value }; - } + dict.Add(parts[0], (new ParentalRating { Name = parts[0], Value = value })); } +#if DEBUG + _logger.LogWarning("Misformed line in {Path}", file); +#endif } + } - return null; - - }) - .Where(i => i != null) - .ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase); - - var countryCode = _fileSystem.GetFileNameWithoutExtension(file) - .Split('-') - .Last(); + var countryCode = Path.GetFileNameWithoutExtension(file).Split('-')[1]; _allParentalRatings[countryCode] = dict; } - private readonly string[] _unratedValues = { "n/a", "unrated", "not rated" }; + private static readonly string[] _unratedValues = { "n/a", "unrated", "not rated" }; /// /// Gets the rating level. @@ -435,7 +411,7 @@ namespace Emby.Server.Implementations.Localization return phrase; } - const string DefaultCulture = "en-US"; + private const string DefaultCulture = "en-US"; private readonly ConcurrentDictionary> _dictionaries = new ConcurrentDictionary>(StringComparer.OrdinalIgnoreCase); @@ -450,10 +426,11 @@ namespace Emby.Server.Implementations.Localization const string prefix = "Core"; var key = prefix + culture; - return _dictionaries.GetOrAdd(key, k => GetDictionary(prefix, culture, DefaultCulture + ".json")); + return _dictionaries.GetOrAdd(key, + f => GetDictionary(prefix, culture, DefaultCulture + ".json").GetAwaiter().GetResult()); } - private Dictionary GetDictionary(string prefix, string culture, string baseFilename) + private async Task> GetDictionary(string prefix, string culture, string baseFilename) { if (string.IsNullOrEmpty(culture)) { @@ -464,24 +441,21 @@ namespace Emby.Server.Implementations.Localization var namespaceName = GetType().Namespace + "." + prefix; - CopyInto(dictionary, namespaceName + "." + baseFilename); - CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture)); + await CopyInto(dictionary, namespaceName + "." + baseFilename); + await CopyInto(dictionary, namespaceName + "." + GetResourceFilename(culture)); return dictionary; } - private void CopyInto(IDictionary dictionary, string resourcePath) + private async Task CopyInto(IDictionary dictionary, string resourcePath) { - using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), resourcePath)) + using (var stream = _assembly.GetManifestResourceStream(resourcePath)) { - if (stream != null) - { - var dict = _jsonSerializer.DeserializeFromStream>(stream); + var dict = await _jsonSerializer.DeserializeFromStreamAsync>(stream); - foreach (var key in dict.Keys) - { - dictionary[key] = dict[key]; - } + foreach (var key in dict.Keys) + { + dictionary[key] = dict[key]; } } } @@ -552,11 +526,4 @@ namespace Emby.Server.Implementations.Localization new LocalizationOption("Vietnamese", "vi") }; } - - public interface ITextLocalizer - { - string RemoveDiacritics(string text); - - string NormalizeFormKD(string text); - } } diff --git a/Emby.Server.Implementations/Localization/Ratings/br.csv b/Emby.Server.Implementations/Localization/Ratings/br.csv new file mode 100644 index 000000000..e5edaf62c --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/br.csv @@ -0,0 +1,6 @@ +BR-L,1 +BR-10,5 +BR-12,7 +BR-14,8 +BR-16,8 +BR-18,9 diff --git a/Emby.Server.Implementations/Localization/Ratings/br.txt b/Emby.Server.Implementations/Localization/Ratings/br.txt deleted file mode 100644 index e5edaf62c..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/br.txt +++ /dev/null @@ -1,6 +0,0 @@ -BR-L,1 -BR-10,5 -BR-12,7 -BR-14,8 -BR-16,8 -BR-18,9 diff --git a/Emby.Server.Implementations/Localization/Ratings/ca.csv b/Emby.Server.Implementations/Localization/Ratings/ca.csv new file mode 100644 index 000000000..5aef0580f --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/ca.csv @@ -0,0 +1,6 @@ +CA-G,1 +CA-PG,5 +CA-14A,7 +CA-A,8 +CA-18A,9 +CA-R,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/ca.txt b/Emby.Server.Implementations/Localization/Ratings/ca.txt deleted file mode 100644 index 5aef0580f..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/ca.txt +++ /dev/null @@ -1,6 +0,0 @@ -CA-G,1 -CA-PG,5 -CA-14A,7 -CA-A,8 -CA-18A,9 -CA-R,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/co.csv b/Emby.Server.Implementations/Localization/Ratings/co.csv new file mode 100644 index 000000000..9684fa052 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/co.csv @@ -0,0 +1,8 @@ +CO-T,1 +CO-7,5 +CO-12,7 +CO-15,8 +CO-18,10 +CO-X,100 +CO-BANNED,15 +CO-E,15 diff --git a/Emby.Server.Implementations/Localization/Ratings/co.txt b/Emby.Server.Implementations/Localization/Ratings/co.txt deleted file mode 100644 index 9684fa052..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/co.txt +++ /dev/null @@ -1,8 +0,0 @@ -CO-T,1 -CO-7,5 -CO-12,7 -CO-15,8 -CO-18,10 -CO-X,100 -CO-BANNED,15 -CO-E,15 diff --git a/Emby.Server.Implementations/Localization/Ratings/dk.csv b/Emby.Server.Implementations/Localization/Ratings/dk.csv new file mode 100644 index 000000000..5364ae1f2 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/dk.csv @@ -0,0 +1,4 @@ +DA-A,1 +DA-7,5 +DA-11,6 +DA-15,8 diff --git a/Emby.Server.Implementations/Localization/Ratings/dk.txt b/Emby.Server.Implementations/Localization/Ratings/dk.txt deleted file mode 100644 index 5364ae1f2..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/dk.txt +++ /dev/null @@ -1,4 +0,0 @@ -DA-A,1 -DA-7,5 -DA-11,6 -DA-15,8 diff --git a/Emby.Server.Implementations/Localization/Ratings/es.csv b/Emby.Server.Implementations/Localization/Ratings/es.csv new file mode 100644 index 000000000..887d91ba6 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/es.csv @@ -0,0 +1,6 @@ +ES-A,1 +ES-APTA,1 +ES-7,3 +ES-12,6 +ES-16,8 +ES-18,11 diff --git a/Emby.Server.Implementations/Localization/Ratings/es.txt b/Emby.Server.Implementations/Localization/Ratings/es.txt deleted file mode 100644 index 887d91ba6..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/es.txt +++ /dev/null @@ -1,6 +0,0 @@ -ES-A,1 -ES-APTA,1 -ES-7,3 -ES-12,6 -ES-16,8 -ES-18,11 diff --git a/Emby.Server.Implementations/Localization/Ratings/fr.csv b/Emby.Server.Implementations/Localization/Ratings/fr.csv new file mode 100644 index 000000000..f586a3fa9 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/fr.csv @@ -0,0 +1,5 @@ +FR-U,1 +FR-10,5 +FR-12,7 +FR-16,9 +FR-18,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/fr.txt b/Emby.Server.Implementations/Localization/Ratings/fr.txt deleted file mode 100644 index f586a3fa9..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/fr.txt +++ /dev/null @@ -1,5 +0,0 @@ -FR-U,1 -FR-10,5 -FR-12,7 -FR-16,9 -FR-18,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/gb.csv b/Emby.Server.Implementations/Localization/Ratings/gb.csv new file mode 100644 index 000000000..c1f7d0452 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/gb.csv @@ -0,0 +1,7 @@ +GB-U,1 +GB-PG,5 +GB-12,6 +GB-12A,7 +GB-15,8 +GB-18,9 +GB-R18,15 diff --git a/Emby.Server.Implementations/Localization/Ratings/gb.txt b/Emby.Server.Implementations/Localization/Ratings/gb.txt deleted file mode 100644 index c1f7d0452..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/gb.txt +++ /dev/null @@ -1,7 +0,0 @@ -GB-U,1 -GB-PG,5 -GB-12,6 -GB-12A,7 -GB-15,8 -GB-18,9 -GB-R18,15 diff --git a/Emby.Server.Implementations/Localization/Ratings/ie.csv b/Emby.Server.Implementations/Localization/Ratings/ie.csv new file mode 100644 index 000000000..e42be5cd4 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/ie.csv @@ -0,0 +1,6 @@ +IE-G,1 +IE-PG,5 +IE-12A,7 +IE-15A,8 +IE-16,9 +IE-18,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/ie.txt b/Emby.Server.Implementations/Localization/Ratings/ie.txt deleted file mode 100644 index e42be5cd4..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/ie.txt +++ /dev/null @@ -1,6 +0,0 @@ -IE-G,1 -IE-PG,5 -IE-12A,7 -IE-15A,8 -IE-16,9 -IE-18,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/jp.csv b/Emby.Server.Implementations/Localization/Ratings/jp.csv new file mode 100644 index 000000000..a8fc2d143 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/jp.csv @@ -0,0 +1,4 @@ +JP-G,1 +JP-PG12,7 +JP-15+,8 +JP-18+,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/jp.txt b/Emby.Server.Implementations/Localization/Ratings/jp.txt deleted file mode 100644 index a8fc2d143..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/jp.txt +++ /dev/null @@ -1,4 +0,0 @@ -JP-G,1 -JP-PG12,7 -JP-15+,8 -JP-18+,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/kz.csv b/Emby.Server.Implementations/Localization/Ratings/kz.csv new file mode 100644 index 000000000..4441c5650 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/kz.csv @@ -0,0 +1,6 @@ +KZ-К,1 +KZ-БА,6 +KZ-Б14,7 +KZ-Е16,8 +KZ-Е18,10 +KZ-НА,15 diff --git a/Emby.Server.Implementations/Localization/Ratings/kz.txt b/Emby.Server.Implementations/Localization/Ratings/kz.txt deleted file mode 100644 index 4441c5650..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/kz.txt +++ /dev/null @@ -1,6 +0,0 @@ -KZ-К,1 -KZ-БА,6 -KZ-Б14,7 -KZ-Е16,8 -KZ-Е18,10 -KZ-НА,15 diff --git a/Emby.Server.Implementations/Localization/Ratings/mx.csv b/Emby.Server.Implementations/Localization/Ratings/mx.csv new file mode 100644 index 000000000..785a8ba22 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/mx.csv @@ -0,0 +1,6 @@ +MX-AA,1 +MX-A,5 +MX-B,7 +MX-B-15,8 +MX-C,9 +MX-D,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/mx.txt b/Emby.Server.Implementations/Localization/Ratings/mx.txt deleted file mode 100644 index 785a8ba22..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/mx.txt +++ /dev/null @@ -1,6 +0,0 @@ -MX-AA,1 -MX-A,5 -MX-B,7 -MX-B-15,8 -MX-C,9 -MX-D,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/nl.csv b/Emby.Server.Implementations/Localization/Ratings/nl.csv new file mode 100644 index 000000000..8c005092e --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/nl.csv @@ -0,0 +1,6 @@ +NL-AL,1 +NL-MG6,2 +NL-6,3 +NL-9,5 +NL-12,6 +NL-16,8 diff --git a/Emby.Server.Implementations/Localization/Ratings/nl.txt b/Emby.Server.Implementations/Localization/Ratings/nl.txt deleted file mode 100644 index 8c005092e..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/nl.txt +++ /dev/null @@ -1,6 +0,0 @@ -NL-AL,1 -NL-MG6,2 -NL-6,3 -NL-9,5 -NL-12,6 -NL-16,8 diff --git a/Emby.Server.Implementations/Localization/Ratings/nz.csv b/Emby.Server.Implementations/Localization/Ratings/nz.csv new file mode 100644 index 000000000..bba99b764 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/nz.csv @@ -0,0 +1,11 @@ +NZ-G,1 +NZ-PG,5 +NZ-M,6 +NZ-R13,7 +NZ-RP13,7 +NZ-R15,8 +NZ-RP16,9 +NZ-R16,9 +NZ-R18,10 +NZ-R,10 +NZ-MA,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/nz.txt b/Emby.Server.Implementations/Localization/Ratings/nz.txt deleted file mode 100644 index bba99b764..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/nz.txt +++ /dev/null @@ -1,11 +0,0 @@ -NZ-G,1 -NZ-PG,5 -NZ-M,6 -NZ-R13,7 -NZ-RP13,7 -NZ-R15,8 -NZ-RP16,9 -NZ-R16,9 -NZ-R18,10 -NZ-R,10 -NZ-MA,10 diff --git a/Emby.Server.Implementations/Localization/Ratings/ro.csv b/Emby.Server.Implementations/Localization/Ratings/ro.csv new file mode 100644 index 000000000..4089b282f --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/ro.csv @@ -0,0 +1 @@ +RO-AG,1 diff --git a/Emby.Server.Implementations/Localization/Ratings/ro.txt b/Emby.Server.Implementations/Localization/Ratings/ro.txt deleted file mode 100644 index 4089b282f..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/ro.txt +++ /dev/null @@ -1 +0,0 @@ -RO-AG,1 diff --git a/Emby.Server.Implementations/Localization/Ratings/uk.csv b/Emby.Server.Implementations/Localization/Ratings/uk.csv new file mode 100644 index 000000000..6c8005b3f --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/uk.csv @@ -0,0 +1,7 @@ +UK-U,1 +UK-PG,5 +UK-12,7 +UK-12A,7 +UK-15,9 +UK-18,10 +UK-R18,15 diff --git a/Emby.Server.Implementations/Localization/Ratings/uk.txt b/Emby.Server.Implementations/Localization/Ratings/uk.txt deleted file mode 100644 index 6c8005b3f..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/uk.txt +++ /dev/null @@ -1,7 +0,0 @@ -UK-U,1 -UK-PG,5 -UK-12,7 -UK-12A,7 -UK-15,9 -UK-18,10 -UK-R18,15 diff --git a/Emby.Server.Implementations/Localization/Ratings/us.csv b/Emby.Server.Implementations/Localization/Ratings/us.csv new file mode 100644 index 000000000..34c897fe3 --- /dev/null +++ b/Emby.Server.Implementations/Localization/Ratings/us.csv @@ -0,0 +1,23 @@ +TV-Y,1 +APPROVED,1 +G,1 +E,1 +EC,1 +TV-G,1 +TV-Y7,3 +TV-Y7-FV,4 +PG,5 +TV-PG,5 +PG-13,7 +T,7 +TV-14,8 +R,9 +M,9 +TV-MA,9 +NC-17,10 +AO,15 +RP,15 +UR,15 +NR,15 +X,15 +XXX,100 diff --git a/Emby.Server.Implementations/Localization/Ratings/us.txt b/Emby.Server.Implementations/Localization/Ratings/us.txt deleted file mode 100644 index 34c897fe3..000000000 --- a/Emby.Server.Implementations/Localization/Ratings/us.txt +++ /dev/null @@ -1,23 +0,0 @@ -TV-Y,1 -APPROVED,1 -G,1 -E,1 -EC,1 -TV-G,1 -TV-Y7,3 -TV-Y7-FV,4 -PG,5 -TV-PG,5 -PG-13,7 -T,7 -TV-14,8 -R,9 -M,9 -TV-MA,9 -NC-17,10 -AO,15 -RP,15 -UR,15 -NR,15 -X,15 -XXX,100 diff --git a/Emby.Server.Implementations/Localization/TextLocalizer.cs b/Emby.Server.Implementations/Localization/TextLocalizer.cs deleted file mode 100644 index 96591e5e6..000000000 --- a/Emby.Server.Implementations/Localization/TextLocalizer.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; - -namespace Emby.Server.Implementations.Localization -{ - public class TextLocalizer : ITextLocalizer - { - public string RemoveDiacritics(string text) - { - if (text == null) - { - throw new ArgumentNullException(nameof(text)); - } - - var chars = Normalize(text, NormalizationForm.FormD) - .Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) != UnicodeCategory.NonSpacingMark); - - return Normalize(string.Concat(chars), NormalizationForm.FormC); - } - - private static string Normalize(string text, NormalizationForm form, bool stripStringOnFailure = true) - { - if (stripStringOnFailure) - { - try - { - return text.Normalize(form); - } - catch (ArgumentException) - { - // will throw if input contains invalid unicode chars - // https://mnaoumov.wordpress.com/2014/06/14/stripping-invalid-characters-from-utf-16-strings/ - text = StripInvalidUnicodeCharacters(text); - return Normalize(text, form, false); - } - } - - try - { - return text.Normalize(form); - } - catch (ArgumentException) - { - // if it still fails, return the original text - return text; - } - } - - private static string StripInvalidUnicodeCharacters(string str) - { - var invalidCharactersRegex = new Regex("([\ud800-\udbff](?![\udc00-\udfff]))|((? Date: Sun, 27 Jan 2019 12:03:43 +0100 Subject: Fix more analyzer warnings --- Emby.Dlna/Api/DlnaServerService.cs | 4 +- Emby.Dlna/Didl/DidlBuilder.cs | 8 +- Emby.Dlna/DlnaManager.cs | 6 +- Emby.Dlna/Main/DlnaEntryPoint.cs | 2 +- Emby.Dlna/PlayTo/Device.cs | 68 ++++++---- Emby.Dlna/Server/DescriptionXmlBuilder.cs | 146 ++++++++++----------- Emby.Drawing/ImageProcessor.cs | 4 +- Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs | 7 +- .../AppBase/BaseConfigurationManager.cs | 2 +- .../Data/SqliteItemRepository.cs | 6 +- .../HttpClientManager/HttpClientManager.cs | 6 +- .../HttpServer/HttpResultFactory.cs | 2 +- .../Library/LibraryManager.cs | 2 +- .../LiveTv/EmbyTV/EmbyTV.cs | 2 +- .../LiveTv/LiveTvDtoService.cs | 8 +- .../Localization/LocalizationManager.cs | 4 +- .../Services/RequestHelper.cs | 2 +- .../Services/ServiceExec.cs | 2 +- .../Services/ServiceMethod.cs | 2 +- .../Services/ServicePath.cs | 10 +- .../Services/SwaggerService.cs | 28 ++-- Jellyfin.Drawing.Skia/StripCollageBuilder.cs | 2 +- Jellyfin.Server/SocketSharp/RequestMono.cs | 25 ++-- .../SocketSharp/WebSocketSharpRequest.cs | 41 ++++-- MediaBrowser.Api/Images/ImageByNameService.cs | 2 +- MediaBrowser.Api/LiveTv/LiveTvService.cs | 4 +- MediaBrowser.Api/Playback/BaseStreamingService.cs | 4 +- MediaBrowser.Controller/Entities/BaseItem.cs | 4 +- MediaBrowser.Controller/Entities/Video.cs | 2 +- .../MediaEncoding/EncodingHelper.cs | 16 +-- .../Images/LocalImageProvider.cs | 2 +- MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs | 6 +- MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs | 4 +- MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs | 24 ++-- MediaBrowser.Model/Dlna/StreamInfo.cs | 22 ++-- MediaBrowser.Model/Entities/MediaStream.cs | 6 +- MediaBrowser.Model/Extensions/StringHelper.cs | 2 +- MediaBrowser.Model/MediaInfo/AudioCodec.cs | 9 +- MediaBrowser.Model/Net/MimeTypes.cs | 2 +- MediaBrowser.Providers/Manager/ImageSaver.cs | 4 +- .../Manager/ItemImageProvider.cs | 2 +- .../MediaInfo/SubtitleResolver.cs | 2 +- MediaBrowser.Providers/Movies/MovieDbProvider.cs | 2 +- MediaBrowser.Providers/Movies/MovieDbSearch.cs | 2 +- .../Subtitles/SubtitleManager.cs | 6 +- .../TV/TheTVDB/TvdbSeriesProvider.cs | 6 +- MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs | 25 ++-- SocketHttpListener/Ext.cs | 2 +- SocketHttpListener/Net/HttpListenerRequest.cs | 2 +- 49 files changed, 290 insertions(+), 261 deletions(-) (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Dlna/Api/DlnaServerService.cs b/Emby.Dlna/Api/DlnaServerService.cs index 01c9fe50f..68bf80163 100644 --- a/Emby.Dlna/Api/DlnaServerService.cs +++ b/Emby.Dlna/Api/DlnaServerService.cs @@ -236,7 +236,9 @@ namespace Emby.Dlna.Api public object Get(GetIcon request) { - var contentType = "image/" + Path.GetExtension(request.Filename).TrimStart('.').ToLower(); + var contentType = "image/" + Path.GetExtension(request.Filename) + .TrimStart('.') + .ToLowerInvariant(); var cacheLength = TimeSpan.FromDays(365); var cacheKey = Request.RawUrl.GetMD5(); diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index 440f96b3f..24c10b389 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -265,7 +265,7 @@ namespace Emby.Dlna.Didl // http://192.168.1.3:9999/video.srt writer.WriteStartElement("sec", "CaptionInfoEx", null); - writer.WriteAttributeString("sec", "type", null, info.Format.ToLower()); + writer.WriteAttributeString("sec", "type", null, info.Format.ToLowerInvariant()); writer.WriteString(info.Url); writer.WriteFullEndElement(); @@ -282,7 +282,7 @@ namespace Emby.Dlna.Didl else { writer.WriteStartElement(string.Empty, "res", NS_DIDL); - var protocolInfo = string.Format("http-get:*:text/{0}:*", info.Format.ToLower()); + var protocolInfo = string.Format("http-get:*:text/{0}:*", info.Format.ToLowerInvariant()); writer.WriteAttributeString("protocolInfo", protocolInfo); writer.WriteString(info.Url); @@ -844,7 +844,7 @@ namespace Emby.Dlna.Didl // var type = types.FirstOrDefault(i => string.Equals(i, actor.Type, StringComparison.OrdinalIgnoreCase) || string.Equals(i, actor.Role, StringComparison.OrdinalIgnoreCase)) // ?? PersonType.Actor; - // AddValue(writer, "upnp", type.ToLower(), actor.Name, NS_UPNP); + // AddValue(writer, "upnp", type.ToLowerInvariant(), actor.Name, NS_UPNP); // index++; @@ -1147,7 +1147,7 @@ namespace Emby.Dlna.Didl if (stubType.HasValue) { - id = stubType.Value.ToString().ToLower() + "_" + id; + id = stubType.Value.ToString().ToLowerInvariant() + "_" + id; } return id; diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs index f795b58cb..a668b3b21 100644 --- a/Emby.Dlna/DlnaManager.cs +++ b/Emby.Dlna/DlnaManager.cs @@ -300,7 +300,7 @@ namespace Emby.Dlna profile = ReserializeProfile(tempProfile); - profile.Id = path.ToLower().GetMD5().ToString("N"); + profile.Id = path.ToLowerInvariant().GetMD5().ToString("N"); _profiles[path] = new Tuple(GetInternalProfileInfo(_fileSystem.GetFileInfo(path), type), profile); @@ -352,7 +352,7 @@ namespace Emby.Dlna Info = new DeviceProfileInfo { - Id = file.FullName.ToLower().GetMD5().ToString("N"), + Id = file.FullName.ToLowerInvariant().GetMD5().ToString("N"), Name = _fileSystem.GetFileNameWithoutExtension(file), Type = type } @@ -506,7 +506,7 @@ namespace Emby.Dlna ? ImageFormat.Png : ImageFormat.Jpg; - var resource = GetType().Namespace + ".Images." + filename.ToLower(); + var resource = GetType().Namespace + ".Images." + filename.ToLowerInvariant(); return new ImageStream { diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs index 1ab6014eb..ad90da49b 100644 --- a/Emby.Dlna/Main/DlnaEntryPoint.cs +++ b/Emby.Dlna/Main/DlnaEntryPoint.cs @@ -263,7 +263,7 @@ namespace Emby.Dlna.Main var fullService = "urn:schemas-upnp-org:device:MediaServer:1"; - _logger.LogInformation("Registering publisher for {0} on {1}", fullService, address.ToString()); + _logger.LogInformation("Registering publisher for {0} on {1}", fullService, address); var descriptorUri = "/dlna/" + udn + "/description.xml"; var uri = new Uri(_appHost.GetLocalApiUrl(address) + descriptorUri); diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs index 68aa0a6a7..85a522d1c 100644 --- a/Emby.Dlna/PlayTo/Device.cs +++ b/Emby.Dlna/PlayTo/Device.cs @@ -902,54 +902,75 @@ namespace Emby.Dlna.PlayTo var name = document.Descendants(uPnpNamespaces.ud.GetName("friendlyName")).FirstOrDefault(); if (name != null && !string.IsNullOrWhiteSpace(name.Value)) + { friendlyNames.Add(name.Value); + } var room = document.Descendants(uPnpNamespaces.ud.GetName("roomName")).FirstOrDefault(); if (room != null && !string.IsNullOrWhiteSpace(room.Value)) + { friendlyNames.Add(room.Value); + } - deviceProperties.Name = string.Join(" ", friendlyNames.ToArray()); + deviceProperties.Name = string.Join(" ", friendlyNames); var model = document.Descendants(uPnpNamespaces.ud.GetName("modelName")).FirstOrDefault(); if (model != null) + { deviceProperties.ModelName = model.Value; + } var modelNumber = document.Descendants(uPnpNamespaces.ud.GetName("modelNumber")).FirstOrDefault(); if (modelNumber != null) + { deviceProperties.ModelNumber = modelNumber.Value; + } var uuid = document.Descendants(uPnpNamespaces.ud.GetName("UDN")).FirstOrDefault(); if (uuid != null) + { deviceProperties.UUID = uuid.Value; + } var manufacturer = document.Descendants(uPnpNamespaces.ud.GetName("manufacturer")).FirstOrDefault(); if (manufacturer != null) + { deviceProperties.Manufacturer = manufacturer.Value; + } var manufacturerUrl = document.Descendants(uPnpNamespaces.ud.GetName("manufacturerURL")).FirstOrDefault(); if (manufacturerUrl != null) + { deviceProperties.ManufacturerUrl = manufacturerUrl.Value; + } var presentationUrl = document.Descendants(uPnpNamespaces.ud.GetName("presentationURL")).FirstOrDefault(); if (presentationUrl != null) + { deviceProperties.PresentationUrl = presentationUrl.Value; + } var modelUrl = document.Descendants(uPnpNamespaces.ud.GetName("modelURL")).FirstOrDefault(); if (modelUrl != null) + { deviceProperties.ModelUrl = modelUrl.Value; + } var serialNumber = document.Descendants(uPnpNamespaces.ud.GetName("serialNumber")).FirstOrDefault(); if (serialNumber != null) + { deviceProperties.SerialNumber = serialNumber.Value; + } var modelDescription = document.Descendants(uPnpNamespaces.ud.GetName("modelDescription")).FirstOrDefault(); if (modelDescription != null) + { deviceProperties.ModelDescription = modelDescription.Value; + } deviceProperties.BaseUrl = string.Format("http://{0}:{1}", url.Host, url.Port); var icon = document.Descendants(uPnpNamespaces.ud.GetName("icon")).FirstOrDefault(); - if (icon != null) { deviceProperties.Icon = CreateIcon(icon); @@ -958,12 +979,16 @@ namespace Emby.Dlna.PlayTo foreach (var services in document.Descendants(uPnpNamespaces.ud.GetName("serviceList"))) { if (services == null) + { continue; + } var servicesList = services.Descendants(uPnpNamespaces.ud.GetName("service")); if (servicesList == null) + { continue; + } foreach (var element in servicesList) { @@ -1065,13 +1090,10 @@ namespace Emby.Dlna.PlayTo private void OnPlaybackStart(uBaseObject mediaInfo) { - if (PlaybackStart != null) + PlaybackStart?.Invoke(this, new PlaybackStartEventArgs { - PlaybackStart.Invoke(this, new PlaybackStartEventArgs - { - MediaInfo = mediaInfo - }); - } + MediaInfo = mediaInfo + }); } private void OnPlaybackProgress(uBaseObject mediaInfo) @@ -1082,36 +1104,28 @@ namespace Emby.Dlna.PlayTo return; } - if (PlaybackProgress != null) + PlaybackProgress?.Invoke(this, new PlaybackProgressEventArgs { - PlaybackProgress.Invoke(this, new PlaybackProgressEventArgs - { - MediaInfo = mediaInfo - }); - } + MediaInfo = mediaInfo + }); } private void OnPlaybackStop(uBaseObject mediaInfo) { - if (PlaybackStopped != null) + + PlaybackStopped?.Invoke(this, new PlaybackStoppedEventArgs { - PlaybackStopped.Invoke(this, new PlaybackStoppedEventArgs - { - MediaInfo = mediaInfo - }); - } + MediaInfo = mediaInfo + }); } private void OnMediaChanged(uBaseObject old, uBaseObject newMedia) { - if (MediaChanged != null) + MediaChanged?.Invoke(this, new MediaChangedEventArgs { - MediaChanged.Invoke(this, new MediaChangedEventArgs - { - OldMediaInfo = old, - NewMediaInfo = newMedia - }); - } + OldMediaInfo = old, + NewMediaInfo = newMedia + }); } #region IDisposable diff --git a/Emby.Dlna/Server/DescriptionXmlBuilder.cs b/Emby.Dlna/Server/DescriptionXmlBuilder.cs index e0ecbee43..03d8f80ab 100644 --- a/Emby.Dlna/Server/DescriptionXmlBuilder.cs +++ b/Emby.Dlna/Server/DescriptionXmlBuilder.cs @@ -107,19 +107,19 @@ namespace Emby.Dlna.Server '&' }; - private static readonly string[] s_escapeStringPairs = new string[] -{ - "<", - "<", - ">", - ">", - "\"", - """, - "'", - "'", - "&", - "&" -}; + private static readonly string[] s_escapeStringPairs = new[] + { + "<", + "<", + ">", + ">", + "\"", + """, + "'", + "'", + "&", + "&" + }; private static string GetEscapeSequence(char c) { @@ -133,7 +133,7 @@ namespace Emby.Dlna.Server return result; } } - return c.ToString(); + return c.ToString(CultureInfo.InvariantCulture); } /// Replaces invalid XML characters in a string with their valid XML equivalent. @@ -145,6 +145,7 @@ namespace Emby.Dlna.Server { return null; } + StringBuilder stringBuilder = null; int length = str.Length; int num = 0; @@ -230,9 +231,9 @@ namespace Emby.Dlna.Server var serverName = new string(characters); - var name = (_profile.FriendlyName ?? string.Empty).Replace("${HostName}", serverName, StringComparison.OrdinalIgnoreCase); + var name = _profile.FriendlyName?.Replace("${HostName}", serverName, StringComparison.OrdinalIgnoreCase); - return name; + return name ?? string.Empty; } private void AppendIconList(StringBuilder builder) @@ -295,65 +296,62 @@ namespace Emby.Dlna.Server } private IEnumerable GetIcons() - { - var list = new List(); - - list.Add(new DeviceIcon - { - MimeType = "image/png", - Depth = "24", - Width = 240, - Height = 240, - Url = "icons/logo240.png" - }); - - list.Add(new DeviceIcon - { - MimeType = "image/jpeg", - Depth = "24", - Width = 240, - Height = 240, - Url = "icons/logo240.jpg" - }); - - list.Add(new DeviceIcon - { - MimeType = "image/png", - Depth = "24", - Width = 120, - Height = 120, - Url = "icons/logo120.png" - }); - - list.Add(new DeviceIcon - { - MimeType = "image/jpeg", - Depth = "24", - Width = 120, - Height = 120, - Url = "icons/logo120.jpg" - }); - - list.Add(new DeviceIcon - { - MimeType = "image/png", - Depth = "24", - Width = 48, - Height = 48, - Url = "icons/logo48.png" - }); - - list.Add(new DeviceIcon + => new[] { - MimeType = "image/jpeg", - Depth = "24", - Width = 48, - Height = 48, - Url = "icons/logo48.jpg" - }); - - return list; - } + new DeviceIcon + { + MimeType = "image/png", + Depth = "24", + Width = 240, + Height = 240, + Url = "icons/logo240.png" + }, + + new DeviceIcon + { + MimeType = "image/jpeg", + Depth = "24", + Width = 240, + Height = 240, + Url = "icons/logo240.jpg" + }, + + new DeviceIcon + { + MimeType = "image/png", + Depth = "24", + Width = 120, + Height = 120, + Url = "icons/logo120.png" + }, + + new DeviceIcon + { + MimeType = "image/jpeg", + Depth = "24", + Width = 120, + Height = 120, + Url = "icons/logo120.jpg" + }, + + new DeviceIcon + { + MimeType = "image/png", + Depth = "24", + Width = 48, + Height = 48, + Url = "icons/logo48.png" + }, + + new DeviceIcon + { + MimeType = "image/jpeg", + Depth = "24", + Width = 48, + Height = 48, + Url = "icons/logo48.jpg" + } + }; private IEnumerable GetServices() { diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index 8ac2b9b27..dbea337e9 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -144,7 +144,7 @@ namespace Emby.Drawing private static readonly string[] TransparentImageTypes = new string[] { ".png", ".webp", ".gif" }; public bool SupportsTransparency(string path) - => TransparentImageTypes.Contains(Path.GetExtension(path).ToLower()); + => TransparentImageTypes.Contains(Path.GetExtension(path).ToLowerInvariant()); public async Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options) { @@ -374,7 +374,7 @@ namespace Emby.Drawing filename += "v=" + Version; - return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLower()); + return GetCachePath(ResizedImageCachePath, filename, "." + format.ToString().ToLowerInvariant()); } public ImageDimensions GetImageSize(BaseItem item, ItemImageInfo info) diff --git a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs index ac486f167..62c83c011 100644 --- a/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs +++ b/Emby.IsoMounting/IsoMounter/LinuxIsoManager.cs @@ -121,7 +121,7 @@ namespace IsoMounter path, Path.GetExtension(path), EnvironmentInfo.OperatingSystem, - ExecutablesAvailable.ToString() + ExecutablesAvailable ); if (ExecutablesAvailable) @@ -183,7 +183,7 @@ namespace IsoMounter _logger.LogInformation( "[{0}] Disposing [{1}].", Name, - disposing.ToString() + disposing ); if (disposing) @@ -229,9 +229,8 @@ namespace IsoMounter var uid = getuid(); _logger.LogDebug( - "[{0}] Our current UID is [{1}], GetUserId() returned [{2}].", + "[{0}] GetUserId() returned [{2}].", Name, - uid.ToString(), uid ); diff --git a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs index 59c7c655f..ff35b3205 100644 --- a/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs +++ b/Emby.Server.Implementations/AppBase/BaseConfigurationManager.cs @@ -218,7 +218,7 @@ namespace Emby.Server.Implementations.AppBase private string GetConfigurationFile(string key) { - return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLower() + ".xml"); + return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLowerInvariant() + ".xml"); } public object GetConfiguration(string key) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 3de4da444..5e81ddd8b 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -3905,7 +3905,7 @@ namespace Emby.Server.Implementations.Data // lowercase this because SortName is stored as lowercase if (statement != null) { - statement.TryBind("@NameStartsWithOrGreater", query.NameStartsWithOrGreater.ToLower()); + statement.TryBind("@NameStartsWithOrGreater", query.NameStartsWithOrGreater.ToLowerInvariant()); } } if (!string.IsNullOrWhiteSpace(query.NameLessThan)) @@ -3914,7 +3914,7 @@ namespace Emby.Server.Implementations.Data // lowercase this because SortName is stored as lowercase if (statement != null) { - statement.TryBind("@NameLessThan", query.NameLessThan.ToLower()); + statement.TryBind("@NameLessThan", query.NameLessThan.ToLowerInvariant()); } } @@ -4822,7 +4822,7 @@ namespace Emby.Server.Implementations.Data return value; } - return value.RemoveDiacritics().ToLower(); + return value.RemoveDiacritics().ToLowerInvariant(); } private bool EnableGroupByPresentationUniqueKey(InternalItemsQuery query) diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs index ea620cb2e..03066c2cb 100644 --- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs @@ -264,7 +264,7 @@ namespace Emby.Server.Implementations.HttpClientManager } var url = options.Url; - var urlHash = url.ToLower().GetMD5().ToString("N"); + var urlHash = url.ToLowerInvariant().GetMD5().ToString("N"); var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash); @@ -384,11 +384,11 @@ namespace Emby.Server.Implementations.HttpClientManager { if (options.LogRequestAsDebug) { - _logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url); + _logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToUpper(CultureInfo.CurrentCulture), options.Url); } else { - _logger.LogInformation("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url); + _logger.LogInformation("HttpClientManager {0}: {1}", httpMethod.ToUpper(CultureInfo.CurrentCulture), options.Url); } } diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs index 0ad4d8406..7445fd3c2 100644 --- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs +++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs @@ -394,7 +394,7 @@ namespace Emby.Server.Implementations.HttpServer { return contentType == null ? null - : contentType.Split(';')[0].ToLower().Trim(); + : contentType.Split(';')[0].ToLowerInvariant().Trim(); } private static string SerializeToXmlString(object from) diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index ad070ed79..06e7dd15e 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -517,7 +517,7 @@ namespace Emby.Server.Implementations.Library if (forceCaseInsensitive || !ConfigurationManager.Configuration.EnableCaseSensitiveItemIds) { - key = key.ToLower(); + key = key.ToLowerInvariant(); } key = type.FullName + key; diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 4805e54dd..2572a1254 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -2193,7 +2193,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV if (lockData) { - writer.WriteElementString("lockdata", true.ToString().ToLower()); + writer.WriteElementString("lockdata", true.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); } if (item.CriticRating.HasValue) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs index 724e8afdf..1144c9ab1 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs @@ -399,7 +399,7 @@ namespace Emby.Server.Implementations.LiveTv { var name = serviceName + externalId + InternalVersionNumber; - return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvChannel)); + return _libraryManager.GetNewItemId(name.ToLowerInvariant(), typeof(LiveTvChannel)); } private const string ServiceName = "Emby"; @@ -407,21 +407,21 @@ namespace Emby.Server.Implementations.LiveTv { var name = ServiceName + externalId + InternalVersionNumber; - return name.ToLower().GetMD5().ToString("N"); + return name.ToLowerInvariant().GetMD5().ToString("N"); } public Guid GetInternalSeriesTimerId(string externalId) { var name = ServiceName + externalId + InternalVersionNumber; - return name.ToLower().GetMD5(); + return name.ToLowerInvariant().GetMD5(); } public Guid GetInternalProgramId(string externalId) { var name = ServiceName + externalId + InternalVersionNumber; - return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvProgram)); + return _libraryManager.GetNewItemId(name.ToLowerInvariant(), typeof(LiveTvProgram)); } public async Task GetTimerInfo(TimerInfoDto dto, bool isNew, LiveTvManager liveTv, CancellationToken cancellationToken) diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index c408a47f6..a2af9e244 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -492,11 +492,11 @@ namespace Emby.Server.Implementations.Localization if (parts.Length == 2) { - culture = parts[0].ToLower() + "-" + parts[1].ToUpper(); + culture = parts[0].ToLowerInvariant() + "-" + parts[1].ToUpperInvariant(); } else { - culture = culture.ToLower(); + culture = culture.ToLowerInvariant(); } return culture + ".json"; diff --git a/Emby.Server.Implementations/Services/RequestHelper.cs b/Emby.Server.Implementations/Services/RequestHelper.cs index 24e9cbfa4..2563cac99 100644 --- a/Emby.Server.Implementations/Services/RequestHelper.cs +++ b/Emby.Server.Implementations/Services/RequestHelper.cs @@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Services { return contentType == null ? null - : contentType.Split(';')[0].ToLower().Trim(); + : contentType.Split(';')[0].ToLowerInvariant().Trim(); } } diff --git a/Emby.Server.Implementations/Services/ServiceExec.cs b/Emby.Server.Implementations/Services/ServiceExec.cs index 45c918fa1..aa67a3601 100644 --- a/Emby.Server.Implementations/Services/ServiceExec.cs +++ b/Emby.Server.Implementations/Services/ServiceExec.cs @@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.Services return Task.FromResult(response); } - var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLower(); + var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLowerInvariant(); throw new NotImplementedException(string.Format("Could not find method named {1}({0}) or Any({0}) on Service {2}", requestDto.GetType().GetMethodName(), expectedMethodName, serviceType.GetMethodName())); } diff --git a/Emby.Server.Implementations/Services/ServiceMethod.cs b/Emby.Server.Implementations/Services/ServiceMethod.cs index 7add72815..5018bf4a2 100644 --- a/Emby.Server.Implementations/Services/ServiceMethod.cs +++ b/Emby.Server.Implementations/Services/ServiceMethod.cs @@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Services public static string Key(Type serviceType, string method, string requestDtoName) { - return serviceType.FullName + " " + method.ToUpper() + " " + requestDtoName; + return serviceType.FullName + " " + method.ToUpperInvariant() + " " + requestDtoName; } } } diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs index 7e1993b71..f575baca3 100644 --- a/Emby.Server.Implementations/Services/ServicePath.cs +++ b/Emby.Server.Implementations/Services/ServicePath.cs @@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Services public static string[] GetPathPartsForMatching(string pathInfo) { - return pathInfo.ToLower().Split(new[] { PathSeperatorChar }, StringSplitOptions.RemoveEmptyEntries); + return pathInfo.ToLowerInvariant().Split(new[] { PathSeperatorChar }, StringSplitOptions.RemoveEmptyEntries); } public static List GetFirstMatchHashKeys(string[] pathPartsForMatching) @@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.Services this.Description = description; this.restPath = path; - this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpper().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); + this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpperInvariant().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries); var componentsList = new List(); @@ -154,7 +154,7 @@ namespace Emby.Server.Implementations.Services } else { - this.literalsToMatch[i] = component.ToLower(); + this.literalsToMatch[i] = component.ToLowerInvariant(); if (firstLiteralMatch == null) { @@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.Services foreach (var propertyInfo in GetSerializableProperties(RequestType)) { var propertyName = propertyInfo.Name; - propertyNamesMap.Add(propertyName.ToLower(), propertyName); + propertyNamesMap.Add(propertyName.ToLowerInvariant(), propertyName); } } @@ -483,7 +483,7 @@ namespace Emby.Server.Implementations.Services continue; } - if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out var propertyNameOnRequest)) + if (!this.propertyNamesMap.TryGetValue(variableName.ToLowerInvariant(), out var propertyNameOnRequest)) { if (string.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase)) { diff --git a/Emby.Server.Implementations/Services/SwaggerService.cs b/Emby.Server.Implementations/Services/SwaggerService.cs index 9bceeabec..3e6970eef 100644 --- a/Emby.Server.Implementations/Services/SwaggerService.cs +++ b/Emby.Server.Implementations/Services/SwaggerService.cs @@ -216,40 +216,28 @@ namespace Emby.Server.Implementations.Services { var responses = new Dictionary { + { "200", new SwaggerResponse { description = "OK" } } }; - responses["200"] = new SwaggerResponse + var apiKeySecurity = new Dictionary { - description = "OK" + { "api_key", Array.Empty() } }; - var security = new List>(); - - var apiKeySecurity = new Dictionary(); - apiKeySecurity["api_key"] = Array.Empty(); - - security.Add(apiKeySecurity); - - result[verb.ToLower()] = new SwaggerMethod + result[verb.ToLowerInvariant()] = new SwaggerMethod { summary = info.Summary, description = info.Description, - produces = new[] - { - "application/json" - }, - consumes = new[] - { - "application/json" - }, + produces = new[] { "application/json" }, + consumes = new[] { "application/json" }, operationId = info.RequestType.Name, tags = Array.Empty(), - parameters = new SwaggerParam[] { }, + parameters = Array.Empty(), responses = responses, - security = security.ToArray() + security = new [] { apiKeySecurity } }; } diff --git a/Jellyfin.Drawing.Skia/StripCollageBuilder.cs b/Jellyfin.Drawing.Skia/StripCollageBuilder.cs index 92115047c..dfdf39871 100644 --- a/Jellyfin.Drawing.Skia/StripCollageBuilder.cs +++ b/Jellyfin.Drawing.Skia/StripCollageBuilder.cs @@ -25,7 +25,7 @@ namespace Jellyfin.Drawing.Skia throw new ArgumentNullException(nameof(outputPath)); } - var ext = Path.GetExtension(outputPath).ToLower(); + var ext = Path.GetExtension(outputPath).ToLowerInvariant(); if (ext == ".jpg" || ext == ".jpeg") return SKEncodedImageFormat.Jpeg; diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs index 017690062..f09197fb3 100644 --- a/Jellyfin.Server/SocketSharp/RequestMono.cs +++ b/Jellyfin.Server/SocketSharp/RequestMono.cs @@ -360,13 +360,13 @@ namespace Jellyfin.SocketSharp int len = buffer.Length; if (dest_offset > len) { - throw new ArgumentException("destination offset is beyond array size"); + throw new ArgumentException("destination offset is beyond array size", nameof(dest_offset)); } // reordered to avoid possible integer overflow if (dest_offset > len - count) { - throw new ArgumentException("Reading would overrun buffer"); + throw new ArgumentException("Reading would overrun buffer", nameof(count)); } if (count > end - position) @@ -528,7 +528,7 @@ namespace Jellyfin.SocketSharp } } - class HttpMultipart + private class HttpMultipart { public class Element @@ -543,19 +543,19 @@ namespace Jellyfin.SocketSharp public override string ToString() { return "ContentType " + ContentType + ", Name " + Name + ", Filename " + Filename + ", Start " + - Start.ToString() + ", Length " + Length.ToString(); + Start.ToString(CultureInfo.CurrentCulture) + ", Length " + Length.ToString(CultureInfo.CurrentCulture); } } - Stream data; - string boundary; - byte[] boundary_bytes; - byte[] buffer; - bool at_eof; - Encoding encoding; - StringBuilder sb; + private Stream data; + private string boundary; + private byte[] boundary_bytes; + private byte[] buffer; + private bool at_eof; + private Encoding encoding; + private StringBuilder sb; - const byte LF = (byte)'\n', CR = (byte)'\r'; + private const byte LF = (byte)'\n', CR = (byte)'\r'; // See RFC 2046 // In the case of multipart entities, in which one or more different @@ -610,7 +610,6 @@ namespace Jellyfin.SocketSharp } return sb.ToString(); - } private static string GetContentDispositionAttribute(string l, string name) diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs index 97550e686..2e8dd9185 100644 --- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs +++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs @@ -29,12 +29,24 @@ namespace Jellyfin.SocketSharp private static string GetHandlerPathIfAny(string listenerUrl) { - if (listenerUrl == null) return null; + if (listenerUrl == null) + { + return null; + } + var pos = listenerUrl.IndexOf("://", StringComparison.OrdinalIgnoreCase); - if (pos == -1) return null; + if (pos == -1) + { + return null; + } + var startHostUrl = listenerUrl.Substring(pos + "://".Length); var endPos = startHostUrl.IndexOf('/'); - if (endPos == -1) return null; + if (endPos == -1) + { + return null; + } + var endHostUrl = startHostUrl.Substring(endPos + 1); return string.IsNullOrEmpty(endHostUrl) ? null : endHostUrl.TrimEnd('/'); } @@ -210,9 +222,13 @@ namespace Jellyfin.SocketSharp if (acceptsAnything) { if (hasDefaultContentType) + { return defaultContentType; - if (serverDefaultContentType != null) + } + else if (serverDefaultContentType != null) + { return serverDefaultContentType; + } } } @@ -229,11 +245,16 @@ namespace Jellyfin.SocketSharp public static bool HasAnyOfContentTypes(IRequest request, params string[] contentTypes) { - if (contentTypes == null || request.ContentType == null) return false; + if (contentTypes == null || request.ContentType == null) + { + return false; + } + foreach (var contentType in contentTypes) { if (IsContentType(request, contentType)) return true; } + return false; } @@ -264,12 +285,12 @@ namespace Jellyfin.SocketSharp } } - format = LeftPart(format, '.').ToLower(); + format = LeftPart(format, '.').ToLowerInvariant(); if (format.Contains("json", StringComparison.OrdinalIgnoreCase)) { return "application/json"; } - if (format.Contains("xml", StringComparison.OrdinalIgnoreCase)) + else if (format.Contains("xml", StringComparison.OrdinalIgnoreCase)) { return "application/xml"; } @@ -283,10 +304,9 @@ namespace Jellyfin.SocketSharp { return null; } + var pos = strVal.IndexOf(needle); - return pos == -1 - ? strVal - : strVal.Substring(0, pos); + return pos == -1 ? strVal : strVal.Substring(0, pos); } public static string HandlerFactoryPath; @@ -433,6 +453,7 @@ namespace Jellyfin.SocketSharp { return null; } + try { return Encoding.GetEncoding(param); diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs index 61efae46d..9334e7eea 100644 --- a/MediaBrowser.Api/Images/ImageByNameService.cs +++ b/MediaBrowser.Api/Images/ImageByNameService.cs @@ -145,7 +145,7 @@ namespace MediaBrowser.Api.Images Theme = supportsThemes ? GetThemeName(i.FullName, path) : null, Context = supportsThemes ? null : GetThemeName(i.FullName, path), - Format = i.Extension.ToLower().TrimStart('.') + Format = i.Extension.ToLowerInvariant().TrimStart('.') }) .OrderBy(i => i.Name) .ToList(); diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 88ed4b525..8fdd726b7 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -875,7 +875,9 @@ namespace MediaBrowser.Api.LiveTv private string GetHashedString(string str) { // legacy - return BitConverter.ToString(_cryptographyProvider.ComputeSHA1(Encoding.UTF8.GetBytes(str))).Replace("-", string.Empty).ToLower(); + return BitConverter.ToString( + _cryptographyProvider.ComputeSHA1(Encoding.UTF8.GetBytes(str))) + .Replace("-", string.Empty).ToLowerInvariant(); } public void Delete(DeleteListingProvider request) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index bb525adc7..9460dc523 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -135,10 +135,10 @@ namespace MediaBrowser.Api.Playback if (EnableOutputInSubFolder) { - return Path.Combine(folder, dataHash, dataHash + (outputFileExtension ?? string.Empty).ToLower()); + return Path.Combine(folder, dataHash, dataHash + (outputFileExtension ?? string.Empty).ToLowerInvariant()); } - return Path.Combine(folder, dataHash + (outputFileExtension ?? string.Empty).ToLower()); + return Path.Combine(folder, dataHash + (outputFileExtension ?? string.Empty).ToLowerInvariant()); } protected virtual bool EnableOutputInSubFolder => false; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 846fd9eec..60e41834b 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -614,7 +614,7 @@ namespace MediaBrowser.Controller.Entities if (!string.IsNullOrEmpty(ForcedSortName)) { // Need the ToLower because that's what CreateSortName does - _sortName = ModifySortChunks(ForcedSortName).ToLower(); + _sortName = ModifySortChunks(ForcedSortName).ToLowerInvariant(); } else { @@ -660,7 +660,7 @@ namespace MediaBrowser.Controller.Entities return Name.TrimStart(); } - var sortable = Name.Trim().ToLower(); + var sortable = Name.Trim().ToLowerInvariant(); foreach (var removeChar in ConfigurationManager.Configuration.SortRemoveCharacters) { diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index dd4440c3b..d925ad324 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -305,7 +305,7 @@ namespace MediaBrowser.Controller.Entities private string GetUserDataKey(string providerId) { - var key = providerId + "-" + ExtraType.ToString().ToLower(); + var key = providerId + "-" + ExtraType.ToString().ToLowerInvariant(); // Make sure different trailers have their own data. if (RunTimeTicks.HasValue) diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 968e3dbcb..858c004cb 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -136,7 +136,7 @@ namespace MediaBrowser.Controller.MediaEncoding return "libtheora"; } - return codec.ToLower(); + return codec.ToLowerInvariant(); } return "copy"; @@ -405,7 +405,7 @@ namespace MediaBrowser.Controller.MediaEncoding return "libopus"; } - return codec.ToLower(); + return codec.ToLowerInvariant(); } /// @@ -762,7 +762,7 @@ namespace MediaBrowser.Controller.MediaEncoding // vaapi does not support Baseline profile, force Constrained Baseline in this case, // which is compatible (and ugly) if (string.Equals(videoEncoder, "h264_vaapi", StringComparison.OrdinalIgnoreCase) && - profile != null && profile.ToLower().Contains("baseline")) + profile != null && profile.ToLowerInvariant().Contains("baseline")) { profile = "constrained_baseline"; } @@ -2175,7 +2175,7 @@ namespace MediaBrowser.Controller.MediaEncoding { if (string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase)) { - switch (videoStream.Codec.ToLower()) + switch (videoStream.Codec.ToLowerInvariant()) { case "avc": case "h264": @@ -2215,7 +2215,7 @@ namespace MediaBrowser.Controller.MediaEncoding else if (string.Equals(encodingOptions.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase)) { - switch (videoStream.Codec.ToLower()) + switch (videoStream.Codec.ToLowerInvariant()) { case "avc": case "h264": @@ -2254,7 +2254,7 @@ namespace MediaBrowser.Controller.MediaEncoding else if (string.Equals(encodingOptions.HardwareAccelerationType, "mediacodec", StringComparison.OrdinalIgnoreCase)) { - switch (videoStream.Codec.ToLower()) + switch (videoStream.Codec.ToLowerInvariant()) { case "avc": case "h264": @@ -2299,7 +2299,7 @@ namespace MediaBrowser.Controller.MediaEncoding else if (string.Equals(encodingOptions.HardwareAccelerationType, "omx", StringComparison.OrdinalIgnoreCase)) { - switch (videoStream.Codec.ToLower()) + switch (videoStream.Codec.ToLowerInvariant()) { case "avc": case "h264": @@ -2324,7 +2324,7 @@ namespace MediaBrowser.Controller.MediaEncoding return "-hwaccel dxva2"; } - switch (videoStream.Codec.ToLower()) + switch (videoStream.Codec.ToLowerInvariant()) { case "avc": case "h264": diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs index 0a4928ed7..aec5dc348 100644 --- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs @@ -417,7 +417,7 @@ namespace MediaBrowser.LocalMetadata.Images var seriesFiles = GetFiles(series, false, directoryService).ToList(); // Try using the season name - var prefix = season.Name.ToLower().Replace(" ", string.Empty); + var prefix = season.Name.ToLowerInvariant().Replace(" ", string.Empty); var filenamePrefixes = new List { prefix }; diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 2eac35f28..6bfa59d07 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -172,7 +172,7 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteElementString("Added", item.DateCreated.ToLocalTime().ToString("G")); - writer.WriteElementString("LockData", item.IsLocked.ToString().ToLower()); + writer.WriteElementString("LockData", item.IsLocked.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); if (item.LockedFields.Length > 0) { @@ -410,7 +410,9 @@ namespace MediaBrowser.LocalMetadata.Savers writer.WriteStartElement("Share"); writer.WriteElementString("UserId", share.UserId); - writer.WriteElementString("CanEdit", share.CanEdit.ToString().ToLower()); + writer.WriteElementString( + "CanEdit", + share.CanEdit.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); writer.WriteEndElement(); } diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs index ed4c445cd..b0d8efab8 100644 --- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs @@ -272,7 +272,7 @@ namespace MediaBrowser.MediaEncoding.Encoder var outputFileExtension = GetOutputFileExtension(state); - var filename = state.Id + (outputFileExtension ?? string.Empty).ToLower(); + var filename = state.Id + (outputFileExtension ?? string.Empty).ToLowerInvariant(); return Path.Combine(folder, filename); } @@ -310,7 +310,7 @@ namespace MediaBrowser.MediaEncoding.Encoder { if (string.Equals(GetEncodingOptions().HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase)) { - switch (state.MediaSource.VideoStream.Codec.ToLower()) + switch (state.MediaSource.VideoStream.Codec.ToLowerInvariant()) { case "avc": case "h264": diff --git a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs index 2c18a02ef..0d696b906 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SsaParser.cs @@ -44,7 +44,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles if (!eventsStarted) header.AppendLine(line); - if (line.Trim().ToLower() == "[events]") + if (line.Trim().ToLowerInvariant() == "[events]") { eventsStarted = true; } @@ -54,25 +54,25 @@ namespace MediaBrowser.MediaEncoding.Subtitles } else if (eventsStarted && line.Trim().Length > 0) { - string s = line.Trim().ToLower(); + string s = line.Trim().ToLowerInvariant(); if (s.StartsWith("format:")) { if (line.Length > 10) { - format = line.ToLower().Substring(8).Split(','); + format = line.ToLowerInvariant().Substring(8).Split(','); for (int i = 0; i < format.Length; i++) { - if (format[i].Trim().ToLower() == "layer") + if (format[i].Trim().ToLowerInvariant() == "layer") indexLayer = i; - else if (format[i].Trim().ToLower() == "start") + else if (format[i].Trim().ToLowerInvariant() == "start") indexStart = i; - else if (format[i].Trim().ToLower() == "end") + else if (format[i].Trim().ToLowerInvariant() == "end") indexEnd = i; - else if (format[i].Trim().ToLower() == "text") + else if (format[i].Trim().ToLowerInvariant() == "text") indexText = i; - else if (format[i].Trim().ToLower() == "effect") + else if (format[i].Trim().ToLowerInvariant() == "effect") indexEffect = i; - else if (format[i].Trim().ToLower() == "style") + else if (format[i].Trim().ToLowerInvariant() == "style") indexStyle = i; } } @@ -222,7 +222,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles // switch to rrggbb from bbggrr color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2); - color = color.ToLower(); + color = color.ToLowerInvariant(); text = text.Remove(start, end - start + 1); if (italic) @@ -252,7 +252,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles // switch to rrggbb from bbggrr color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2); - color = color.ToLower(); + color = color.ToLowerInvariant(); text = text.Remove(start, end - start + 1); if (italic) @@ -367,7 +367,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles color = color.PadLeft(6, '0'); // switch to rrggbb from bbggrr color = "#" + color.Remove(color.Length - 6) + color.Substring(color.Length - 2, 2) + color.Substring(color.Length - 4, 2) + color.Substring(color.Length - 6, 2); - color = color.ToLower(); + color = color.ToLowerInvariant(); extraTags += " color=\"" + color + "\""; } diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 6d03a03b0..10efb9b38 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -223,7 +223,7 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("DeviceProfileId", item.DeviceProfileId ?? string.Empty)); list.Add(new NameValuePair("DeviceId", item.DeviceId ?? string.Empty)); list.Add(new NameValuePair("MediaSourceId", item.MediaSourceId ?? string.Empty)); - list.Add(new NameValuePair("Static", item.IsDirectStream.ToString().ToLower())); + list.Add(new NameValuePair("Static", item.IsDirectStream.ToString(CultureInfo.InvariantCulture).ToLowerInvariant())); list.Add(new NameValuePair("VideoCodec", videoCodecs)); list.Add(new NameValuePair("AudioCodec", audioCodecs)); list.Add(new NameValuePair("AudioStreamIndex", item.AudioStreamIndex.HasValue ? item.AudioStreamIndex.Value.ToString(CultureInfo.InvariantCulture) : string.Empty)); @@ -251,7 +251,7 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("PlaySessionId", item.PlaySessionId ?? string.Empty)); list.Add(new NameValuePair("api_key", accessToken ?? string.Empty)); - string liveStreamId = item.MediaSource == null ? null : item.MediaSource.LiveStreamId; + string liveStreamId = item.MediaSource?.LiveStreamId; list.Add(new NameValuePair("LiveStreamId", liveStreamId ?? string.Empty)); list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty)); @@ -261,37 +261,37 @@ namespace MediaBrowser.Model.Dlna { if (item.RequireNonAnamorphic) { - list.Add(new NameValuePair("RequireNonAnamorphic", item.RequireNonAnamorphic.ToString().ToLower())); + list.Add(new NameValuePair("RequireNonAnamorphic", item.RequireNonAnamorphic.ToString(CultureInfo.InvariantCulture).ToLowerInvariant())); } list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? item.TranscodingMaxAudioChannels.Value.ToString(CultureInfo.InvariantCulture) : string.Empty)); if (item.EnableSubtitlesInManifest) { - list.Add(new NameValuePair("EnableSubtitlesInManifest", item.EnableSubtitlesInManifest.ToString().ToLower())); + list.Add(new NameValuePair("EnableSubtitlesInManifest", item.EnableSubtitlesInManifest.ToString(CultureInfo.InvariantCulture).ToLowerInvariant())); } if (item.EnableMpegtsM2TsMode) { - list.Add(new NameValuePair("EnableMpegtsM2TsMode", item.EnableMpegtsM2TsMode.ToString().ToLower())); + list.Add(new NameValuePair("EnableMpegtsM2TsMode", item.EnableMpegtsM2TsMode.ToString(CultureInfo.InvariantCulture).ToLowerInvariant())); } if (item.EstimateContentLength) { - list.Add(new NameValuePair("EstimateContentLength", item.EstimateContentLength.ToString().ToLower())); + list.Add(new NameValuePair("EstimateContentLength", item.EstimateContentLength.ToString(CultureInfo.InvariantCulture).ToLowerInvariant())); } if (item.TranscodeSeekInfo != TranscodeSeekInfo.Auto) { - list.Add(new NameValuePair("TranscodeSeekInfo", item.TranscodeSeekInfo.ToString().ToLower())); + list.Add(new NameValuePair("TranscodeSeekInfo", item.TranscodeSeekInfo.ToString().ToLowerInvariant())); } if (item.CopyTimestamps) { - list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString().ToLower())); + list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString(CultureInfo.InvariantCulture).ToLowerInvariant())); } - list.Add(new NameValuePair("RequireAvc", item.RequireAvc.ToString().ToLower())); + list.Add(new NameValuePair("RequireAvc", item.RequireAvc.ToString(CultureInfo.InvariantCulture).ToLowerInvariant())); } list.Add(new NameValuePair("Tag", item.MediaSource.ETag ?? string.Empty)); @@ -316,7 +316,7 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("MinSegments", item.MinSegments.Value.ToString(CultureInfo.InvariantCulture))); } - list.Add(new NameValuePair("BreakOnNonKeyFrames", item.BreakOnNonKeyFrames.ToString())); + list.Add(new NameValuePair("BreakOnNonKeyFrames", item.BreakOnNonKeyFrames.ToString(CultureInfo.InvariantCulture))); } foreach (var pair in item.StreamOptions) @@ -332,7 +332,7 @@ namespace MediaBrowser.Model.Dlna if (!item.IsDirectStream) { - list.Add(new NameValuePair("TranscodeReasons", string.Join(",", item.TranscodeReasons.Distinct().Select(i => i.ToString()).ToArray()))); + list.Add(new NameValuePair("TranscodeReasons", string.Join(",", item.TranscodeReasons.Distinct().Select(i => i.ToString())))); } return list; diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index e0c3bead1..fc346df37 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -104,7 +104,7 @@ namespace MediaBrowser.Model.Entities attributes.Add("Default"); } - return string.Join(" ", attributes.ToArray()); + return string.Join(" ", attributes); } if (Type == MediaStreamType.Video) @@ -120,10 +120,10 @@ namespace MediaBrowser.Model.Entities if (!string.IsNullOrEmpty(Codec)) { - attributes.Add(Codec.ToUpper()); + attributes.Add(Codec.ToUpperInvariant()); } - return string.Join(" ", attributes.ToArray()); + return string.Join(" ", attributes); } if (Type == MediaStreamType.Subtitle) diff --git a/MediaBrowser.Model/Extensions/StringHelper.cs b/MediaBrowser.Model/Extensions/StringHelper.cs index 78e23e767..75ba12a17 100644 --- a/MediaBrowser.Model/Extensions/StringHelper.cs +++ b/MediaBrowser.Model/Extensions/StringHelper.cs @@ -51,7 +51,7 @@ namespace MediaBrowser.Model.Extensions public static string FirstToUpper(this string str) { - return string.IsNullOrEmpty(str) ? "" : str.Substring(0, 1).ToUpper() + str.Substring(1); + return string.IsNullOrEmpty(str) ? string.Empty : str.Substring(0, 1).ToUpperInvariant() + str.Substring(1); } } } diff --git a/MediaBrowser.Model/MediaInfo/AudioCodec.cs b/MediaBrowser.Model/MediaInfo/AudioCodec.cs index 5ed67fd78..5ebdb99cb 100644 --- a/MediaBrowser.Model/MediaInfo/AudioCodec.cs +++ b/MediaBrowser.Model/MediaInfo/AudioCodec.cs @@ -8,9 +8,12 @@ namespace MediaBrowser.Model.MediaInfo public static string GetFriendlyName(string codec) { - if (string.IsNullOrEmpty(codec)) return ""; + if (string.IsNullOrEmpty(codec)) + { + return string.Empty; + } - switch (codec.ToLower()) + switch (codec.ToLowerInvariant()) { case "ac3": return "Dolby Digital"; @@ -19,7 +22,7 @@ namespace MediaBrowser.Model.MediaInfo case "dca": return "DTS"; default: - return codec.ToUpper(); + return codec.ToUpperInvariant(); } } } diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index fe13413e2..659abe84c 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -158,7 +158,7 @@ namespace MediaBrowser.Model.Net // Catch-all for all video types that don't require specific mime types if (VideoFileExtensionsDictionary.ContainsKey(ext)) { - return "video/" + ext.TrimStart('.').ToLower(); + return "video/" + ext.TrimStart('.').ToLowerInvariant(); } // Type text diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index d0d00ef12..313a70a2a 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -420,7 +420,7 @@ namespace MediaBrowser.Providers.Manager filename = GetBackdropSaveFilename(item.GetImages(type), "screenshot", "screenshot", imageIndex); break; default: - filename = type.ToString().ToLower(); + filename = type.ToString().ToLowerInvariant(); break; } @@ -429,7 +429,7 @@ namespace MediaBrowser.Providers.Manager extension = ".jpg"; } - extension = extension.ToLower(); + extension = extension.ToLowerInvariant(); string path = null; diff --git a/MediaBrowser.Providers/Manager/ItemImageProvider.cs b/MediaBrowser.Providers/Manager/ItemImageProvider.cs index c2e53ae6c..6aa85ff37 100644 --- a/MediaBrowser.Providers/Manager/ItemImageProvider.cs +++ b/MediaBrowser.Providers/Manager/ItemImageProvider.cs @@ -148,7 +148,7 @@ namespace MediaBrowser.Providers.Manager } else { - var mimeType = "image/" + response.Format.ToString().ToLower(); + var mimeType = "image/" + response.Format.ToString().ToLowerInvariant(); await _providerManager.SaveImage(item, response.Stream, mimeType, imageType, null, cancellationToken).ConfigureAwait(false); } diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs index 2ce10b656..78d9f3d8f 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs @@ -119,7 +119,7 @@ namespace MediaBrowser.Providers.MediaInfo continue; } - var codec = Path.GetExtension(fullName).ToLower().TrimStart('.'); + var codec = Path.GetExtension(fullName).ToLowerInvariant().TrimStart('.'); if (string.Equals(codec, "txt", StringComparison.OrdinalIgnoreCase)) { diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index f03a8c2c2..482f3021b 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -285,7 +285,7 @@ namespace MediaBrowser.Providers.Movies if (parts.Length == 2) { - language = parts[0] + "-" + parts[1].ToUpper(); + language = parts[0] + "-" + parts[1].ToUpperInvariant(); } } diff --git a/MediaBrowser.Providers/Movies/MovieDbSearch.cs b/MediaBrowser.Providers/Movies/MovieDbSearch.cs index 47d3d21bd..e466d40a0 100644 --- a/MediaBrowser.Providers/Movies/MovieDbSearch.cs +++ b/MediaBrowser.Providers/Movies/MovieDbSearch.cs @@ -72,7 +72,7 @@ namespace MediaBrowser.Providers.Movies } _logger.LogInformation("MovieDbProvider: Finding id for item: " + name); - var language = idInfo.MetadataLanguage.ToLower(); + var language = idInfo.MetadataLanguage.ToLowerInvariant(); //nope - search for it //var searchType = item is BoxSet ? "collection" : "movie"; diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs index 468ba730a..6657407c0 100644 --- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs +++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs @@ -168,14 +168,14 @@ namespace MediaBrowser.Providers.Subtitles memoryStream.Position = 0; var savePaths = new List(); - var saveFileName = _fileSystem.GetFileNameWithoutExtension(video.Path) + "." + response.Language.ToLower(); + var saveFileName = _fileSystem.GetFileNameWithoutExtension(video.Path) + "." + response.Language.ToLowerInvariant(); if (response.IsForced) { saveFileName += ".forced"; } - saveFileName += "." + response.Format.ToLower(); + saveFileName += "." + response.Format.ToLowerInvariant(); if (saveInMediaFolder) { @@ -305,7 +305,7 @@ namespace MediaBrowser.Providers.Subtitles private string GetProviderId(string name) { - return name.ToLower().GetMD5().ToString("N"); + return name.ToLowerInvariant().GetMD5().ToString("N"); } private ISubtitleProvider GetProvider(string id) diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs index b6df64396..920721926 100644 --- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs @@ -66,7 +66,7 @@ namespace MediaBrowser.Providers.TV } // pt-br is just pt to tvdb - return language.Split('-')[0].ToLower(); + return language.Split('-')[0].ToLowerInvariant(); } public async Task> GetSearchResults(SeriesInfo searchInfo, CancellationToken cancellationToken) @@ -776,7 +776,7 @@ namespace MediaBrowser.Providers.TV /// System.String. private string GetComparableName(string name) { - name = name.ToLower(); + name = name.ToLowerInvariant(); name = _localizationManager.NormalizeFormKD(name); var sb = new StringBuilder(); foreach (var c in name) @@ -1620,7 +1620,7 @@ namespace MediaBrowser.Providers.TV { var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds); - var seriesXmlFilename = language.ToLower() + ".xml"; + var seriesXmlFilename = language.ToLowerInvariant() + ".xml"; return Path.Combine(seriesDataPath, seriesXmlFilename); } diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 1efffff3d..b049ddc62 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -290,7 +290,7 @@ namespace MediaBrowser.XbmcMetadata.Savers foreach (var stream in mediaStreams) { - writer.WriteStartElement(stream.Type.ToString().ToLower()); + writer.WriteStartElement(stream.Type.ToString().ToLowerInvariant()); if (!string.IsNullOrEmpty(stream.Codec)) { @@ -471,7 +471,7 @@ namespace MediaBrowser.XbmcMetadata.Savers writer.WriteElementString("customrating", item.CustomRating); } - writer.WriteElementString("lockdata", item.IsLocked.ToString().ToLower()); + writer.WriteElementString("lockdata", item.IsLocked.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); if (item.LockedFields.Length > 0) { @@ -871,21 +871,21 @@ namespace MediaBrowser.XbmcMetadata.Savers var userdata = userDataRepo.GetUserData(user, item); - writer.WriteElementString("isuserfavorite", userdata.IsFavorite.ToString().ToLower()); + writer.WriteElementString("isuserfavorite", userdata.IsFavorite.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); if (userdata.Rating.HasValue) { - writer.WriteElementString("userrating", userdata.Rating.Value.ToString(CultureInfo.InvariantCulture).ToLower()); + writer.WriteElementString("userrating", userdata.Rating.Value.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); } if (!item.IsFolder) { writer.WriteElementString("playcount", userdata.PlayCount.ToString(UsCulture)); - writer.WriteElementString("watched", userdata.Played.ToString().ToLower()); + writer.WriteElementString("watched", userdata.Played.ToString(CultureInfo.InvariantCulture).ToLowerInvariant()); if (userdata.LastPlayedDate.HasValue) { - writer.WriteElementString("lastplayed", userdata.LastPlayedDate.Value.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss").ToLower()); + writer.WriteElementString("lastplayed", userdata.LastPlayedDate.Value.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss").ToLowerInvariant()); } writer.WriteStartElement("resume"); @@ -901,12 +901,13 @@ namespace MediaBrowser.XbmcMetadata.Savers private void AddActors(List people, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config, bool saveImagePath) { - var actors = people - .Where(i => !IsPersonType(i, PersonType.Director) && !IsPersonType(i, PersonType.Writer)) - .ToList(); - - foreach (var person in actors) + foreach (var person in people) { + if (IsPersonType(person, PersonType.Director) || IsPersonType(person, PersonType.Writer)) + { + continue; + } + writer.WriteStartElement("actor"); if (!string.IsNullOrWhiteSpace(person.Name)) @@ -1021,7 +1022,7 @@ namespace MediaBrowser.XbmcMetadata.Savers private string GetTagForProviderKey(string providerKey) { - return providerKey.ToLower() + "id"; + return providerKey.ToLowerInvariant() + "id"; } } } diff --git a/SocketHttpListener/Ext.cs b/SocketHttpListener/Ext.cs index b051b6718..a02b48061 100644 --- a/SocketHttpListener/Ext.cs +++ b/SocketHttpListener/Ext.cs @@ -486,7 +486,7 @@ namespace SocketHttpListener if (method == CompressionMethod.None) return string.Empty; - var m = string.Format("permessage-{0}", method.ToString().ToLower()); + var m = string.Format("permessage-{0}", method.ToString().ToLowerInvariant()); if (parameters == null || parameters.Length == 0) return m; diff --git a/SocketHttpListener/Net/HttpListenerRequest.cs b/SocketHttpListener/Net/HttpListenerRequest.cs index faeca78b2..667d58ea7 100644 --- a/SocketHttpListener/Net/HttpListenerRequest.cs +++ b/SocketHttpListener/Net/HttpListenerRequest.cs @@ -155,7 +155,7 @@ namespace SocketHttpListener.Net } else { - header = header.ToLower(CultureInfo.InvariantCulture); + header = header.ToLowerInvariant(); _keepAlive = header.IndexOf("close", StringComparison.OrdinalIgnoreCase) < 0 || header.IndexOf("keep-alive", StringComparison.OrdinalIgnoreCase) >= 0; -- cgit v1.2.3 From 055e43eda72dbf77a91ca22b5b007161c9d75c46 Mon Sep 17 00:00:00 2001 From: Vasily Date: Tue, 29 Jan 2019 18:01:55 +0100 Subject: Update Emby.Server.Implementations/Localization/LocalizationManager.cs Co-Authored-By: Bond-009 --- Emby.Server.Implementations/Localization/LocalizationManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 47834940b..682fbb6aa 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Localization countryCode = "us"; } - var ratings = GetRatings(countryCode) ?? GetRatings("us"); + return GetRatings(countryCode) ?? GetRatings("us"); return ratings; } -- cgit v1.2.3 From 8985fb8d58c9b968b8e773276d7c3902aa4d55f3 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Mon, 28 Jan 2019 18:49:25 +0100 Subject: Remove support for games as a media type --- Emby.Dlna/ContentDirectory/ControlHandler.cs | 4 +- Emby.Dlna/Didl/DidlBuilder.cs | 2 +- Emby.Notifications/CoreNotificationTypes.cs | 10 -- .../Activity/ActivityLogEntryPoint.cs | 8 -- Emby.Server.Implementations/ApplicationHost.cs | 1 - .../Data/SqliteItemRepository.cs | 27 +--- Emby.Server.Implementations/Dto/DtoService.cs | 35 ------ .../Images/BaseDynamicImageProvider.cs | 2 +- .../Library/LibraryManager.cs | 26 ---- .../Library/SearchEngine.cs | 2 - .../Library/UserViewManager.cs | 4 - .../Library/Validators/GameGenresPostScanTask.cs | 45 ------- .../Library/Validators/GameGenresValidator.cs | 72 ----------- .../Localization/Core/ar.json | 3 - .../Localization/Core/bg-BG.json | 3 - .../Localization/Core/ca.json | 3 - .../Localization/Core/cs.json | 3 - .../Localization/Core/da.json | 3 - .../Localization/Core/de.json | 3 - .../Localization/Core/el.json | 3 - .../Localization/Core/en-GB.json | 3 - .../Localization/Core/en-US.json | 3 - .../Localization/Core/es-AR.json | 3 - .../Localization/Core/es-MX.json | 3 - .../Localization/Core/es.json | 3 - .../Localization/Core/fa.json | 3 - .../Localization/Core/fr-CA.json | 3 - .../Localization/Core/fr.json | 3 - .../Localization/Core/gsw.json | 3 - .../Localization/Core/he.json | 3 - .../Localization/Core/hr.json | 3 - .../Localization/Core/hu.json | 3 - .../Localization/Core/it.json | 3 - .../Localization/Core/kk.json | 3 - .../Localization/Core/ko.json | 3 - .../Localization/Core/lt-LT.json | 3 - .../Localization/Core/ms.json | 3 - .../Localization/Core/nb.json | 3 - .../Localization/Core/nl.json | 3 - .../Localization/Core/pl.json | 3 - .../Localization/Core/pt-BR.json | 3 - .../Localization/Core/pt-PT.json | 3 - .../Localization/Core/ru.json | 3 - .../Localization/Core/sk.json | 3 - .../Localization/Core/sl-SI.json | 3 - .../Localization/Core/sv.json | 3 - .../Localization/Core/tr.json | 3 - .../Localization/Core/zh-CN.json | 3 - .../Localization/Core/zh-HK.json | 3 - .../ServerApplicationPaths.cs | 6 - .../Sorting/GameSystemComparer.cs | 51 -------- .../Sorting/PlayersComparer.cs | 43 ------- .../UserViews/CollectionFolderImageProvider.cs | 4 - MediaBrowser.Api/BaseApiService.cs | 19 --- MediaBrowser.Api/FilterService.cs | 10 -- MediaBrowser.Api/GamesService.cs | 140 --------------------- MediaBrowser.Api/Images/ImageService.cs | 4 - MediaBrowser.Api/ItemLookupService.cs | 13 -- MediaBrowser.Api/ItemUpdateService.cs | 5 - MediaBrowser.Api/Library/LibraryService.cs | 5 - MediaBrowser.Api/Session/SessionsService.cs | 2 +- .../UserLibrary/BaseItemsByNameService.cs | 1 - MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs | 6 - MediaBrowser.Api/UserLibrary/GameGenresService.cs | 105 ---------------- MediaBrowser.Api/UserLibrary/GenresService.cs | 5 - MediaBrowser.Api/UserLibrary/ItemsService.cs | 2 - MediaBrowser.Controller/Entities/Folder.cs | 10 -- MediaBrowser.Controller/Entities/Game.cs | 113 ----------------- MediaBrowser.Controller/Entities/GameGenre.cs | 109 ---------------- MediaBrowser.Controller/Entities/GameSystem.cs | 77 ------------ MediaBrowser.Controller/Entities/Genre.cs | 2 +- .../Entities/InternalItemsQuery.cs | 3 - MediaBrowser.Controller/Entities/UserView.cs | 1 - .../Entities/UserViewBuilder.cs | 46 ------- MediaBrowser.Controller/IServerApplicationPaths.cs | 6 - MediaBrowser.Controller/Library/ILibraryManager.cs | 10 -- .../Persistence/IItemRepository.cs | 2 - MediaBrowser.Controller/Providers/GameInfo.cs | 11 -- .../Providers/GameSystemInfo.cs | 11 -- .../Images/LocalImageProvider.cs | 16 +-- .../Parsers/GameSystemXmlParser.cs | 66 ---------- .../Parsers/GameXmlParser.cs | 85 ------------- .../Providers/GameSystemXmlProvider.cs | 36 ------ .../Providers/GameXmlProvider.cs | 39 ------ .../Savers/GameSystemXmlSaver.cs | 48 ------- MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs | 68 ---------- .../Channels/ChannelMediaContentType.cs | 4 +- MediaBrowser.Model/Configuration/UnratedItem.cs | 1 - MediaBrowser.Model/Dto/BaseItemDto.cs | 13 -- MediaBrowser.Model/Dto/GameSystemSummary.cs | 48 ------- MediaBrowser.Model/Dto/ItemCounts.cs | 10 -- MediaBrowser.Model/Entities/CollectionType.cs | 1 - MediaBrowser.Model/Entities/MediaType.cs | 4 - MediaBrowser.Model/Entities/MetadataProviders.cs | 1 - .../Notifications/NotificationType.cs | 2 - MediaBrowser.Model/Providers/RemoteSearchResult.cs | 2 - MediaBrowser.Model/Querying/ItemSortBy.cs | 2 - .../GameGenres/GameGenreMetadataService.cs | 23 ---- .../Games/GameMetadataService.cs | 36 ------ .../Games/GameSystemMetadataService.cs | 31 ----- MediaBrowser.Providers/Manager/ProviderManager.cs | 2 - MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs | 8 -- 102 files changed, 9 insertions(+), 1705 deletions(-) delete mode 100644 Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs delete mode 100644 Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs delete mode 100644 Emby.Server.Implementations/Sorting/GameSystemComparer.cs delete mode 100644 Emby.Server.Implementations/Sorting/PlayersComparer.cs delete mode 100644 MediaBrowser.Api/GamesService.cs delete mode 100644 MediaBrowser.Api/UserLibrary/GameGenresService.cs delete mode 100644 MediaBrowser.Controller/Entities/Game.cs delete mode 100644 MediaBrowser.Controller/Entities/GameGenre.cs delete mode 100644 MediaBrowser.Controller/Entities/GameSystem.cs delete mode 100644 MediaBrowser.Controller/Providers/GameInfo.cs delete mode 100644 MediaBrowser.Controller/Providers/GameSystemInfo.cs delete mode 100644 MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs delete mode 100644 MediaBrowser.LocalMetadata/Parsers/GameXmlParser.cs delete mode 100644 MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs delete mode 100644 MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs delete mode 100644 MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs delete mode 100644 MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs delete mode 100644 MediaBrowser.Model/Dto/GameSystemSummary.cs delete mode 100644 MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs delete mode 100644 MediaBrowser.Providers/Games/GameMetadataService.cs delete mode 100644 MediaBrowser.Providers/Games/GameSystemMetadataService.cs (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs index 2d8bb87f9..bed4d885c 100644 --- a/Emby.Dlna/ContentDirectory/ControlHandler.cs +++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs @@ -454,7 +454,7 @@ namespace Emby.Dlna.ContentDirectory User = user, Recursive = true, IsMissing = false, - ExcludeItemTypes = new[] { typeof(Game).Name, typeof(Book).Name }, + ExcludeItemTypes = new[] { typeof(Book).Name }, IsFolder = isFolder, MediaTypes = mediaTypes.ToArray(), DtoOptions = GetDtoOptions() @@ -523,7 +523,7 @@ namespace Emby.Dlna.ContentDirectory Limit = limit, StartIndex = startIndex, IsVirtualItem = false, - ExcludeItemTypes = new[] { typeof(Game).Name, typeof(Book).Name }, + ExcludeItemTypes = new[] { typeof(Book).Name }, IsPlaceHolder = false, DtoOptions = GetDtoOptions() }; diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index e4a9cbfc6..d6f159d76 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -808,7 +808,7 @@ namespace Emby.Dlna.Didl { writer.WriteString(_profile.RequiresPlainFolders ? "object.container.storageFolder" : "object.container.genre.musicGenre"); } - else if (item is Genre || item is GameGenre) + else if (item is Genre) { writer.WriteString(_profile.RequiresPlainFolders ? "object.container.storageFolder" : "object.container.genre"); } diff --git a/Emby.Notifications/CoreNotificationTypes.cs b/Emby.Notifications/CoreNotificationTypes.cs index 158898084..8cc14fa01 100644 --- a/Emby.Notifications/CoreNotificationTypes.cs +++ b/Emby.Notifications/CoreNotificationTypes.cs @@ -73,11 +73,6 @@ namespace Emby.Notifications Type = NotificationType.AudioPlayback.ToString() }, - new NotificationTypeInfo - { - Type = NotificationType.GamePlayback.ToString() - }, - new NotificationTypeInfo { Type = NotificationType.VideoPlayback.ToString() @@ -88,11 +83,6 @@ namespace Emby.Notifications Type = NotificationType.AudioPlaybackStopped.ToString() }, - new NotificationTypeInfo - { - Type = NotificationType.GamePlaybackStopped.ToString() - }, - new NotificationTypeInfo { Type = NotificationType.VideoPlaybackStopped.ToString() diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs index efe8f98ec..54b70d3b5 100644 --- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs +++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs @@ -207,10 +207,6 @@ namespace Emby.Server.Implementations.Activity { return NotificationType.AudioPlayback.ToString(); } - if (string.Equals(mediaType, MediaType.Game, StringComparison.OrdinalIgnoreCase)) - { - return NotificationType.GamePlayback.ToString(); - } if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) { return NotificationType.VideoPlayback.ToString(); @@ -225,10 +221,6 @@ namespace Emby.Server.Implementations.Activity { return NotificationType.AudioPlaybackStopped.ToString(); } - if (string.Equals(mediaType, MediaType.Game, StringComparison.OrdinalIgnoreCase)) - { - return NotificationType.GamePlaybackStopped.ToString(); - } if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase)) { return NotificationType.VideoPlaybackStopped.ToString(); diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index c3176bc9c..87e3b45ab 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -1671,7 +1671,6 @@ namespace Emby.Server.Implementations var minRequiredVersions = new Dictionary(StringComparer.OrdinalIgnoreCase) { - { "GameBrowser.dll", new Version(3, 1) }, { "moviethemesongs.dll", new Version(1, 6) }, { "themesongs.dll", new Version(1, 2) } }; diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 3de4da444..9ea2389f4 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -1239,10 +1239,6 @@ namespace Emby.Server.Implementations.Data { return false; } - else if (type == typeof(GameGenre)) - { - return false; - } else if (type == typeof(Genre)) { return false; @@ -4789,10 +4785,6 @@ namespace Emby.Server.Implementations.Data { list.Add(typeof(MusicGenre).Name); } - if (IsTypeInQuery(typeof(GameGenre).Name, query)) - { - list.Add(typeof(GameGenre).Name); - } if (IsTypeInQuery(typeof(MusicArtist).Name, query)) { list.Add(typeof(MusicArtist).Name); @@ -4891,9 +4883,6 @@ namespace Emby.Server.Implementations.Data typeof(Book), typeof(CollectionFolder), typeof(Folder), - typeof(Game), - typeof(GameGenre), - typeof(GameSystem), typeof(Genre), typeof(Person), typeof(Photo), @@ -5251,11 +5240,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type return GetItemValues(query, new[] { 2 }, typeof(Genre).FullName); } - public QueryResult> GetGameGenres(InternalItemsQuery query) - { - return GetItemValues(query, new[] { 2 }, typeof(GameGenre).FullName); - } - public QueryResult> GetMusicGenres(InternalItemsQuery query) { return GetItemValues(query, new[] { 2 }, typeof(MusicGenre).FullName); @@ -5276,14 +5260,9 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type return GetItemValueNames(new[] { 2 }, new List { "Audio", "MusicVideo", "MusicAlbum", "MusicArtist" }, new List()); } - public List GetGameGenreNames() - { - return GetItemValueNames(new[] { 2 }, new List { "Game" }, new List()); - } - public List GetGenreNames() { - return GetItemValueNames(new[] { 2 }, new List(), new List { "Audio", "MusicVideo", "MusicAlbum", "MusicArtist", "Game", "GameSystem" }); + return GetItemValueNames(new[] { 2 }, new List(), new List { "Audio", "MusicVideo", "MusicAlbum", "MusicArtist" }); } private List GetItemValueNames(int[] itemValueTypes, List withItemTypes, List excludeItemTypes) @@ -5652,10 +5631,6 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type { counts.SongCount = value; } - else if (string.Equals(typeName, typeof(Game).FullName, StringComparison.OrdinalIgnoreCase)) - { - counts.GameCount = value; - } else if (string.Equals(typeName, typeof(Trailer).FullName, StringComparison.OrdinalIgnoreCase)) { counts.TrailerCount = value; diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index d0a7de11d..a3529fdb4 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -374,10 +374,6 @@ namespace Emby.Server.Implementations.Dto dto.MusicVideoCount = taggedItems.Count(i => i is MusicVideo); dto.SongCount = taggedItems.Count(i => i is Audio); } - else if (item is GameGenre) - { - dto.GameCount = taggedItems.Count(i => i is Game); - } else { // This populates them all and covers Genre, Person, Studio, Year @@ -385,7 +381,6 @@ namespace Emby.Server.Implementations.Dto dto.ArtistCount = taggedItems.Count(i => i is MusicArtist); dto.AlbumCount = taggedItems.Count(i => i is MusicAlbum); dto.EpisodeCount = taggedItems.Count(i => i is Episode); - dto.GameCount = taggedItems.Count(i => i is Game); dto.MovieCount = taggedItems.Count(i => i is Movie); dto.TrailerCount = taggedItems.Count(i => i is Trailer); dto.MusicVideoCount = taggedItems.Count(i => i is MusicVideo); @@ -532,17 +527,6 @@ namespace Emby.Server.Implementations.Dto dto.Album = item.Album; } - private static void SetGameProperties(BaseItemDto dto, Game item) - { - dto.GameSystem = item.GameSystem; - dto.MultiPartGameFiles = item.MultiPartGameFiles; - } - - private static void SetGameSystemProperties(BaseItemDto dto, GameSystem item) - { - dto.GameSystem = item.GameSystemName; - } - private string[] GetImageTags(BaseItem item, List images) { return images @@ -698,11 +682,6 @@ namespace Emby.Server.Implementations.Dto return _libraryManager.GetMusicGenreId(name); } - if (owner is Game || owner is GameSystem) - { - return _libraryManager.GetGameGenreId(name); - } - return _libraryManager.GetGenreId(name); } @@ -1206,20 +1185,6 @@ namespace Emby.Server.Implementations.Dto } } - var game = item as Game; - - if (game != null) - { - SetGameProperties(dto, game); - } - - var gameSystem = item as GameSystem; - - if (gameSystem != null) - { - SetGameSystemProperties(dto, gameSystem); - } - var musicVideo = item as MusicVideo; if (musicVideo != null) { diff --git a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs index 9705d54c9..109c21f18 100644 --- a/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs +++ b/Emby.Server.Implementations/Images/BaseDynamicImageProvider.cs @@ -215,7 +215,7 @@ namespace Emby.Server.Implementations.Images { return CreateSquareCollage(item, itemsWithImages, outputPath); } - if (item is Playlist || item is MusicGenre || item is Genre || item is GameGenre || item is PhotoAlbum) + if (item is Playlist || item is MusicGenre || item is Genre || item is PhotoAlbum) { return CreateSquareCollage(item, itemsWithImages, outputPath); } diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index f96a211ec..3e2ff0b2a 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -869,11 +869,6 @@ namespace Emby.Server.Implementations.Library return GetItemByNameId(MusicGenre.GetPath, name); } - public Guid GetGameGenreId(string name) - { - return GetItemByNameId(GameGenre.GetPath, name); - } - /// /// Gets a Genre /// @@ -894,16 +889,6 @@ namespace Emby.Server.Implementations.Library return CreateItemByName(MusicGenre.GetPath, name, new DtoOptions(true)); } - /// - /// Gets the game genre. - /// - /// The name. - /// Task{GameGenre}. - public GameGenre GetGameGenre(string name) - { - return CreateItemByName(GameGenre.GetPath, name, new DtoOptions(true)); - } - /// /// Gets a Year /// @@ -1370,17 +1355,6 @@ namespace Emby.Server.Implementations.Library return ItemRepository.GetGenres(query); } - public QueryResult> GetGameGenres(InternalItemsQuery query) - { - if (query.User != null) - { - AddUserToQuery(query, query.User); - } - - SetTopParentOrAncestorIds(query); - return ItemRepository.GetGameGenres(query); - } - public QueryResult> GetMusicGenres(InternalItemsQuery query) { if (query.User != null) diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.cs index 71638b197..9c7f7dfcb 100644 --- a/Emby.Server.Implementations/Library/SearchEngine.cs +++ b/Emby.Server.Implementations/Library/SearchEngine.cs @@ -99,14 +99,12 @@ namespace Emby.Server.Implementations.Library if (!query.IncludeMedia) { AddIfMissing(includeItemTypes, typeof(Genre).Name); - AddIfMissing(includeItemTypes, typeof(GameGenre).Name); AddIfMissing(includeItemTypes, typeof(MusicGenre).Name); } } else { AddIfMissing(excludeItemTypes, typeof(Genre).Name); - AddIfMissing(excludeItemTypes, typeof(GameGenre).Name); AddIfMissing(excludeItemTypes, typeof(MusicGenre).Name); } diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs index 9fa859bde..e9ce682ee 100644 --- a/Emby.Server.Implementations/Library/UserViewManager.cs +++ b/Emby.Server.Implementations/Library/UserViewManager.cs @@ -308,9 +308,6 @@ namespace Emby.Server.Implementations.Library mediaTypes.Add(MediaType.Book); mediaTypes.Add(MediaType.Audio); break; - case CollectionType.Games: - mediaTypes.Add(MediaType.Game); - break; case CollectionType.Music: mediaTypes.Add(MediaType.Audio); break; @@ -336,7 +333,6 @@ namespace Emby.Server.Implementations.Library typeof(Person).Name, typeof(Studio).Name, typeof(Year).Name, - typeof(GameGenre).Name, typeof(MusicGenre).Name, typeof(Genre).Name diff --git a/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs b/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs deleted file mode 100644 index 2b067951d..000000000 --- a/Emby.Server.Implementations/Library/Validators/GameGenresPostScanTask.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Persistence; -using Microsoft.Extensions.Logging; - -namespace Emby.Server.Implementations.Library.Validators -{ - /// - /// Class GameGenresPostScanTask - /// - public class GameGenresPostScanTask : ILibraryPostScanTask - { - /// - /// The _library manager - /// - private readonly ILibraryManager _libraryManager; - private readonly ILogger _logger; - private readonly IItemRepository _itemRepo; - - /// - /// Initializes a new instance of the class. - /// - /// The library manager. - /// The logger. - public GameGenresPostScanTask(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo) - { - _libraryManager = libraryManager; - _logger = logger; - _itemRepo = itemRepo; - } - - /// - /// Runs the specified progress. - /// - /// The progress. - /// The cancellation token. - /// Task. - public Task Run(IProgress progress, CancellationToken cancellationToken) - { - return new GameGenresValidator(_libraryManager, _logger, _itemRepo).Run(progress, cancellationToken); - } - } -} diff --git a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs b/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs deleted file mode 100644 index f5ffa1e45..000000000 --- a/Emby.Server.Implementations/Library/Validators/GameGenresValidator.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Persistence; -using Microsoft.Extensions.Logging; - -namespace Emby.Server.Implementations.Library.Validators -{ - class GameGenresValidator - { - /// - /// The _library manager - /// - private readonly ILibraryManager _libraryManager; - - /// - /// The _logger - /// - private readonly ILogger _logger; - private readonly IItemRepository _itemRepo; - - public GameGenresValidator(ILibraryManager libraryManager, ILogger logger, IItemRepository itemRepo) - { - _libraryManager = libraryManager; - _logger = logger; - _itemRepo = itemRepo; - } - - /// - /// Runs the specified progress. - /// - /// The progress. - /// The cancellation token. - /// Task. - public async Task Run(IProgress progress, CancellationToken cancellationToken) - { - var names = _itemRepo.GetGameGenreNames(); - - var numComplete = 0; - var count = names.Count; - - foreach (var name in names) - { - try - { - var item = _libraryManager.GetGameGenre(name); - - await item.RefreshMetadata(cancellationToken).ConfigureAwait(false); - } - catch (OperationCanceledException) - { - // Don't clutter the log - throw; - } - catch (Exception ex) - { - _logger.LogError(ex, "Error refreshing {GenreName}", name); - } - - numComplete++; - double percent = numComplete; - percent /= count; - percent *= 100; - - progress.Report(percent); - } - - progress.Report(100); - } - } -} diff --git a/Emby.Server.Implementations/Localization/Core/ar.json b/Emby.Server.Implementations/Localization/Core/ar.json index ec2c3f237..eb145b4fe 100644 --- a/Emby.Server.Implementations/Localization/Core/ar.json +++ b/Emby.Server.Implementations/Localization/Core/ar.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "عملية تسجيل الدخول فشلت من {0}", "Favorites": "المفضلات", "Folders": "المجلدات", - "Games": "الألعاب", "Genres": "أنواع الأفلام", "HeaderAlbumArtists": "فنانو الألبومات", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "بدأ تشغيل المقطع الصوتي", "NotificationOptionAudioPlaybackStopped": "تم إيقاف تشغيل المقطع الصوتي", "NotificationOptionCameraImageUploaded": "تم رقع صورة الكاميرا", - "NotificationOptionGamePlayback": "تم تشغيل اللعبة", - "NotificationOptionGamePlaybackStopped": "تم إيقاف تشغيل اللعبة", "NotificationOptionInstallationFailed": "عملية التنصيب فشلت", "NotificationOptionNewLibraryContent": "تم إضافة محتوى جديد", "NotificationOptionPluginError": "فشل في الملحق", diff --git a/Emby.Server.Implementations/Localization/Core/bg-BG.json b/Emby.Server.Implementations/Localization/Core/bg-BG.json index ba6c98555..a71dc9346 100644 --- a/Emby.Server.Implementations/Localization/Core/bg-BG.json +++ b/Emby.Server.Implementations/Localization/Core/bg-BG.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Любими", "Folders": "Папки", - "Games": "Игри", "Genres": "Жанрове", "HeaderAlbumArtists": "Изпълнители на албуми", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Възпроизвеждането на звук започна", "NotificationOptionAudioPlaybackStopped": "Възпроизвеждането на звук е спряно", "NotificationOptionCameraImageUploaded": "Изображението от фотоапарата е качено", - "NotificationOptionGamePlayback": "Възпроизвеждането на играта започна", - "NotificationOptionGamePlaybackStopped": "Възпроизвеждането на играта е спряна", "NotificationOptionInstallationFailed": "Неуспешно инсталиране", "NotificationOptionNewLibraryContent": "Добавено е ново съдържание", "NotificationOptionPluginError": "Грешка в приставка", diff --git a/Emby.Server.Implementations/Localization/Core/ca.json b/Emby.Server.Implementations/Localization/Core/ca.json index a818b78de..74406a064 100644 --- a/Emby.Server.Implementations/Localization/Core/ca.json +++ b/Emby.Server.Implementations/Localization/Core/ca.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Intent de connexió fallit des de {0}", "Favorites": "Preferits", "Folders": "Directoris", - "Games": "Jocs", "Genres": "Gèneres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Un component ha fallat", diff --git a/Emby.Server.Implementations/Localization/Core/cs.json b/Emby.Server.Implementations/Localization/Core/cs.json index e066051a8..a8b4a4424 100644 --- a/Emby.Server.Implementations/Localization/Core/cs.json +++ b/Emby.Server.Implementations/Localization/Core/cs.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Neúspěšný pokus o přihlášení z {0}", "Favorites": "Oblíbené", "Folders": "Složky", - "Games": "Hry", "Genres": "Žánry", "HeaderAlbumArtists": "Umělci alba", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Přehrávání audia zahájeno", "NotificationOptionAudioPlaybackStopped": "Přehrávání audia ukončeno", "NotificationOptionCameraImageUploaded": "Kamerový záznam nahrán", - "NotificationOptionGamePlayback": "Spuštění hry zahájeno", - "NotificationOptionGamePlaybackStopped": "Hra ukončena", "NotificationOptionInstallationFailed": "Chyba instalace", "NotificationOptionNewLibraryContent": "Přidán nový obsah", "NotificationOptionPluginError": "Chyba zásuvného modulu", diff --git a/Emby.Server.Implementations/Localization/Core/da.json b/Emby.Server.Implementations/Localization/Core/da.json index 30581c389..7004d44db 100644 --- a/Emby.Server.Implementations/Localization/Core/da.json +++ b/Emby.Server.Implementations/Localization/Core/da.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Fejlet loginforsøg fra {0}", "Favorites": "Favoritter", "Folders": "Mapper", - "Games": "Spil", "Genres": "Genre", "HeaderAlbumArtists": "Albumkunstnere", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audioafspilning påbegyndt", "NotificationOptionAudioPlaybackStopped": "Audioafspilning stoppet", "NotificationOptionCameraImageUploaded": "Kamerabillede uploadet", - "NotificationOptionGamePlayback": "Afspilning af Spil påbegyndt", - "NotificationOptionGamePlaybackStopped": "Afspilning af Spil stoppet", "NotificationOptionInstallationFailed": "Installationsfejl", "NotificationOptionNewLibraryContent": "Nyt indhold tilføjet", "NotificationOptionPluginError": "Pluginfejl", diff --git a/Emby.Server.Implementations/Localization/Core/de.json b/Emby.Server.Implementations/Localization/Core/de.json index 98cb07663..7bd2e90fe 100644 --- a/Emby.Server.Implementations/Localization/Core/de.json +++ b/Emby.Server.Implementations/Localization/Core/de.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Fehlgeschlagener Anmeldeversuch von {0}", "Favorites": "Favoriten", "Folders": "Verzeichnisse", - "Games": "Spiele", "Genres": "Genres", "HeaderAlbumArtists": "Album-Künstler", "HeaderCameraUploads": "Kamera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audiowiedergabe gestartet", "NotificationOptionAudioPlaybackStopped": "Audiowiedergabe gestoppt", "NotificationOptionCameraImageUploaded": "Kamera Bild hochgeladen", - "NotificationOptionGamePlayback": "Spielwiedergabe gestartet", - "NotificationOptionGamePlaybackStopped": "Spielwiedergabe gestoppt", "NotificationOptionInstallationFailed": "Installationsfehler", "NotificationOptionNewLibraryContent": "Neuer Inhalt hinzugefügt", "NotificationOptionPluginError": "Plugin Fehler", diff --git a/Emby.Server.Implementations/Localization/Core/el.json b/Emby.Server.Implementations/Localization/Core/el.json index ba687a089..91ca34edc 100644 --- a/Emby.Server.Implementations/Localization/Core/el.json +++ b/Emby.Server.Implementations/Localization/Core/el.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Αποτυχημένη προσπάθεια σύνδεσης από {0}", "Favorites": "Αγαπημένα", "Folders": "Φάκελοι", - "Games": "Παιχνίδια", "Genres": "Είδη", "HeaderAlbumArtists": "Άλμπουμ Καλλιτεχνών", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Η αναπαραγωγή ήχου ξεκίνησε", "NotificationOptionAudioPlaybackStopped": "Η αναπαραγωγή ήχου σταμάτησε", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Η αναπαραγωγή του παιχνιδιού ξεκίνησε", - "NotificationOptionGamePlaybackStopped": "Η αναπαραγωγή του παιχνιδιού σταμάτησε", "NotificationOptionInstallationFailed": "Αποτυχία εγκατάστασης", "NotificationOptionNewLibraryContent": "Προστέθηκε νέο περιεχόμενο", "NotificationOptionPluginError": "Αποτυχία του plugin", diff --git a/Emby.Server.Implementations/Localization/Core/en-GB.json b/Emby.Server.Implementations/Localization/Core/en-GB.json index 20d397a1a..332902292 100644 --- a/Emby.Server.Implementations/Localization/Core/en-GB.json +++ b/Emby.Server.Implementations/Localization/Core/en-GB.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favourites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/en-US.json b/Emby.Server.Implementations/Localization/Core/en-US.json index 69c8bf03c..f19cd532b 100644 --- a/Emby.Server.Implementations/Localization/Core/en-US.json +++ b/Emby.Server.Implementations/Localization/Core/en-US.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/es-AR.json b/Emby.Server.Implementations/Localization/Core/es-AR.json index aaaf09788..c01bb0c50 100644 --- a/Emby.Server.Implementations/Localization/Core/es-AR.json +++ b/Emby.Server.Implementations/Localization/Core/es-AR.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/es-MX.json b/Emby.Server.Implementations/Localization/Core/es-MX.json index 2ba9c8c7a..2285f2808 100644 --- a/Emby.Server.Implementations/Localization/Core/es-MX.json +++ b/Emby.Server.Implementations/Localization/Core/es-MX.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Intento fallido de inicio de sesión de {0}", "Favorites": "Favoritos", "Folders": "Carpetas", - "Games": "Juegos", "Genres": "Géneros", "HeaderAlbumArtists": "Artistas del Álbum", "HeaderCameraUploads": "Subidos desde Camara", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Reproducción de audio iniciada", "NotificationOptionAudioPlaybackStopped": "Reproducción de audio detenida", "NotificationOptionCameraImageUploaded": "Imagen de la cámara subida", - "NotificationOptionGamePlayback": "Ejecución de juego iniciada", - "NotificationOptionGamePlaybackStopped": "Ejecución de juego detenida", "NotificationOptionInstallationFailed": "Falla de instalación", "NotificationOptionNewLibraryContent": "Nuevo contenido agregado", "NotificationOptionPluginError": "Falla de complemento", diff --git a/Emby.Server.Implementations/Localization/Core/es.json b/Emby.Server.Implementations/Localization/Core/es.json index 38a282382..5d118d21f 100644 --- a/Emby.Server.Implementations/Localization/Core/es.json +++ b/Emby.Server.Implementations/Localization/Core/es.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Error al intentar iniciar sesión a partir de {0}", "Favorites": "Favoritos", "Folders": "Carpetas", - "Games": "Juegos", "Genres": "Géneros", "HeaderAlbumArtists": "Artistas del Álbum", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Se inició la reproducción de audio", "NotificationOptionAudioPlaybackStopped": "Se detuvo la reproducción de audio", "NotificationOptionCameraImageUploaded": "Imagen de la cámara cargada", - "NotificationOptionGamePlayback": "Se inició la reproducción del juego", - "NotificationOptionGamePlaybackStopped": "Se detuvo la reproducción del juego", "NotificationOptionInstallationFailed": "Error de instalación", "NotificationOptionNewLibraryContent": "Nuevo contenido añadido", "NotificationOptionPluginError": "Error en plugin", diff --git a/Emby.Server.Implementations/Localization/Core/fa.json b/Emby.Server.Implementations/Localization/Core/fa.json index 1d7bc5fe8..0a0c7553b 100644 --- a/Emby.Server.Implementations/Localization/Core/fa.json +++ b/Emby.Server.Implementations/Localization/Core/fa.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "تلاش برای ورود از {0} ناموفق بود", "Favorites": "مورد علاقه ها", "Folders": "پوشه ها", - "Games": "بازی ها", "Genres": "ژانرها", "HeaderAlbumArtists": "هنرمندان آلبوم", "HeaderCameraUploads": "آپلودهای دوربین", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "پخش صدا آغاز شد", "NotificationOptionAudioPlaybackStopped": "پخش صدا متوقف شد", "NotificationOptionCameraImageUploaded": "تصاویر دوربین آپلود شد", - "NotificationOptionGamePlayback": "پخش بازی آغاز شد", - "NotificationOptionGamePlaybackStopped": "پخش بازی متوقف شد", "NotificationOptionInstallationFailed": "شکست نصب", "NotificationOptionNewLibraryContent": "محتوای جدید افزوده شد", "NotificationOptionPluginError": "خرابی افزونه", diff --git a/Emby.Server.Implementations/Localization/Core/fr-CA.json b/Emby.Server.Implementations/Localization/Core/fr-CA.json index 22cd4cf6d..7202be9f5 100644 --- a/Emby.Server.Implementations/Localization/Core/fr-CA.json +++ b/Emby.Server.Implementations/Localization/Core/fr-CA.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/fr.json b/Emby.Server.Implementations/Localization/Core/fr.json index 085e22cf7..aa9a1add3 100644 --- a/Emby.Server.Implementations/Localization/Core/fr.json +++ b/Emby.Server.Implementations/Localization/Core/fr.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Échec d'une tentative de connexion de {0}", "Favorites": "Favoris", "Folders": "Dossiers", - "Games": "Jeux", "Genres": "Genres", "HeaderAlbumArtists": "Artistes de l'album", "HeaderCameraUploads": "Photos transférées", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Lecture audio démarrée", "NotificationOptionAudioPlaybackStopped": "Lecture audio arrêtée", "NotificationOptionCameraImageUploaded": "L'image de l'appareil photo a été transférée", - "NotificationOptionGamePlayback": "Lecture de jeu démarrée", - "NotificationOptionGamePlaybackStopped": "Lecture de jeu arrêtée", "NotificationOptionInstallationFailed": "Échec d'installation", "NotificationOptionNewLibraryContent": "Nouveau contenu ajouté", "NotificationOptionPluginError": "Erreur d'extension", diff --git a/Emby.Server.Implementations/Localization/Core/gsw.json b/Emby.Server.Implementations/Localization/Core/gsw.json index 537fe35d5..728002a56 100644 --- a/Emby.Server.Implementations/Localization/Core/gsw.json +++ b/Emby.Server.Implementations/Localization/Core/gsw.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Spiel", "Genres": "Genres", "HeaderAlbumArtists": "Albuminterprete", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/he.json b/Emby.Server.Implementations/Localization/Core/he.json index 6fff9d0ab..fff1d1f0e 100644 --- a/Emby.Server.Implementations/Localization/Core/he.json +++ b/Emby.Server.Implementations/Localization/Core/he.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "משחקים", "Genres": "ז'אנרים", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/hr.json b/Emby.Server.Implementations/Localization/Core/hr.json index 3232a4ff7..f284b3cd9 100644 --- a/Emby.Server.Implementations/Localization/Core/hr.json +++ b/Emby.Server.Implementations/Localization/Core/hr.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Neuspjeli pokušaj prijave za {0}", "Favorites": "Omiljeni", "Folders": "Mape", - "Games": "Igre", "Genres": "Žanrovi", "HeaderAlbumArtists": "Izvođači albuma", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Reprodukcija glazbe započeta", "NotificationOptionAudioPlaybackStopped": "Reprodukcija audiozapisa je zaustavljena", "NotificationOptionCameraImageUploaded": "Slike kamere preuzete", - "NotificationOptionGamePlayback": "Igrica pokrenuta", - "NotificationOptionGamePlaybackStopped": "Reprodukcija igre je zaustavljena", "NotificationOptionInstallationFailed": "Instalacija nije izvršena", "NotificationOptionNewLibraryContent": "Novi sadržaj je dodan", "NotificationOptionPluginError": "Dodatak otkazao", diff --git a/Emby.Server.Implementations/Localization/Core/hu.json b/Emby.Server.Implementations/Localization/Core/hu.json index 3a0119faf..d2d16b18f 100644 --- a/Emby.Server.Implementations/Localization/Core/hu.json +++ b/Emby.Server.Implementations/Localization/Core/hu.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Kedvencek", "Folders": "Könyvtárak", - "Games": "Játékok", "Genres": "Műfajok", "HeaderAlbumArtists": "Album Előadók", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audió lejátszás elkezdve", "NotificationOptionAudioPlaybackStopped": "Audió lejátszás befejezve", "NotificationOptionCameraImageUploaded": "Kamera kép feltöltve", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Telepítési hiba", "NotificationOptionNewLibraryContent": "Új tartalom hozzáadva", "NotificationOptionPluginError": "Bővítmény hiba", diff --git a/Emby.Server.Implementations/Localization/Core/it.json b/Emby.Server.Implementations/Localization/Core/it.json index 58b7bb61a..b3d9c16cf 100644 --- a/Emby.Server.Implementations/Localization/Core/it.json +++ b/Emby.Server.Implementations/Localization/Core/it.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Tentativo di accesso fallito da {0}", "Favorites": "Preferiti", "Folders": "Cartelle", - "Games": "Giochi", "Genres": "Generi", "HeaderAlbumArtists": "Artisti Album", "HeaderCameraUploads": "Caricamenti Fotocamera", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "La riproduzione audio è iniziata", "NotificationOptionAudioPlaybackStopped": "La riproduzione audio è stata interrotta", "NotificationOptionCameraImageUploaded": "Immagine fotocamera caricata", - "NotificationOptionGamePlayback": "Il gioco è stato avviato", - "NotificationOptionGamePlaybackStopped": "Il gioco è stato fermato", "NotificationOptionInstallationFailed": "Installazione fallita", "NotificationOptionNewLibraryContent": "Nuovo contenuto aggiunto", "NotificationOptionPluginError": "Errore del Plug-in", diff --git a/Emby.Server.Implementations/Localization/Core/kk.json b/Emby.Server.Implementations/Localization/Core/kk.json index 45b8617f1..ae256f79d 100644 --- a/Emby.Server.Implementations/Localization/Core/kk.json +++ b/Emby.Server.Implementations/Localization/Core/kk.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "{0} тарапынан кіру әрекеті сәтсіз", "Favorites": "Таңдаулылар", "Folders": "Қалталар", - "Games": "Ойындар", "Genres": "Жанрлар", "HeaderAlbumArtists": "Альбом орындаушылары", "HeaderCameraUploads": "Камерадан жүктелгендер", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Дыбыс ойнатуы басталды", "NotificationOptionAudioPlaybackStopped": "Дыбыс ойнатуы тоқтатылды", "NotificationOptionCameraImageUploaded": "Камерадан фотосурет кері қотарылған", - "NotificationOptionGamePlayback": "Ойын ойнатуы басталды", - "NotificationOptionGamePlaybackStopped": "Ойын ойнатуы тоқтатылды", "NotificationOptionInstallationFailed": "Орнату сәтсіздігі", "NotificationOptionNewLibraryContent": "Жаңа мазмұн үстелген", "NotificationOptionPluginError": "Плагин сәтсіздігі", diff --git a/Emby.Server.Implementations/Localization/Core/ko.json b/Emby.Server.Implementations/Localization/Core/ko.json index 04fc52d6e..21808fd18 100644 --- a/Emby.Server.Implementations/Localization/Core/ko.json +++ b/Emby.Server.Implementations/Localization/Core/ko.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "앨범 아티스트", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/lt-LT.json b/Emby.Server.Implementations/Localization/Core/lt-LT.json index 653565db6..558904f06 100644 --- a/Emby.Server.Implementations/Localization/Core/lt-LT.json +++ b/Emby.Server.Implementations/Localization/Core/lt-LT.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Žanrai", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/ms.json b/Emby.Server.Implementations/Localization/Core/ms.json index aaaf09788..c01bb0c50 100644 --- a/Emby.Server.Implementations/Localization/Core/ms.json +++ b/Emby.Server.Implementations/Localization/Core/ms.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/nb.json b/Emby.Server.Implementations/Localization/Core/nb.json index ed63aa29c..dbda794ad 100644 --- a/Emby.Server.Implementations/Localization/Core/nb.json +++ b/Emby.Server.Implementations/Localization/Core/nb.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Mislykket påloggingsforsøk fra {0}", "Favorites": "Favoritter", "Folders": "Mapper", - "Games": "Spill", "Genres": "Sjanger", "HeaderAlbumArtists": "Albumartist", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Lyd tilbakespilling startet", "NotificationOptionAudioPlaybackStopped": "Lyd avspilling stoppet", "NotificationOptionCameraImageUploaded": "Kamera bilde lastet opp", - "NotificationOptionGamePlayback": "Spill avspillingen startet", - "NotificationOptionGamePlaybackStopped": "Filmer", "NotificationOptionInstallationFailed": "Installasjon feil", "NotificationOptionNewLibraryContent": "Ny innhold er lagt til", "NotificationOptionPluginError": "Plugin feil", diff --git a/Emby.Server.Implementations/Localization/Core/nl.json b/Emby.Server.Implementations/Localization/Core/nl.json index 7b8c8765e..589753c44 100644 --- a/Emby.Server.Implementations/Localization/Core/nl.json +++ b/Emby.Server.Implementations/Localization/Core/nl.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Mislukte aanmeld poging van {0}", "Favorites": "Favorieten", "Folders": "Mappen", - "Games": "Spellen", "Genres": "Genres", "HeaderAlbumArtists": "Album artiesten", "HeaderCameraUploads": "Camera uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Geluid gestart", "NotificationOptionAudioPlaybackStopped": "Geluid gestopt", "NotificationOptionCameraImageUploaded": "Camera afbeelding geüpload", - "NotificationOptionGamePlayback": "Spel gestart", - "NotificationOptionGamePlaybackStopped": "Spel gestopt", "NotificationOptionInstallationFailed": "Installatie mislukt", "NotificationOptionNewLibraryContent": "Nieuwe content toegevoegd", "NotificationOptionPluginError": "Plug-in fout", diff --git a/Emby.Server.Implementations/Localization/Core/pl.json b/Emby.Server.Implementations/Localization/Core/pl.json index 5aefa740b..92b12409d 100644 --- a/Emby.Server.Implementations/Localization/Core/pl.json +++ b/Emby.Server.Implementations/Localization/Core/pl.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Próba logowania przez {0} zakończona niepowodzeniem", "Favorites": "Ulubione", "Folders": "Foldery", - "Games": "Gry", "Genres": "Gatunki", "HeaderAlbumArtists": "Wykonawcy albumów", "HeaderCameraUploads": "Przekazane obrazy", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Rozpoczęto odtwarzanie muzyki", "NotificationOptionAudioPlaybackStopped": "Odtwarzane dźwięku zatrzymane", "NotificationOptionCameraImageUploaded": "Przekazano obraz z urządzenia mobilnego", - "NotificationOptionGamePlayback": "Odtwarzanie gry rozpoczęte", - "NotificationOptionGamePlaybackStopped": "Odtwarzanie gry zatrzymane", "NotificationOptionInstallationFailed": "Niepowodzenie instalacji", "NotificationOptionNewLibraryContent": "Dodano nową zawartość", "NotificationOptionPluginError": "Awaria wtyczki", diff --git a/Emby.Server.Implementations/Localization/Core/pt-BR.json b/Emby.Server.Implementations/Localization/Core/pt-BR.json index 9ae25d3ac..aaedf0850 100644 --- a/Emby.Server.Implementations/Localization/Core/pt-BR.json +++ b/Emby.Server.Implementations/Localization/Core/pt-BR.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Falha na tentativa de login de {0}", "Favorites": "Favoritos", "Folders": "Pastas", - "Games": "Jogos", "Genres": "Gêneros", "HeaderAlbumArtists": "Artistas do Álbum", "HeaderCameraUploads": "Uploads da Câmera", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Reprodução de áudio iniciada", "NotificationOptionAudioPlaybackStopped": "Reprodução de áudio parada", "NotificationOptionCameraImageUploaded": "Imagem de câmera enviada", - "NotificationOptionGamePlayback": "Reprodução de jogo iniciada", - "NotificationOptionGamePlaybackStopped": "Reprodução de jogo parada", "NotificationOptionInstallationFailed": "Falha na instalação", "NotificationOptionNewLibraryContent": "Novo conteúdo adicionado", "NotificationOptionPluginError": "Falha de plugin", diff --git a/Emby.Server.Implementations/Localization/Core/pt-PT.json b/Emby.Server.Implementations/Localization/Core/pt-PT.json index 59c25f0e3..dc69d8af2 100644 --- a/Emby.Server.Implementations/Localization/Core/pt-PT.json +++ b/Emby.Server.Implementations/Localization/Core/pt-PT.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/ru.json b/Emby.Server.Implementations/Localization/Core/ru.json index 338141294..d799fa50b 100644 --- a/Emby.Server.Implementations/Localization/Core/ru.json +++ b/Emby.Server.Implementations/Localization/Core/ru.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "{0} - попытка входа неудачна", "Favorites": "Избранное", "Folders": "Папки", - "Games": "Игры", "Genres": "Жанры", "HeaderAlbumArtists": "Исп-ли альбома", "HeaderCameraUploads": "Камеры", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Воспр-ие аудио зап-но", "NotificationOptionAudioPlaybackStopped": "Восп-ие аудио ост-но", "NotificationOptionCameraImageUploaded": "Произведена выкладка отснятого с камеры", - "NotificationOptionGamePlayback": "Воспр-ие игры зап-но", - "NotificationOptionGamePlaybackStopped": "Восп-ие игры ост-но", "NotificationOptionInstallationFailed": "Сбой установки", "NotificationOptionNewLibraryContent": "Новое содержание добавлено", "NotificationOptionPluginError": "Сбой плагина", diff --git a/Emby.Server.Implementations/Localization/Core/sk.json b/Emby.Server.Implementations/Localization/Core/sk.json index ed0c68952..bc7e7184e 100644 --- a/Emby.Server.Implementations/Localization/Core/sk.json +++ b/Emby.Server.Implementations/Localization/Core/sk.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Neúspešný pokus o prihlásenie z {0}", "Favorites": "Obľúbené", "Folders": "Priečinky", - "Games": "Hry", "Genres": "Žánre", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Spustené prehrávanie audia", "NotificationOptionAudioPlaybackStopped": "Zastavené prehrávanie audia", "NotificationOptionCameraImageUploaded": "Nahraný obrázok z fotoaparátu", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Hra ukončená", "NotificationOptionInstallationFailed": "Chyba inštalácie", "NotificationOptionNewLibraryContent": "Pridaný nový obsah", "NotificationOptionPluginError": "Chyba rozšírenia", diff --git a/Emby.Server.Implementations/Localization/Core/sl-SI.json b/Emby.Server.Implementations/Localization/Core/sl-SI.json index 8fe279836..e850257d4 100644 --- a/Emby.Server.Implementations/Localization/Core/sl-SI.json +++ b/Emby.Server.Implementations/Localization/Core/sl-SI.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/sv.json b/Emby.Server.Implementations/Localization/Core/sv.json index 517d648bb..fb2761a7d 100644 --- a/Emby.Server.Implementations/Localization/Core/sv.json +++ b/Emby.Server.Implementations/Localization/Core/sv.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Misslyckat inloggningsförsök från {0}", "Favorites": "Favoriter", "Folders": "Mappar", - "Games": "Spel", "Genres": "Genrer", "HeaderAlbumArtists": "Albumartister", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Ljuduppspelning har påbörjats", "NotificationOptionAudioPlaybackStopped": "Ljuduppspelning stoppad", "NotificationOptionCameraImageUploaded": "Kamerabild har laddats upp", - "NotificationOptionGamePlayback": "Spel har startats", - "NotificationOptionGamePlaybackStopped": "Spel stoppat", "NotificationOptionInstallationFailed": "Fel vid installation", "NotificationOptionNewLibraryContent": "Nytt innehåll har lagts till", "NotificationOptionPluginError": "Fel uppstod med tillägget", diff --git a/Emby.Server.Implementations/Localization/Core/tr.json b/Emby.Server.Implementations/Localization/Core/tr.json index 9e86e2125..495f82db6 100644 --- a/Emby.Server.Implementations/Localization/Core/tr.json +++ b/Emby.Server.Implementations/Localization/Core/tr.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/Localization/Core/zh-CN.json b/Emby.Server.Implementations/Localization/Core/zh-CN.json index 6d877ec17..8910a6bce 100644 --- a/Emby.Server.Implementations/Localization/Core/zh-CN.json +++ b/Emby.Server.Implementations/Localization/Core/zh-CN.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "来自 {0} 的失败登入", "Favorites": "最爱", "Folders": "文件夹", - "Games": "游戏", "Genres": "风格", "HeaderAlbumArtists": "专辑作家", "HeaderCameraUploads": "相机上传", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "音频开始播放", "NotificationOptionAudioPlaybackStopped": "音频播放已停止", "NotificationOptionCameraImageUploaded": "相机图片已上传", - "NotificationOptionGamePlayback": "游戏开始", - "NotificationOptionGamePlaybackStopped": "游戏停止", "NotificationOptionInstallationFailed": "安装失败", "NotificationOptionNewLibraryContent": "已添加新内容", "NotificationOptionPluginError": "插件失败", diff --git a/Emby.Server.Implementations/Localization/Core/zh-HK.json b/Emby.Server.Implementations/Localization/Core/zh-HK.json index cad5700fd..387fc2b92 100644 --- a/Emby.Server.Implementations/Localization/Core/zh-HK.json +++ b/Emby.Server.Implementations/Localization/Core/zh-HK.json @@ -14,7 +14,6 @@ "FailedLoginAttemptWithUserName": "Failed login attempt from {0}", "Favorites": "Favorites", "Folders": "Folders", - "Games": "Games", "Genres": "Genres", "HeaderAlbumArtists": "Album Artists", "HeaderCameraUploads": "Camera Uploads", @@ -51,8 +50,6 @@ "NotificationOptionAudioPlayback": "Audio playback started", "NotificationOptionAudioPlaybackStopped": "Audio playback stopped", "NotificationOptionCameraImageUploaded": "Camera image uploaded", - "NotificationOptionGamePlayback": "Game playback started", - "NotificationOptionGamePlaybackStopped": "Game playback stopped", "NotificationOptionInstallationFailed": "Installation failure", "NotificationOptionNewLibraryContent": "New content added", "NotificationOptionPluginError": "Plugin failure", diff --git a/Emby.Server.Implementations/ServerApplicationPaths.cs b/Emby.Server.Implementations/ServerApplicationPaths.cs index edea10a07..67389536b 100644 --- a/Emby.Server.Implementations/ServerApplicationPaths.cs +++ b/Emby.Server.Implementations/ServerApplicationPaths.cs @@ -136,12 +136,6 @@ namespace Emby.Server.Implementations return path; } - /// - /// Gets the game genre path. - /// - /// The game genre path. - public string GameGenrePath => Path.Combine(InternalMetadataPath, "GameGenre"); - private string _internalMetadataPath; public string InternalMetadataPath { diff --git a/Emby.Server.Implementations/Sorting/GameSystemComparer.cs b/Emby.Server.Implementations/Sorting/GameSystemComparer.cs deleted file mode 100644 index 2a04bae3c..000000000 --- a/Emby.Server.Implementations/Sorting/GameSystemComparer.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.Querying; - -namespace Emby.Server.Implementations.Sorting -{ - public class GameSystemComparer : IBaseItemComparer - { - /// - /// Compares the specified x. - /// - /// The x. - /// The y. - /// System.Int32. - public int Compare(BaseItem x, BaseItem y) - { - return string.Compare(GetValue(x), GetValue(y), StringComparison.CurrentCultureIgnoreCase); - } - - /// - /// Gets the value. - /// - /// The x. - /// System.String. - private static string GetValue(BaseItem x) - { - var game = x as Game; - - if (game != null) - { - return game.GameSystem; - } - - var system = x as GameSystem; - - if (system != null) - { - return system.GameSystemName; - } - - return string.Empty; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name => ItemSortBy.GameSystem; - } -} diff --git a/Emby.Server.Implementations/Sorting/PlayersComparer.cs b/Emby.Server.Implementations/Sorting/PlayersComparer.cs deleted file mode 100644 index e3652f36b..000000000 --- a/Emby.Server.Implementations/Sorting/PlayersComparer.cs +++ /dev/null @@ -1,43 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Sorting; -using MediaBrowser.Model.Querying; - -namespace Emby.Server.Implementations.Sorting -{ - public class PlayersComparer : IBaseItemComparer - { - /// - /// Compares the specified x. - /// - /// The x. - /// The y. - /// System.Int32. - public int Compare(BaseItem x, BaseItem y) - { - return GetValue(x).CompareTo(GetValue(y)); - } - - /// - /// Gets the value. - /// - /// The x. - /// System.String. - private static int GetValue(BaseItem x) - { - var game = x as Game; - - if (game != null) - { - return game.PlayersSupported ?? 0; - } - - return 0; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name => ItemSortBy.Players; - } -} diff --git a/Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs b/Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs index 8788cfc26..ce6c2cd87 100644 --- a/Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs +++ b/Emby.Server.Implementations/UserViews/CollectionFolderImageProvider.cs @@ -43,10 +43,6 @@ namespace Emby.Server.Implementations.UserViews { includeItemTypes = new string[] { "Book", "AudioBook" }; } - else if (string.Equals(viewType, CollectionType.Games)) - { - includeItemTypes = new string[] { "Game" }; - } else if (string.Equals(viewType, CollectionType.BoxSets)) { includeItemTypes = new string[] { "BoxSet" }; diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 8decea5a2..4a484b718 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -228,21 +228,6 @@ namespace MediaBrowser.Api return libraryManager.GetMusicGenre(name); } - protected GameGenre GetGameGenre(string name, ILibraryManager libraryManager, DtoOptions dtoOptions) - { - if (name.IndexOf(BaseItem.SlugChar) != -1) - { - var result = GetItemFromSlugName(libraryManager, name, dtoOptions); - - if (result != null) - { - return result; - } - } - - return libraryManager.GetGameGenre(name); - } - protected Person GetPerson(string name, ILibraryManager libraryManager, DtoOptions dtoOptions) { if (name.IndexOf(BaseItem.SlugChar) != -1) @@ -349,10 +334,6 @@ namespace MediaBrowser.Api { item = GetMusicGenre(name, libraryManager, dtoOptions); } - else if (type.IndexOf("GameGenre", StringComparison.OrdinalIgnoreCase) == 0) - { - item = GetGameGenre(name, libraryManager, dtoOptions); - } else if (type.IndexOf("Studio", StringComparison.OrdinalIgnoreCase) == 0) { item = GetStudio(name, libraryManager, dtoOptions); diff --git a/MediaBrowser.Api/FilterService.cs b/MediaBrowser.Api/FilterService.cs index be80305f9..9caf07cea 100644 --- a/MediaBrowser.Api/FilterService.cs +++ b/MediaBrowser.Api/FilterService.cs @@ -143,16 +143,6 @@ namespace MediaBrowser.Api }).ToArray(); } - else if (string.Equals(request.IncludeItemTypes, "Game", StringComparison.OrdinalIgnoreCase) || - string.Equals(request.IncludeItemTypes, "GameSystem", StringComparison.OrdinalIgnoreCase)) - { - filters.Genres = _libraryManager.GetGameGenres(genreQuery).Items.Select(i => new NameGuidPair - { - Name = i.Item1.Name, - Id = i.Item1.Id - - }).ToArray(); - } else { filters.Genres = _libraryManager.GetGenres(genreQuery).Items.Select(i => new NameGuidPair diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.cs deleted file mode 100644 index bb908836c..000000000 --- a/MediaBrowser.Api/GamesService.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using MediaBrowser.Controller.Dto; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Net; -using MediaBrowser.Controller.Persistence; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Services; - -namespace MediaBrowser.Api -{ - /// - /// Class GetGameSystemSummaries - /// - [Route("/Games/SystemSummaries", "GET", Summary = "Finds games similar to a given game.")] - public class GetGameSystemSummaries : IReturn - { - /// - /// Gets or sets the user id. - /// - /// The user id. - [ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid UserId { get; set; } - } - - /// - /// Class GamesService - /// - [Authenticated] - public class GamesService : BaseApiService - { - /// - /// The _user manager - /// - private readonly IUserManager _userManager; - - /// - /// The _user data repository - /// - private readonly IUserDataManager _userDataRepository; - /// - /// The _library manager - /// - private readonly ILibraryManager _libraryManager; - - /// - /// The _item repo - /// - private readonly IItemRepository _itemRepo; - /// - /// The _dto service - /// - private readonly IDtoService _dtoService; - - private readonly IAuthorizationContext _authContext; - - /// - /// Initializes a new instance of the class. - /// - /// The user manager. - /// The user data repository. - /// The library manager. - /// The item repo. - /// The dto service. - public GamesService(IUserManager userManager, IUserDataManager userDataRepository, ILibraryManager libraryManager, IItemRepository itemRepo, IDtoService dtoService, IAuthorizationContext authContext) - { - _userManager = userManager; - _userDataRepository = userDataRepository; - _libraryManager = libraryManager; - _itemRepo = itemRepo; - _dtoService = dtoService; - _authContext = authContext; - } - - /// - /// Gets the specified request. - /// - /// The request. - /// System.Object. - public object Get(GetGameSystemSummaries request) - { - var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId); - var query = new InternalItemsQuery(user) - { - IncludeItemTypes = new[] { typeof(GameSystem).Name }, - DtoOptions = new DtoOptions(false) - { - EnableImages = false - } - }; - - var result = _libraryManager.GetItemList(query) - .Cast() - .Select(i => GetSummary(i, user)) - .ToArray(); - - return ToOptimizedResult(result); - } - - /// - /// Gets the summary. - /// - /// The system. - /// The user. - /// GameSystemSummary. - private GameSystemSummary GetSummary(GameSystem system, User user) - { - var summary = new GameSystemSummary - { - Name = system.GameSystemName, - DisplayName = system.Name - }; - - var items = user == null ? - system.GetRecursiveChildren(i => i is Game) : - system.GetRecursiveChildren(user, new InternalItemsQuery(user) - { - IncludeItemTypes = new[] { typeof(Game).Name }, - DtoOptions = new DtoOptions(false) - { - EnableImages = false - } - }); - - var games = items.Cast().ToArray(); - - summary.ClientInstalledGameCount = games.Count(i => i.IsPlaceHolder); - - summary.GameCount = games.Length; - - summary.GameFileExtensions = games.Where(i => !i.IsPlaceHolder).Select(i => Path.GetExtension(i.Path)) - .Distinct(StringComparer.OrdinalIgnoreCase) - .ToArray(); - - return summary; - } - } -} diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 149e54f01..b5e23476e 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -95,8 +95,6 @@ namespace MediaBrowser.Api.Images [Route("/Artists/{Name}/Images/{Type}/{Index}", "GET")] [Route("/Genres/{Name}/Images/{Type}", "GET")] [Route("/Genres/{Name}/Images/{Type}/{Index}", "GET")] - [Route("/GameGenres/{Name}/Images/{Type}", "GET")] - [Route("/GameGenres/{Name}/Images/{Type}/{Index}", "GET")] [Route("/MusicGenres/{Name}/Images/{Type}", "GET")] [Route("/MusicGenres/{Name}/Images/{Type}/{Index}", "GET")] [Route("/Persons/{Name}/Images/{Type}", "GET")] @@ -109,8 +107,6 @@ namespace MediaBrowser.Api.Images [Route("/Artists/{Name}/Images/{Type}/{Index}", "HEAD")] [Route("/Genres/{Name}/Images/{Type}", "HEAD")] [Route("/Genres/{Name}/Images/{Type}/{Index}", "HEAD")] - [Route("/GameGenres/{Name}/Images/{Type}", "HEAD")] - [Route("/GameGenres/{Name}/Images/{Type}/{Index}", "HEAD")] [Route("/MusicGenres/{Name}/Images/{Type}", "HEAD")] [Route("/MusicGenres/{Name}/Images/{Type}/{Index}", "HEAD")] [Route("/Persons/{Name}/Images/{Type}", "HEAD")] diff --git a/MediaBrowser.Api/ItemLookupService.cs b/MediaBrowser.Api/ItemLookupService.cs index 0e7bdc086..f3ea7907f 100644 --- a/MediaBrowser.Api/ItemLookupService.cs +++ b/MediaBrowser.Api/ItemLookupService.cs @@ -57,12 +57,6 @@ namespace MediaBrowser.Api { } - [Route("/Items/RemoteSearch/Game", "POST")] - [Authenticated] - public class GetGameRemoteSearchResults : RemoteSearchQuery, IReturn> - { - } - [Route("/Items/RemoteSearch/BoxSet", "POST")] [Authenticated] public class GetBoxSetRemoteSearchResults : RemoteSearchQuery, IReturn> @@ -173,13 +167,6 @@ namespace MediaBrowser.Api return ToOptimizedResult(result); } - public async Task Post(GetGameRemoteSearchResults request) - { - var result = await _providerManager.GetRemoteSearchResults(request, CancellationToken.None).ConfigureAwait(false); - - return ToOptimizedResult(result); - } - public async Task Post(GetBoxSetRemoteSearchResults request) { var result = await _providerManager.GetRemoteSearchResults(request, CancellationToken.None).ConfigureAwait(false); diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index c386b25b8..3c8d4b4ff 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -154,11 +154,6 @@ namespace MediaBrowser.Api Name = "Books", Value = "books" }); - list.Add(new NameValuePair - { - Name = "Games", - Value = "games" - }); } list.Add(new NameValuePair diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index 12d807a7e..8e6d1febb 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -265,7 +265,6 @@ namespace MediaBrowser.Api.Library public string Id { get; set; } } - [Route("/Games/{Id}/Similar", "GET", Summary = "Finds games similar to a given game.")] [Route("/Artists/{Id}/Similar", "GET", Summary = "Finds albums similar to a given album.")] [Route("/Items/{Id}/Similar", "GET", Summary = "Gets similar items")] [Route("/Albums/{Id}/Similar", "GET", Summary = "Finds albums similar to a given album.")] @@ -369,8 +368,6 @@ namespace MediaBrowser.Api.Library return new string[] { "Series", "Season", "Episode" }; case CollectionType.Books: return new string[] { "Book" }; - case CollectionType.Games: - return new string[] { "Game", "GameSystem" }; case CollectionType.Music: return new string[] { "MusicAlbum", "MusicArtist", "Audio", "MusicVideo" }; case CollectionType.HomeVideos: @@ -952,8 +949,6 @@ namespace MediaBrowser.Api.Library { AlbumCount = GetCount(typeof(MusicAlbum), user, request), EpisodeCount = GetCount(typeof(Episode), user, request), - GameCount = GetCount(typeof(Game), user, request), - GameSystemCount = GetCount(typeof(GameSystem), user, request), MovieCount = GetCount(typeof(Movie), user, request), SeriesCount = GetCount(typeof(Series), user, request), SongCount = GetCount(typeof(Audio), user, request), diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.cs index c9a11c117..f011e6e41 100644 --- a/MediaBrowser.Api/Session/SessionsService.cs +++ b/MediaBrowser.Api/Session/SessionsService.cs @@ -194,7 +194,7 @@ namespace MediaBrowser.Api.Session [ApiMember(Name = "Id", Description = "Session Id", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "POST")] public string Id { get; set; } - [ApiMember(Name = "PlayableMediaTypes", Description = "A list of playable media types, comma delimited. Audio, Video, Book, Game, Photo.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] + [ApiMember(Name = "PlayableMediaTypes", Description = "A list of playable media types, comma delimited. Audio, Video, Book, Photo.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] public string PlayableMediaTypes { get; set; } [ApiMember(Name = "SupportedCommands", Description = "A list of supported remote control commands, comma delimited", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")] diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index 6e577c53e..471b41127 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -224,7 +224,6 @@ namespace MediaBrowser.Api.UserLibrary dto.TrailerCount = counts.TrailerCount; dto.AlbumCount = counts.AlbumCount; dto.SongCount = counts.SongCount; - dto.GameCount = counts.GameCount; dto.ArtistCount = counts.ArtistCount; } diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs index 4cccc0cb5..7af50c329 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs @@ -42,12 +42,6 @@ namespace MediaBrowser.Api.UserLibrary [ApiMember(Name = "MinIndexNumber", Description = "Optional filter by minimum index number.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? MinIndexNumber { get; set; } - [ApiMember(Name = "MinPlayers", Description = "Optional filter by minimum number of game players.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] - public int? MinPlayers { get; set; } - - [ApiMember(Name = "MaxPlayers", Description = "Optional filter by maximum number of game players.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] - public int? MaxPlayers { get; set; } - [ApiMember(Name = "ParentIndexNumber", Description = "Optional filter by parent index number.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")] public int? ParentIndexNumber { get; set; } diff --git a/MediaBrowser.Api/UserLibrary/GameGenresService.cs b/MediaBrowser.Api/UserLibrary/GameGenresService.cs deleted file mode 100644 index 3e0d4aca4..000000000 --- a/MediaBrowser.Api/UserLibrary/GameGenresService.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using MediaBrowser.Controller.Dto; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Net; -using MediaBrowser.Controller.Persistence; -using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Querying; -using MediaBrowser.Model.Services; - -namespace MediaBrowser.Api.UserLibrary -{ - [Route("/GameGenres", "GET", Summary = "Gets all Game genres from a given item, folder, or the entire library")] - public class GetGameGenres : GetItemsByName - { - } - - [Route("/GameGenres/{Name}", "GET", Summary = "Gets a Game genre, by name")] - public class GetGameGenre : IReturn - { - /// - /// Gets or sets the name. - /// - /// The name. - [ApiMember(Name = "Name", Description = "The genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] - public string Name { get; set; } - - /// - /// Gets or sets the user id. - /// - /// The user id. - [ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")] - public Guid UserId { get; set; } - } - - [Authenticated] - public class GameGenresService : BaseItemsByNameService - { - /// - /// Gets the specified request. - /// - /// The request. - /// System.Object. - public object Get(GetGameGenre request) - { - var result = GetItem(request); - - return ToOptimizedResult(result); - } - - /// - /// Gets the item. - /// - /// The request. - /// Task{BaseItemDto}. - private BaseItemDto GetItem(GetGameGenre request) - { - var dtoOptions = GetDtoOptions(AuthorizationContext, request); - - var item = GetGameGenre(request.Name, LibraryManager, dtoOptions); - - if (!request.UserId.Equals(Guid.Empty)) - { - var user = UserManager.GetUserById(request.UserId); - - return DtoService.GetBaseItemDto(item, dtoOptions, user); - } - - return DtoService.GetBaseItemDto(item, dtoOptions); - } - - /// - /// Gets the specified request. - /// - /// The request. - /// System.Object. - public object Get(GetGameGenres request) - { - var result = GetResultSlim(request); - - return ToOptimizedResult(result); - } - - protected override QueryResult> GetItems(GetItemsByName request, InternalItemsQuery query) - { - return LibraryManager.GetGameGenres(query); - } - - /// - /// Gets all items. - /// - /// The request. - /// The items. - /// IEnumerable{Tuple{System.StringFunc{System.Int32}}}. - protected override IEnumerable GetAllItems(GetItemsByName request, IList items) - { - throw new NotImplementedException(); - } - - public GameGenresService(IUserManager userManager, ILibraryManager libraryManager, IUserDataManager userDataRepository, IItemRepository itemRepository, IDtoService dtoService, IAuthorizationContext authorizationContext) : base(userManager, libraryManager, userDataRepository, itemRepository, dtoService, authorizationContext) - { - } - } -} diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs index e20428ead..baf570d50 100644 --- a/MediaBrowser.Api/UserLibrary/GenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GenresService.cs @@ -101,11 +101,6 @@ namespace MediaBrowser.Api.UserLibrary return LibraryManager.GetMusicGenres(query); } - if (string.Equals(viewType, CollectionType.Games)) - { - return LibraryManager.GetGameGenres(query); - } - return LibraryManager.GetGenres(query); } diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.cs index bf453576c..3ae7da007 100644 --- a/MediaBrowser.Api/UserLibrary/ItemsService.cs +++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs @@ -304,8 +304,6 @@ namespace MediaBrowser.Api.UserLibrary VideoTypes = request.GetVideoTypes(), AdjacentTo = request.AdjacentTo, ItemIds = GetGuids(request.Ids), - MinPlayers = request.MinPlayers, - MaxPlayers = request.MaxPlayers, MinCommunityRating = request.MinCommunityRating, MinCriticRating = request.MinCriticRating, ParentId = string.IsNullOrWhiteSpace(request.ParentId) ? Guid.Empty : new Guid(request.ParentId), diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index dab96509c..8bfadbee6 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -1149,16 +1149,6 @@ namespace MediaBrowser.Controller.Entities return false; } - if (request.MinPlayers.HasValue) - { - return false; - } - - if (request.MaxPlayers.HasValue) - { - return false; - } - if (request.MinCommunityRating.HasValue) { return false; diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs deleted file mode 100644 index eea1bf43d..000000000 --- a/MediaBrowser.Controller/Entities/Game.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections.Generic; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Serialization; - -namespace MediaBrowser.Controller.Entities -{ - public class Game : BaseItem, IHasTrailers, IHasScreenshots, ISupportsPlaceHolders, IHasLookupInfo - { - public Game() - { - MultiPartGameFiles = Array.Empty(); - RemoteTrailers = EmptyMediaUrlArray; - LocalTrailerIds = Array.Empty(); - RemoteTrailerIds = Array.Empty(); - } - - public Guid[] LocalTrailerIds { get; set; } - public Guid[] RemoteTrailerIds { get; set; } - - public override bool CanDownload() - { - return IsFileProtocol; - } - - [IgnoreDataMember] - public override bool SupportsThemeMedia => true; - - [IgnoreDataMember] - public override bool SupportsPeople => false; - - /// - /// Gets the type of the media. - /// - /// The type of the media. - [IgnoreDataMember] - public override string MediaType => Model.Entities.MediaType.Game; - - /// - /// Gets or sets the players supported. - /// - /// The players supported. - public int? PlayersSupported { get; set; } - - /// - /// Gets a value indicating whether this instance is place holder. - /// - /// true if this instance is place holder; otherwise, false. - public bool IsPlaceHolder { get; set; } - - /// - /// Gets or sets the game system. - /// - /// The game system. - public string GameSystem { get; set; } - - /// - /// Gets or sets a value indicating whether this instance is multi part. - /// - /// true if this instance is multi part; otherwise, false. - public bool IsMultiPart { get; set; } - - /// - /// Holds the paths to the game files in the event this is a multipart game - /// - public string[] MultiPartGameFiles { get; set; } - - public override List GetUserDataKeys() - { - var list = base.GetUserDataKeys(); - var id = this.GetProviderId(MetadataProviders.Gamesdb); - - if (!string.IsNullOrEmpty(id)) - { - list.Insert(0, "Game-Gamesdb-" + id); - } - return list; - } - - public override IEnumerable GetDeletePaths() - { - if (!IsInMixedFolder) - { - return new[] { - new FileSystemMetadata - { - FullName = System.IO.Path.GetDirectoryName(Path), - IsDirectory = true - } - }; - } - - return base.GetDeletePaths(); - } - - public override UnratedItem GetBlockUnratedType() - { - return UnratedItem.Game; - } - - public GameInfo GetLookupInfo() - { - var id = GetItemLookupInfo(); - - id.GameSystem = GameSystem; - - return id; - } - } -} diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs deleted file mode 100644 index c0fd4ae89..000000000 --- a/MediaBrowser.Controller/Entities/GameGenre.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using MediaBrowser.Controller.Extensions; -using MediaBrowser.Model.Serialization; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.Controller.Entities -{ - public class GameGenre : BaseItem, IItemByName - { - public override List GetUserDataKeys() - { - var list = base.GetUserDataKeys(); - - list.Insert(0, GetType().Name + "-" + (Name ?? string.Empty).RemoveDiacritics()); - return list; - } - - public override string CreatePresentationUniqueKey() - { - return GetUserDataKeys()[0]; - } - - public override double GetDefaultPrimaryImageAspectRatio() - { - return 1; - } - - /// - /// Returns the folder containing the item. - /// If the item is a folder, it returns the folder itself - /// - /// The containing folder path. - [IgnoreDataMember] - public override string ContainingFolderPath => Path; - - [IgnoreDataMember] - public override bool SupportsAncestors => false; - - public override bool IsSaveLocalMetadataEnabled() - { - return true; - } - - public override bool CanDelete() - { - return false; - } - - public IList GetTaggedItems(InternalItemsQuery query) - { - query.GenreIds = new[] { Id }; - query.IncludeItemTypes = new[] { typeof(Game).Name }; - - return LibraryManager.GetItemList(query); - } - - [IgnoreDataMember] - public override bool SupportsPeople => false; - - public static string GetPath(string name) - { - return GetPath(name, true); - } - - public static string GetPath(string name, bool normalizeName) - { - // Trim the period at the end because windows will have a hard time with that - var validName = normalizeName ? - FileSystem.GetValidFilename(name).Trim().TrimEnd('.') : - name; - - return System.IO.Path.Combine(ConfigurationManager.ApplicationPaths.GameGenrePath, validName); - } - - private string GetRebasedPath() - { - return GetPath(System.IO.Path.GetFileName(Path), false); - } - - public override bool RequiresRefresh() - { - var newPath = GetRebasedPath(); - if (!string.Equals(Path, newPath, StringComparison.Ordinal)) - { - Logger.LogDebug("{0} path has changed from {1} to {2}", GetType().Name, Path, newPath); - return true; - } - return base.RequiresRefresh(); - } - - /// - /// This is called before any metadata refresh and returns true or false indicating if changes were made - /// - public override bool BeforeMetadataRefresh(bool replaceAllMetdata) - { - var hasChanges = base.BeforeMetadataRefresh(replaceAllMetdata); - - var newPath = GetRebasedPath(); - if (!string.Equals(Path, newPath, StringComparison.Ordinal)) - { - Path = newPath; - hasChanges = true; - } - - return hasChanges; - } - } -} diff --git a/MediaBrowser.Controller/Entities/GameSystem.cs b/MediaBrowser.Controller/Entities/GameSystem.cs deleted file mode 100644 index 63f830d25..000000000 --- a/MediaBrowser.Controller/Entities/GameSystem.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Configuration; -using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Users; - -namespace MediaBrowser.Controller.Entities -{ - /// - /// Class GameSystem - /// - public class GameSystem : Folder, IHasLookupInfo - { - /// - /// Return the id that should be used to key display prefs for this item. - /// Default is based on the type for everything except actual generic folders. - /// - /// The display prefs id. - [IgnoreDataMember] - public override Guid DisplayPreferencesId => Id; - - [IgnoreDataMember] - public override bool SupportsPlayedStatus => false; - - [IgnoreDataMember] - public override bool SupportsInheritedParentImages => false; - - public override double GetDefaultPrimaryImageAspectRatio() - { - double value = 16; - value /= 9; - - return value; - } - - /// - /// Gets or sets the game system. - /// - /// The game system. - public string GameSystemName { get; set; } - - public override List GetUserDataKeys() - { - var list = base.GetUserDataKeys(); - - if (!string.IsNullOrEmpty(GameSystemName)) - { - list.Insert(0, "GameSystem-" + GameSystemName); - } - return list; - } - - protected override bool GetBlockUnratedValue(UserPolicy config) - { - // Don't block. Determine by game - return false; - } - - public override UnratedItem GetBlockUnratedType() - { - return UnratedItem.Game; - } - - public GameSystemInfo GetLookupInfo() - { - var id = GetItemLookupInfo(); - - id.Path = Path; - - return id; - } - - [IgnoreDataMember] - public override bool SupportsPeople => false; - } -} diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs index 3f3ab3551..44cb62d22 100644 --- a/MediaBrowser.Controller/Entities/Genre.cs +++ b/MediaBrowser.Controller/Entities/Genre.cs @@ -56,7 +56,7 @@ namespace MediaBrowser.Controller.Entities public IList GetTaggedItems(InternalItemsQuery query) { query.GenreIds = new[] { Id }; - query.ExcludeItemTypes = new[] { typeof(Game).Name, typeof(MusicVideo).Name, typeof(Audio.Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name }; + query.ExcludeItemTypes = new[] { typeof(MusicVideo).Name, typeof(Audio.Audio).Name, typeof(MusicAlbum).Name, typeof(MusicArtist).Name }; return LibraryManager.GetItemList(query); } diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs index 4b7af5391..78f859069 100644 --- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs @@ -95,9 +95,6 @@ namespace MediaBrowser.Controller.Entities public bool? IsKids { get; set; } public bool? IsNews { get; set; } public bool? IsSeries { get; set; } - - public int? MinPlayers { get; set; } - public int? MaxPlayers { get; set; } public int? MinIndexNumber { get; set; } public int? AiredDuringSeason { get; set; } public double? MinCriticRating { get; set; } diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs index de4105df9..3e2191376 100644 --- a/MediaBrowser.Controller/Entities/UserView.cs +++ b/MediaBrowser.Controller/Entities/UserView.cs @@ -150,7 +150,6 @@ namespace MediaBrowser.Controller.Entities private static string[] OriginalFolderViewTypes = new string[] { - MediaBrowser.Model.Entities.CollectionType.Games, MediaBrowser.Model.Entities.CollectionType.Books, MediaBrowser.Model.Entities.CollectionType.MusicVideos, MediaBrowser.Model.Entities.CollectionType.HomeVideos, diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.cs index 0b0134669..683218a9e 100644 --- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs +++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs @@ -848,52 +848,6 @@ namespace MediaBrowser.Controller.Entities } } - if (query.MinPlayers.HasValue) - { - var filterValue = query.MinPlayers.Value; - - var game = item as Game; - - if (game != null) - { - var players = game.PlayersSupported ?? 1; - - var ok = players >= filterValue; - - if (!ok) - { - return false; - } - } - else - { - return false; - } - } - - if (query.MaxPlayers.HasValue) - { - var filterValue = query.MaxPlayers.Value; - - var game = item as Game; - - if (game != null) - { - var players = game.PlayersSupported ?? 1; - - var ok = players <= filterValue; - - if (!ok) - { - return false; - } - } - else - { - return false; - } - } - if (query.MinCommunityRating.HasValue) { var val = query.MinCommunityRating.Value; diff --git a/MediaBrowser.Controller/IServerApplicationPaths.cs b/MediaBrowser.Controller/IServerApplicationPaths.cs index 2b43513b7..15d7e9f62 100644 --- a/MediaBrowser.Controller/IServerApplicationPaths.cs +++ b/MediaBrowser.Controller/IServerApplicationPaths.cs @@ -46,12 +46,6 @@ namespace MediaBrowser.Controller /// The music genre path. string MusicGenrePath { get; } - /// - /// Gets the game genre path. - /// - /// The game genre path. - string GameGenrePath { get; } - /// /// Gets the path to the Studio directory /// diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index 9d404ba1a..60c183d04 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -88,13 +88,6 @@ namespace MediaBrowser.Controller.Library /// Task{MusicGenre}. MusicGenre GetMusicGenre(string name); - /// - /// Gets the game genre. - /// - /// The name. - /// Task{GameGenre}. - GameGenre GetGameGenre(string name); - /// /// Gets a Year /// @@ -521,8 +514,6 @@ namespace MediaBrowser.Controller.Library Guid GetMusicGenreId(string name); - Guid GetGameGenreId(string name); - Task AddVirtualFolder(string name, string collectionType, LibraryOptions options, bool refreshLibrary); Task RemoveVirtualFolder(string name, bool refreshLibrary); void AddMediaPath(string virtualFolderName, MediaPathInfo path); @@ -531,7 +522,6 @@ namespace MediaBrowser.Controller.Library QueryResult> GetGenres(InternalItemsQuery query); QueryResult> GetMusicGenres(InternalItemsQuery query); - QueryResult> GetGameGenres(InternalItemsQuery query); QueryResult> GetStudios(InternalItemsQuery query); QueryResult> GetArtists(InternalItemsQuery query); QueryResult> GetAlbumArtists(InternalItemsQuery query); diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 0d086fd7e..5156fce11 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -143,13 +143,11 @@ namespace MediaBrowser.Controller.Persistence QueryResult> GetGenres(InternalItemsQuery query); QueryResult> GetMusicGenres(InternalItemsQuery query); - QueryResult> GetGameGenres(InternalItemsQuery query); QueryResult> GetStudios(InternalItemsQuery query); QueryResult> GetArtists(InternalItemsQuery query); QueryResult> GetAlbumArtists(InternalItemsQuery query); QueryResult> GetAllArtists(InternalItemsQuery query); - List GetGameGenreNames(); List GetMusicGenreNames(); List GetStudioNames(); List GetGenreNames(); diff --git a/MediaBrowser.Controller/Providers/GameInfo.cs b/MediaBrowser.Controller/Providers/GameInfo.cs deleted file mode 100644 index 1f3eb40b7..000000000 --- a/MediaBrowser.Controller/Providers/GameInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace MediaBrowser.Controller.Providers -{ - public class GameInfo : ItemLookupInfo - { - /// - /// Gets or sets the game system. - /// - /// The game system. - public string GameSystem { get; set; } - } -} diff --git a/MediaBrowser.Controller/Providers/GameSystemInfo.cs b/MediaBrowser.Controller/Providers/GameSystemInfo.cs deleted file mode 100644 index 796486b82..000000000 --- a/MediaBrowser.Controller/Providers/GameSystemInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace MediaBrowser.Controller.Providers -{ - public class GameSystemInfo : ItemLookupInfo - { - /// - /// Gets or sets the path. - /// - /// The path. - public string Path { get; set; } - } -} diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs index 0a4928ed7..b13e77ebd 100644 --- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs @@ -128,7 +128,6 @@ namespace MediaBrowser.LocalMetadata.Images var added = false; var isEpisode = item is Episode; var isSong = item.GetType() == typeof(Audio); - var isGame = item is Game; var isPerson = item is Person; // Logo @@ -157,7 +156,7 @@ namespace MediaBrowser.LocalMetadata.Images added = AddImage(files, images, "disc", imagePrefix, isInMixedFolder, ImageType.Disc); } } - else if (isGame || item is Video || item is BoxSet) + else if (item is Video || item is BoxSet) { added = AddImage(files, images, "disc", imagePrefix, isInMixedFolder, ImageType.Disc); @@ -172,19 +171,6 @@ namespace MediaBrowser.LocalMetadata.Images } } - if (isGame) - { - AddImage(files, images, "box", imagePrefix, isInMixedFolder, ImageType.Box); - AddImage(files, images, "menu", imagePrefix, isInMixedFolder, ImageType.Menu); - - added = AddImage(files, images, "back", imagePrefix, isInMixedFolder, ImageType.BoxRear); - - if (!added) - { - added = AddImage(files, images, "boxrear", imagePrefix, isInMixedFolder, ImageType.BoxRear); - } - } - // Banner if (!isEpisode && !isSong && !isPerson) { diff --git a/MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs deleted file mode 100644 index a4997270f..000000000 --- a/MediaBrowser.LocalMetadata/Parsers/GameSystemXmlParser.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using System.Xml; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Xml; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.LocalMetadata.Parsers -{ - public class GameSystemXmlParser : BaseItemXmlParser - { - public Task FetchAsync(MetadataResult item, string metadataFile, CancellationToken cancellationToken) - { - Fetch(item, metadataFile, cancellationToken); - - cancellationToken.ThrowIfCancellationRequested(); - - return Task.CompletedTask; - } - - /// - /// Fetches the data from XML node. - /// - /// The reader. - /// The result. - protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult result) - { - var item = result.Item; - - switch (reader.Name) - { - case "GameSystem": - { - var val = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(val)) - { - item.GameSystemName = val; - } - break; - } - - case "GamesDbId": - { - var val = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(val)) - { - item.SetProviderId(MetadataProviders.Gamesdb, val); - } - break; - } - - - default: - base.FetchDataFromXmlNode(reader, result); - break; - } - } - - public GameSystemXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem) - { - } - } -} diff --git a/MediaBrowser.LocalMetadata/Parsers/GameXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/GameXmlParser.cs deleted file mode 100644 index df7c51f27..000000000 --- a/MediaBrowser.LocalMetadata/Parsers/GameXmlParser.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System.Globalization; -using System.Threading; -using System.Threading.Tasks; -using System.Xml; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Xml; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.LocalMetadata.Parsers -{ - /// - /// Class EpisodeXmlParser - /// - public class GameXmlParser : BaseItemXmlParser - { - private readonly CultureInfo _usCulture = new CultureInfo("en-US"); - - public Task FetchAsync(MetadataResult item, string metadataFile, CancellationToken cancellationToken) - { - Fetch(item, metadataFile, cancellationToken); - - cancellationToken.ThrowIfCancellationRequested(); - - return Task.CompletedTask; - } - - /// - /// Fetches the data from XML node. - /// - /// The reader. - /// The result. - protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult result) - { - var item = result.Item; - - switch (reader.Name) - { - case "GameSystem": - { - var val = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(val)) - { - item.GameSystem = val; - } - break; - } - - case "GamesDbId": - { - var val = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(val)) - { - item.SetProviderId(MetadataProviders.Gamesdb, val); - } - break; - } - - case "Players": - { - var val = reader.ReadElementContentAsString(); - if (!string.IsNullOrWhiteSpace(val)) - { - if (int.TryParse(val, NumberStyles.Integer, _usCulture, out var num)) - { - item.PlayersSupported = num; - } - } - break; - } - - - default: - base.FetchDataFromXmlNode(reader, result); - break; - } - } - - public GameXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem) - { - } - } -} diff --git a/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs deleted file mode 100644 index 62f31d4fa..000000000 --- a/MediaBrowser.LocalMetadata/Providers/GameSystemXmlProvider.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.IO; -using System.Threading; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.LocalMetadata.Parsers; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Xml; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.LocalMetadata.Providers -{ - public class GameSystemXmlProvider : BaseXmlProvider - { - private readonly ILogger _logger; - private readonly IProviderManager _providerManager; - private readonly IXmlReaderSettingsFactory _xmlSettings; - - public GameSystemXmlProvider(IFileSystem fileSystem, ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlSettings) - : base(fileSystem) - { - _logger = logger; - _providerManager = providerManager; - _xmlSettings = xmlSettings; - } - - protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) - { - new GameSystemXmlParser(_logger, _providerManager, _xmlSettings, FileSystem).Fetch(result, path, cancellationToken); - } - - protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService) - { - return directoryService.GetFile(Path.Combine(info.Path, "gamesystem.xml")); - } - } -} diff --git a/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs b/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs deleted file mode 100644 index acdbb0a29..000000000 --- a/MediaBrowser.LocalMetadata/Providers/GameXmlProvider.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.IO; -using System.Threading; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Providers; -using MediaBrowser.LocalMetadata.Parsers; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Xml; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.LocalMetadata.Providers -{ - public class GameXmlProvider : BaseXmlProvider - { - private readonly ILogger _logger; - private readonly IProviderManager _providerManager; - private readonly IXmlReaderSettingsFactory _xmlSettings; - - public GameXmlProvider(IFileSystem fileSystem, ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlSettings) - : base(fileSystem) - { - _logger = logger; - _providerManager = providerManager; - _xmlSettings = xmlSettings; - } - - protected override void Fetch(MetadataResult result, string path, CancellationToken cancellationToken) - { - new GameXmlParser(_logger, _providerManager, _xmlSettings, FileSystem).Fetch(result, path, cancellationToken); - } - - protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService) - { - var specificFile = Path.ChangeExtension(info.Path, ".xml"); - var file = FileSystem.GetFileInfo(specificFile); - - return info.IsInMixedFolder || file.Exists ? file : FileSystem.GetFileInfo(Path.Combine(Path.GetDirectoryName(info.Path), "game.xml")); - } - } -} diff --git a/MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs deleted file mode 100644 index cf123171a..000000000 --- a/MediaBrowser.LocalMetadata/Savers/GameSystemXmlSaver.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.IO; -using System.Xml; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Xml; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.LocalMetadata.Savers -{ - public class GameSystemXmlSaver : BaseXmlSaver - { - public GameSystemXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory) - { - } - - public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) - { - if (!item.SupportsLocalMetadata) - { - return false; - } - - return item is GameSystem && updateType >= ItemUpdateType.MetadataDownload; - } - - protected override void WriteCustomElements(BaseItem item, XmlWriter writer) - { - var gameSystem = (GameSystem)item; - - if (!string.IsNullOrEmpty(gameSystem.GameSystemName)) - { - writer.WriteElementString("GameSystem", gameSystem.GameSystemName); - } - } - - protected override string GetLocalSavePath(BaseItem item) - { - return Path.Combine(item.Path, "gamesystem.xml"); - } - - protected override string GetRootElementName(BaseItem item) - { - return "Item"; - } - } -} diff --git a/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs deleted file mode 100644 index 3b7929618..000000000 --- a/MediaBrowser.LocalMetadata/Savers/GameXmlSaver.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Globalization; -using System.IO; -using System.Xml; -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Model.IO; -using MediaBrowser.Model.Xml; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.LocalMetadata.Savers -{ - /// - /// Saves game.xml for games - /// - public class GameXmlSaver : BaseXmlSaver - { - private readonly CultureInfo UsCulture = new CultureInfo("en-US"); - - public override bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) - { - if (!item.SupportsLocalMetadata) - { - return false; - } - - return item is Game && updateType >= ItemUpdateType.MetadataDownload; - } - - protected override void WriteCustomElements(BaseItem item, XmlWriter writer) - { - var game = (Game)item; - - if (!string.IsNullOrEmpty(game.GameSystem)) - { - writer.WriteElementString("GameSystem", game.GameSystem); - } - if (game.PlayersSupported.HasValue) - { - writer.WriteElementString("Players", game.PlayersSupported.Value.ToString(UsCulture)); - } - } - - protected override string GetLocalSavePath(BaseItem item) - { - return GetGameSavePath((Game)item); - } - - protected override string GetRootElementName(BaseItem item) - { - return "Item"; - } - - public static string GetGameSavePath(Game item) - { - if (item.IsInMixedFolder) - { - return Path.ChangeExtension(item.Path, ".xml"); - } - - return Path.Combine(item.ContainingFolderPath, "game.xml"); - } - - public GameXmlSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory) - { - } - } -} diff --git a/MediaBrowser.Model/Channels/ChannelMediaContentType.cs b/MediaBrowser.Model/Channels/ChannelMediaContentType.cs index 010ff8048..fc7c21706 100644 --- a/MediaBrowser.Model/Channels/ChannelMediaContentType.cs +++ b/MediaBrowser.Model/Channels/ChannelMediaContentType.cs @@ -16,8 +16,6 @@ namespace MediaBrowser.Model.Channels MovieExtra = 6, - TvExtra = 7, - - GameExtra = 8 + TvExtra = 7 } } diff --git a/MediaBrowser.Model/Configuration/UnratedItem.cs b/MediaBrowser.Model/Configuration/UnratedItem.cs index 2d0bce47f..107b4e520 100644 --- a/MediaBrowser.Model/Configuration/UnratedItem.cs +++ b/MediaBrowser.Model/Configuration/UnratedItem.cs @@ -6,7 +6,6 @@ namespace MediaBrowser.Model.Configuration Trailer, Series, Music, - Game, Book, LiveTvChannel, LiveTvProgram, diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 3e267a39d..b382d9d4a 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -116,16 +116,8 @@ namespace MediaBrowser.Model.Dto /// The critic rating. public float? CriticRating { get; set; } - /// - /// Gets or sets the game system. - /// - /// The game system. - public string GameSystem { get; set; } - public string[] ProductionLocations { get; set; } - public string[] MultiPartGameFiles { get; set; } - /// /// Gets or sets the path. /// @@ -604,11 +596,6 @@ namespace MediaBrowser.Model.Dto /// The episode count. public int? EpisodeCount { get; set; } /// - /// Gets or sets the game count. - /// - /// The game count. - public int? GameCount { get; set; } - /// /// Gets or sets the song count. /// /// The song count. diff --git a/MediaBrowser.Model/Dto/GameSystemSummary.cs b/MediaBrowser.Model/Dto/GameSystemSummary.cs deleted file mode 100644 index e2400a744..000000000 --- a/MediaBrowser.Model/Dto/GameSystemSummary.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; - -namespace MediaBrowser.Model.Dto -{ - /// - /// Class GameSystemSummary - /// - public class GameSystemSummary - { - /// - /// Gets or sets the name. - /// - /// The name. - public string Name { get; set; } - - /// - /// Gets or sets the name. - /// - /// The name. - public string DisplayName { get; set; } - - /// - /// Gets or sets the game count. - /// - /// The game count. - public int GameCount { get; set; } - - /// - /// Gets or sets the game extensions. - /// - /// The game extensions. - public string[] GameFileExtensions { get; set; } - - /// - /// Gets or sets the client installed game count. - /// - /// The client installed game count. - public int ClientInstalledGameCount { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public GameSystemSummary() - { - GameFileExtensions = Array.Empty(); - } - } -} diff --git a/MediaBrowser.Model/Dto/ItemCounts.cs b/MediaBrowser.Model/Dto/ItemCounts.cs index da941d258..ec5adab85 100644 --- a/MediaBrowser.Model/Dto/ItemCounts.cs +++ b/MediaBrowser.Model/Dto/ItemCounts.cs @@ -20,19 +20,9 @@ namespace MediaBrowser.Model.Dto /// /// The episode count. public int EpisodeCount { get; set; } - /// - /// Gets or sets the game count. - /// - /// The game count. - public int GameCount { get; set; } public int ArtistCount { get; set; } public int ProgramCount { get; set; } /// - /// Gets or sets the game system count. - /// - /// The game system count. - public int GameSystemCount { get; set; } - /// /// Gets or sets the trailer count. /// /// The trailer count. diff --git a/MediaBrowser.Model/Entities/CollectionType.cs b/MediaBrowser.Model/Entities/CollectionType.cs index bda166118..e26d1b8c3 100644 --- a/MediaBrowser.Model/Entities/CollectionType.cs +++ b/MediaBrowser.Model/Entities/CollectionType.cs @@ -18,7 +18,6 @@ namespace MediaBrowser.Model.Entities public const string Books = "books"; public const string Photos = "photos"; - public const string Games = "games"; public const string LiveTv = "livetv"; public const string Playlists = "playlists"; public const string Folders = "folders"; diff --git a/MediaBrowser.Model/Entities/MediaType.cs b/MediaBrowser.Model/Entities/MediaType.cs index af233e61e..c56c8f8f2 100644 --- a/MediaBrowser.Model/Entities/MediaType.cs +++ b/MediaBrowser.Model/Entities/MediaType.cs @@ -14,10 +14,6 @@ namespace MediaBrowser.Model.Entities /// public const string Audio = "Audio"; /// - /// The game - /// - public const string Game = "Game"; - /// /// The photo /// public const string Photo = "Photo"; diff --git a/MediaBrowser.Model/Entities/MetadataProviders.cs b/MediaBrowser.Model/Entities/MetadataProviders.cs index 399961603..e9802cf46 100644 --- a/MediaBrowser.Model/Entities/MetadataProviders.cs +++ b/MediaBrowser.Model/Entities/MetadataProviders.cs @@ -5,7 +5,6 @@ namespace MediaBrowser.Model.Entities /// public enum MetadataProviders { - Gamesdb = 1, /// /// The imdb /// diff --git a/MediaBrowser.Model/Notifications/NotificationType.cs b/MediaBrowser.Model/Notifications/NotificationType.cs index 9d16e4a16..38b519a14 100644 --- a/MediaBrowser.Model/Notifications/NotificationType.cs +++ b/MediaBrowser.Model/Notifications/NotificationType.cs @@ -5,10 +5,8 @@ namespace MediaBrowser.Model.Notifications ApplicationUpdateAvailable, ApplicationUpdateInstalled, AudioPlayback, - GamePlayback, VideoPlayback, AudioPlaybackStopped, - GamePlaybackStopped, VideoPlaybackStopped, InstallationFailed, PluginError, diff --git a/MediaBrowser.Model/Providers/RemoteSearchResult.cs b/MediaBrowser.Model/Providers/RemoteSearchResult.cs index 88e3bc69c..6e46b1556 100644 --- a/MediaBrowser.Model/Providers/RemoteSearchResult.cs +++ b/MediaBrowser.Model/Providers/RemoteSearchResult.cs @@ -30,8 +30,6 @@ namespace MediaBrowser.Model.Providers public string ImageUrl { get; set; } public string SearchProviderName { get; set; } - - public string GameSystem { get; set; } public string Overview { get; set; } public RemoteSearchResult AlbumArtist { get; set; } diff --git a/MediaBrowser.Model/Querying/ItemSortBy.cs b/MediaBrowser.Model/Querying/ItemSortBy.cs index 1b20f43ac..6a71e3bb3 100644 --- a/MediaBrowser.Model/Querying/ItemSortBy.cs +++ b/MediaBrowser.Model/Querying/ItemSortBy.cs @@ -71,8 +71,6 @@ namespace MediaBrowser.Model.Querying public const string VideoBitRate = "VideoBitRate"; public const string AirTime = "AirTime"; public const string Studio = "Studio"; - public const string Players = "Players"; - public const string GameSystem = "GameSystem"; public const string IsFavoriteOrLiked = "IsFavoriteOrLiked"; public const string DateLastContentAdded = "DateLastContentAdded"; public const string SeriesDatePlayed = "SeriesDatePlayed"; diff --git a/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs b/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs deleted file mode 100644 index 2034848de..000000000 --- a/MediaBrowser.Providers/GameGenres/GameGenreMetadataService.cs +++ /dev/null @@ -1,23 +0,0 @@ -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Providers.Manager; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.Providers.GameGenres -{ - public class GameGenreMetadataService : MetadataService - { - protected override void MergeData(MetadataResult source, MetadataResult target, MetadataFields[] lockedFields, bool replaceData, bool mergeMetadataSettings) - { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); - } - - public GameGenreMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) - { - } - } -} diff --git a/MediaBrowser.Providers/Games/GameMetadataService.cs b/MediaBrowser.Providers/Games/GameMetadataService.cs deleted file mode 100644 index 764394a21..000000000 --- a/MediaBrowser.Providers/Games/GameMetadataService.cs +++ /dev/null @@ -1,36 +0,0 @@ -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Providers.Manager; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.Providers.Games -{ - public class GameMetadataService : MetadataService - { - protected override void MergeData(MetadataResult source, MetadataResult target, MetadataFields[] lockedFields, bool replaceData, bool mergeMetadataSettings) - { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); - - var sourceItem = source.Item; - var targetItem = target.Item; - - if (replaceData || string.IsNullOrEmpty(targetItem.GameSystem)) - { - targetItem.GameSystem = sourceItem.GameSystem; - } - - if (replaceData || !targetItem.PlayersSupported.HasValue) - { - targetItem.PlayersSupported = sourceItem.PlayersSupported; - } - } - - public GameMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) - { - } - } -} diff --git a/MediaBrowser.Providers/Games/GameSystemMetadataService.cs b/MediaBrowser.Providers/Games/GameSystemMetadataService.cs deleted file mode 100644 index 5bca4731c..000000000 --- a/MediaBrowser.Providers/Games/GameSystemMetadataService.cs +++ /dev/null @@ -1,31 +0,0 @@ -using MediaBrowser.Controller.Configuration; -using MediaBrowser.Controller.Entities; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.IO; -using MediaBrowser.Providers.Manager; -using Microsoft.Extensions.Logging; - -namespace MediaBrowser.Providers.Games -{ - public class GameSystemMetadataService : MetadataService - { - protected override void MergeData(MetadataResult source, MetadataResult target, MetadataFields[] lockedFields, bool replaceData, bool mergeMetadataSettings) - { - ProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings); - - var sourceItem = source.Item; - var targetItem = target.Item; - - if (replaceData || string.IsNullOrEmpty(targetItem.GameSystemName)) - { - targetItem.GameSystemName = sourceItem.GameSystemName; - } - } - - public GameSystemMetadataService(IServerConfigurationManager serverConfigurationManager, ILogger logger, IProviderManager providerManager, IFileSystem fileSystem, IUserDataManager userDataManager, ILibraryManager libraryManager) : base(serverConfigurationManager, logger, providerManager, fileSystem, userDataManager, libraryManager) - { - } - } -} diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index eda5163f0..f26087fda 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -471,8 +471,6 @@ namespace MediaBrowser.Providers.Manager { return new MetadataPluginSummary[] { - GetPluginSummary(), - GetPluginSummary(), GetPluginSummary(), GetPluginSummary(), GetPluginSummary(), diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 96b906b3c..9613c3559 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -82,7 +82,6 @@ namespace MediaBrowser.XbmcMetadata.Savers "lockedfields", "zap2itid", "tvrageid", - "gamesdbid", "musicbrainzartistid", "musicbrainzalbumartistid", @@ -737,13 +736,6 @@ namespace MediaBrowser.XbmcMetadata.Savers writtenProviderIds.Add(MetadataProviders.MusicBrainzReleaseGroup.ToString()); } - externalId = item.GetProviderId(MetadataProviders.Gamesdb); - if (!string.IsNullOrEmpty(externalId)) - { - writer.WriteElementString("gamesdbid", externalId); - writtenProviderIds.Add(MetadataProviders.Gamesdb.ToString()); - } - externalId = item.GetProviderId(MetadataProviders.TvRage); if (!string.IsNullOrEmpty(externalId)) { -- cgit v1.2.3 From 885a000da74f3837dad044dce93054d65130e070 Mon Sep 17 00:00:00 2001 From: minegociomovil Date: Sun, 27 Jan 2019 03:44:08 -0300 Subject: Update iso6392.txt Add new es-MX option for the latin metadata search in www.themoviedb.org Content add: spa||es-mx|Spanish; Latin|espagnol; Latin --- Emby.Server.Implementations/Localization/iso6392.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Server.Implementations/Localization/iso6392.txt b/Emby.Server.Implementations/Localization/iso6392.txt index f2cea78b6..40f8614f1 100644 --- a/Emby.Server.Implementations/Localization/iso6392.txt +++ b/Emby.Server.Implementations/Localization/iso6392.txt @@ -400,6 +400,7 @@ sog|||Sogdian|sogdien som||so|Somali|somali son|||Songhai languages|songhai, langues sot||st|Sotho, Southern|sotho du Sud +spa||es-mx|Spanish; Latin|espagnol; Latin spa||es|Spanish; Castilian|espagnol; castillan srd||sc|Sardinian|sarde srn|||Sranan Tongo|sranan tongo -- cgit v1.2.3 From cabb824f2a095115ebbe79ca7fdfbcbab4db1e5f Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Fri, 1 Feb 2019 18:11:46 +0100 Subject: Fix build error --- Emby.Server.Implementations/Localization/LocalizationManager.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 3a7052595..c3a7e1e9a 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.Localization { const string ratingsResource = "Emby.Server.Implementations.Ratings."; - Directory.CreateDirectory(localizationPath); + Directory.CreateDirectory(LocalizationPath); var existingFiles = GetRatingsFiles(LocalizationPath).Select(Path.GetFileName); @@ -269,8 +269,6 @@ namespace Emby.Server.Implementations.Localization } return GetRatings(countryCode) ?? GetRatings("us"); - - return ratings; } /// -- cgit v1.2.3 From ae5514afd62b8f0d4dd73bb9109961292f4dbd59 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Mon, 4 Feb 2019 18:46:36 +0100 Subject: Fix loading of rating files --- .../Emby.Server.Implementations.csproj | 2 +- .../Localization/LocalizationManager.cs | 38 ++++++++++++++-------- 2 files changed, 25 insertions(+), 15 deletions(-) (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 92e3172f1..af01001a5 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -43,7 +43,7 @@ - + diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 262ca24ec..8651a7dad 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -60,29 +60,35 @@ namespace Emby.Server.Implementations.Localization public async Task LoadAll() { - const string ratingsResource = "Emby.Server.Implementations.Ratings."; + const string ratingsResource = "Emby.Server.Implementations.Localization.Ratings."; Directory.CreateDirectory(LocalizationPath); var existingFiles = GetRatingsFiles(LocalizationPath).Select(Path.GetFileName); // Extract from the assembly - foreach (var resource in _assembly.GetManifestResourceNames() - .Where(i => i.StartsWith(ratingsResource))) + foreach (var resource in _assembly.GetManifestResourceNames()) { + if (!resource.StartsWith(ratingsResource)) + { + continue; + } + string filename = "ratings-" + resource.Substring(ratingsResource.Length); - if (!existingFiles.Contains(filename)) + if (existingFiles.Contains(filename)) { - using (var stream = _assembly.GetManifestResourceStream(resource)) - { - string target = Path.Combine(LocalizationPath, filename); - _logger.LogInformation("Extracting ratings to {0}", target); + continue; + } - using (var fs = _fileSystem.GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) - { - await stream.CopyToAsync(fs); - } + using (var stream = _assembly.GetManifestResourceStream(resource)) + { + string target = Path.Combine(LocalizationPath, filename); + _logger.LogInformation("Extracting ratings to {0}", target); + + using (var fs = _fileSystem.GetFileStream(target, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) + { + await stream.CopyToAsync(fs); } } } @@ -289,7 +295,8 @@ namespace Emby.Server.Implementations.Localization /// Dictionary{System.StringParentalRating}. private async Task LoadRatings(string file) { - Dictionary dict = new Dictionary(StringComparer.OrdinalIgnoreCase); + Dictionary dict + = new Dictionary(StringComparer.OrdinalIgnoreCase); using (var str = File.OpenRead(file)) using (var reader = new StreamReader(str)) @@ -309,7 +316,10 @@ namespace Emby.Server.Implementations.Localization dict.Add(parts[0], (new ParentalRating { Name = parts[0], Value = value })); } #if DEBUG - _logger.LogWarning("Misformed line in {Path}", file); + else + { + _logger.LogWarning("Misformed line in {Path}", file); + } #endif } } -- cgit v1.2.3 From c3c52b66822d94c92e0f66603e868ba8f98df4b0 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Fri, 8 Feb 2019 10:03:38 +0100 Subject: Default to en-US for missing core translations --- .../Localization/LocalizationManager.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 8651a7dad..7cf42a50a 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -460,11 +460,15 @@ namespace Emby.Server.Implementations.Localization { using (var stream = _assembly.GetManifestResourceStream(resourcePath)) { - var dict = await _jsonSerializer.DeserializeFromStreamAsync>(stream); - - foreach (var key in dict.Keys) + // If a Culture doesn't have a translation the stream will be null and it defaults to en-us further up the chain + if (stream != null) { - dictionary[key] = dict[key]; + var dict = await _jsonSerializer.DeserializeFromStreamAsync>(stream); + + foreach (var key in dict.Keys) + { + dictionary[key] = dict[key]; + } } } } -- cgit v1.2.3 From 49923e50db60be989ffd252b29301f2db3356494 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Fri, 8 Feb 2019 10:25:07 +0100 Subject: Remove missing languages from localization options --- .../Localization/LocalizationManager.cs | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 7cf42a50a..2120a8461 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -493,29 +493,23 @@ namespace Emby.Server.Implementations.Localization => new LocalizationOption[] { new LocalizationOption("Arabic", "ar"), - new LocalizationOption("Belarusian (Belarus)", "be-BY"), new LocalizationOption("Bulgarian (Bulgaria)", "bg-BG"), new LocalizationOption("Catalan", "ca"), new LocalizationOption("Chinese Simplified", "zh-CN"), new LocalizationOption("Chinese Traditional", "zh-TW"), - new LocalizationOption("Chinese Traditional (Hong Kong)", "zh-HK"), new LocalizationOption("Croatian", "hr"), new LocalizationOption("Czech", "cs"), new LocalizationOption("Danish", "da"), new LocalizationOption("Dutch", "nl"), new LocalizationOption("English (United Kingdom)", "en-GB"), new LocalizationOption("English (United States)", "en-US"), - new LocalizationOption("Finnish", "fi"), new LocalizationOption("French", "fr"), new LocalizationOption("French (Canada)", "fr-CA"), new LocalizationOption("German", "de"), new LocalizationOption("Greek", "el"), new LocalizationOption("Hebrew", "he"), - new LocalizationOption("Hindi (India)", "hi-IN"), new LocalizationOption("Hungarian", "hu"), - new LocalizationOption("Indonesian", "id"), new LocalizationOption("Italian", "it"), - new LocalizationOption("Japanese", "ja"), new LocalizationOption("Kazakh", "kk"), new LocalizationOption("Korean", "ko"), new LocalizationOption("Lithuanian", "lt-LT"), @@ -525,18 +519,15 @@ namespace Emby.Server.Implementations.Localization new LocalizationOption("Polish", "pl"), new LocalizationOption("Portuguese (Brazil)", "pt-BR"), new LocalizationOption("Portuguese (Portugal)", "pt-PT"), - new LocalizationOption("Romanian", "ro"), new LocalizationOption("Russian", "ru"), new LocalizationOption("Slovak", "sk"), new LocalizationOption("Slovenian (Slovenia)", "sl-SI"), new LocalizationOption("Spanish", "es"), - new LocalizationOption("Spanish (Latin America)", "es-419"), + new LocalizationOption("Spanish (Argentina)", "es-AR"), new LocalizationOption("Spanish (Mexico)", "es-MX"), new LocalizationOption("Swedish", "sv"), new LocalizationOption("Swiss German", "gsw"), - new LocalizationOption("Turkish", "tr"), - new LocalizationOption("Ukrainian", "uk"), - new LocalizationOption("Vietnamese", "vi") + new LocalizationOption("Turkish", "tr") }; } } -- cgit v1.2.3 From ce03662fa7149d7d5d607d102789994d5ee50d31 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Fri, 8 Feb 2019 10:26:29 +0100 Subject: Add error logging when translation is missing from core --- Emby.Server.Implementations/Localization/LocalizationManager.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Emby.Server.Implementations/Localization') diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 2120a8461..31217730b 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -470,6 +470,10 @@ namespace Emby.Server.Implementations.Localization dictionary[key] = dict[key]; } } + else + { + _logger.LogError("Missing translation/culture resource: {ResourcePath}", resourcePath); + } } } -- cgit v1.2.3