Rework parental ratings (#12615)

This commit is contained in:
Tim Eisele
2025-03-31 05:51:54 +02:00
committed by GitHub
parent 2ace880345
commit 3fc3b04daf
80 changed files with 3995 additions and 805 deletions
@@ -232,9 +232,9 @@ namespace MediaBrowser.Controller.Entities
public int? IndexNumber { get; set; }
public int? MinParentalRating { get; set; }
public ParentalRatingScore? MinParentalRating { get; set; }
public int? MaxParentalRating { get; set; }
public ParentalRatingScore? MaxParentalRating { get; set; }
public bool? HasDeadParentId { get; set; }
@@ -360,16 +360,17 @@ namespace MediaBrowser.Controller.Entities
public void SetUser(User user)
{
MaxParentalRating = user.MaxParentalAgeRating;
if (MaxParentalRating.HasValue)
var maxRating = user.MaxParentalRatingScore;
if (maxRating.HasValue)
{
string other = UnratedItem.Other.ToString();
BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
.Where(i => i != other)
.Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
MaxParentalRating = new(maxRating.Value, user.MaxParentalRatingSubScore);
}
var other = UnratedItem.Other.ToString();
BlockUnratedItems = user.GetPreference(PreferenceKind.BlockUnratedItems)
.Where(i => i != other)
.Select(e => Enum.Parse<UnratedItem>(e, true)).ToArray();
ExcludeInheritedTags = user.GetPreference(PreferenceKind.BlockedTags);
IncludeInheritedTags = user.GetPreference(PreferenceKind.AllowedTags);