Merge pull request #6026 from Ullmie02/tv-parental-rating-fix

Use TMDb parental rating building from movies for shows
pull/6038/head
Bond-009 3 years ago committed by GitHub
commit c10f86960d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -206,12 +206,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
if (ourRelease != null)
{
var ratingPrefix = string.Equals(info.MetadataCountryCode, "us", StringComparison.OrdinalIgnoreCase) ? string.Empty : info.MetadataCountryCode + "-";
var newRating = ratingPrefix + ourRelease.Certification;
newRating = newRating.Replace("de-", "FSK-", StringComparison.OrdinalIgnoreCase);
movie.OfficialRating = newRating;
movie.OfficialRating = TmdbUtils.BuildParentalRating(ourRelease.Iso_3166_1, ourRelease.Certification);
}
else if (usRelease != null)
{

@ -300,7 +300,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.TV
if (ourRelease != null)
{
series.OfficialRating = ourRelease.Rating;
series.OfficialRating = TmdbUtils.BuildParentalRating(ourRelease.Iso_3166_1, ourRelease.Rating);
}
else if (usRelease != null)
{

@ -173,5 +173,20 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
return imageLanguage;
}
/// <summary>
/// Combines the metadata country code and the parental rating from the Api into the value we store in our database.
/// </summary>
/// <param name="countryCode">The Iso 3166-1 country code of the rating country.</param>
/// <param name="ratingValue">The rating value returned by the Tmdb Api.</param>
/// <returns>The combined parental rating of country code+rating value.</returns>
public static string BuildParentalRating(string countryCode, string ratingValue)
{
// exclude US because we store us values as TV-14 without the country code.
var ratingPrefix = string.Equals(countryCode, "US", StringComparison.OrdinalIgnoreCase) ? string.Empty : countryCode + "-";
var newRating = ratingPrefix + ratingValue;
return newRating.Replace("DE-", "FSK-", StringComparison.OrdinalIgnoreCase);
}
}
}

Loading…
Cancel
Save