diff options
| author | theguymadmax <theguymadmax@proton.me> | 2026-07-04 17:53:55 -0400 |
|---|---|---|
| committer | theguymadmax <theguymadmax@proton.me> | 2026-07-04 17:53:55 -0400 |
| commit | 2528bc10326e4b842899b55ae2d023414f5fc53f (patch) | |
| tree | f2a0c50e5d022041fe57d741f92967511b96cac1 /Emby.Server.Implementations | |
| parent | 4b5f5d6ca3e5b2fe4638cf18a107f39b49cc940d (diff) | |
Fix parental rating lookup for multi-rating entries
Diffstat (limited to 'Emby.Server.Implementations')
| -rw-r--r-- | Emby.Server.Implementations/Localization/LocalizationManager.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 6971431155..98f629d31c 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -356,6 +356,27 @@ namespace Emby.Server.Implementations.Localization { ArgumentException.ThrowIfNullOrEmpty(rating); + // Some providers may list multiple ratings separated by '/' (e.g. "SE:15 / SE:15+ / SE:Från 15 år"). + // Try each one in order and use the first that resolves. + var ratingValues = rating.Split('/', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + + foreach (var ratingValue in ratingValues) + { + var score = GetSingleRatingScore(ratingValue, countryCode); + if (score is not null) + { + return score; + } + } + + return null; + } + + /// <summary> + /// Resolves a single rating value to a score. + /// </summary> + private ParentalRatingScore? GetSingleRatingScore(string rating, string? countryCode) + { // Handle unrated content if (_unratedValues.Contains(rating.AsSpan(), StringComparison.OrdinalIgnoreCase)) { |
