Support age in LocalizationManager.GetRatingLevel (#11367)

This commit is contained in:
Niels van Velzen
2024-04-17 18:44:30 +02:00
committed by GitHub
parent 80fac82c2c
commit 82e5f99f83
2 changed files with 23 additions and 0 deletions

View File

@@ -278,6 +278,13 @@ namespace Emby.Server.Implementations.Localization
return null;
}
// Convert integers directly
// This may override some of the locale specific age ratings (but those always map to the same age)
if (int.TryParse(rating, out var ratingAge))
{
return ratingAge;
}
// Fairly common for some users to have "Rated R" in their rating field
rating = rating.Replace("Rated :", string.Empty, StringComparison.OrdinalIgnoreCase);
rating = rating.Replace("Rated ", string.Empty, StringComparison.OrdinalIgnoreCase);