Rework parental ratings (#12615)
Some checks are pending
CodeQL / Analyze (csharp) (push) Waiting to run
OpenAPI / OpenAPI - HEAD (push) Waiting to run
OpenAPI / OpenAPI - BASE (push) Waiting to run
OpenAPI / OpenAPI - Difference (push) Blocked by required conditions
OpenAPI / OpenAPI - Publish Unstable Spec (push) Blocked by required conditions
OpenAPI / OpenAPI - Publish Stable Spec (push) Blocked by required conditions
Tests / run-tests (macos-latest) (push) Waiting to run
Tests / run-tests (ubuntu-latest) (push) Waiting to run
Tests / run-tests (windows-latest) (push) Waiting to run
Project Automation / Project board (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run

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

View File

@@ -68,6 +68,6 @@
<EmbeddedResource Include="Localization\iso6392.txt" />
<EmbeddedResource Include="Localization\countries.json" />
<EmbeddedResource Include="Localization\Core\*.json" />
<EmbeddedResource Include="Localization\Ratings\*.csv" />
<EmbeddedResource Include="Localization\Ratings\*.json" />
</ItemGroup>
</Project>

View File

@@ -11,7 +11,6 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library;
@@ -78,15 +77,15 @@ public class SplashscreenPostScanTask : ILibraryPostScanTask
CollapseBoxSetItems = false,
Recursive = true,
DtoOptions = new DtoOptions(false),
ImageTypes = new[] { imageType },
ImageTypes = [imageType],
Limit = 30,
// TODO max parental rating configurable
MaxParentalRating = 10,
OrderBy = new[]
{
MaxParentalRating = new(10, null),
OrderBy =
[
(ItemSortBy.Random, SortOrder.Ascending)
},
IncludeItemTypes = new[] { BaseItemKind.Movie, BaseItemKind.Series }
],
IncludeItemTypes = [BaseItemKind.Movie, BaseItemKind.Series]
});
}
}

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
@@ -26,20 +25,18 @@ namespace Emby.Server.Implementations.Localization
private const string CulturesPath = "Emby.Server.Implementations.Localization.iso6392.txt";
private const string CountriesPath = "Emby.Server.Implementations.Localization.countries.json";
private static readonly Assembly _assembly = typeof(LocalizationManager).Assembly;
private static readonly string[] _unratedValues = { "n/a", "unrated", "not rated", "nr" };
private static readonly string[] _unratedValues = ["n/a", "unrated", "not rated", "nr"];
private readonly IServerConfigurationManager _configurationManager;
private readonly ILogger<LocalizationManager> _logger;
private readonly Dictionary<string, Dictionary<string, ParentalRating>> _allParentalRatings =
new Dictionary<string, Dictionary<string, ParentalRating>>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, Dictionary<string, ParentalRatingScore?>> _allParentalRatings = new(StringComparer.OrdinalIgnoreCase);
private readonly ConcurrentDictionary<string, Dictionary<string, string>> _dictionaries =
new ConcurrentDictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase);
private readonly ConcurrentDictionary<string, Dictionary<string, string>> _dictionaries = new(StringComparer.OrdinalIgnoreCase);
private readonly JsonSerializerOptions _jsonOptions = JsonDefaults.Options;
private List<CultureDto> _cultures = new List<CultureDto>();
private List<CultureDto> _cultures = [];
/// <summary>
/// Initializes a new instance of the <see cref="LocalizationManager" /> class.
@@ -68,35 +65,26 @@ namespace Emby.Server.Implementations.Localization
continue;
}
string countryCode = resource.Substring(RatingsPath.Length, 2);
var dict = new Dictionary<string, ParentalRating>(StringComparer.OrdinalIgnoreCase);
var stream = _assembly.GetManifestResourceStream(resource);
await using (stream!.ConfigureAwait(false)) // shouldn't be null here, we just got the resource path from Assembly.GetManifestResourceNames()
using var stream = _assembly.GetManifestResourceStream(resource);
if (stream is not null)
{
using var reader = new StreamReader(stream!);
await foreach (var line in reader.ReadAllLinesAsync().ConfigureAwait(false))
var ratingSystem = await JsonSerializer.DeserializeAsync<ParentalRatingSystem>(stream, _jsonOptions).ConfigureAwait(false)
?? throw new InvalidOperationException($"Invalid resource path: '{CountriesPath}'");
var dict = new Dictionary<string, ParentalRatingScore?>();
if (ratingSystem.Ratings is not null)
{
if (string.IsNullOrWhiteSpace(line))
foreach (var ratingEntry in ratingSystem.Ratings)
{
continue;
foreach (var ratingString in ratingEntry.RatingStrings)
{
dict[ratingString] = ratingEntry.RatingScore;
}
}
string[] parts = line.Split(',');
if (parts.Length == 2
&& int.TryParse(parts[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var value))
{
var name = parts[0];
dict.Add(name, new ParentalRating(name, value));
}
else
{
_logger.LogWarning("Malformed line in ratings file for country {CountryCode}", countryCode);
}
_allParentalRatings[ratingSystem.CountryCode] = dict;
}
}
_allParentalRatings[countryCode] = dict;
}
await LoadCultures().ConfigureAwait(false);
@@ -111,22 +99,29 @@ namespace Emby.Server.Implementations.Localization
private async Task LoadCultures()
{
List<CultureDto> list = new List<CultureDto>();
List<CultureDto> list = [];
await using var stream = _assembly.GetManifestResourceStream(CulturesPath)
?? throw new InvalidOperationException($"Invalid resource path: '{CulturesPath}'");
using var reader = new StreamReader(stream);
await foreach (var line in reader.ReadAllLinesAsync().ConfigureAwait(false))
using var stream = _assembly.GetManifestResourceStream(CulturesPath);
if (stream is null)
{
if (string.IsNullOrWhiteSpace(line))
throw new InvalidOperationException($"Invalid resource path: '{CulturesPath}'");
}
else
{
using var reader = new StreamReader(stream);
await foreach (var line in reader.ReadAllLinesAsync().ConfigureAwait(false))
{
continue;
}
if (string.IsNullOrWhiteSpace(line))
{
continue;
}
var parts = line.Split('|');
var parts = line.Split('|');
if (parts.Length != 5)
{
throw new InvalidDataException($"Invalid culture data found at: '{line}'");
}
if (parts.Length == 5)
{
string name = parts[3];
if (string.IsNullOrWhiteSpace(name))
{
@@ -139,21 +134,21 @@ namespace Emby.Server.Implementations.Localization
continue;
}
string[] threeletterNames;
string[] threeLetterNames;
if (string.IsNullOrWhiteSpace(parts[1]))
{
threeletterNames = new[] { parts[0] };
threeLetterNames = [parts[0]];
}
else
{
threeletterNames = new[] { parts[0], parts[1] };
threeLetterNames = [parts[0], parts[1]];
}
list.Add(new CultureDto(name, name, twoCharName, threeletterNames));
list.Add(new CultureDto(name, name, twoCharName, threeLetterNames));
}
}
_cultures = list;
_cultures = list;
}
}
/// <inheritdoc />
@@ -176,82 +171,80 @@ namespace Emby.Server.Implementations.Localization
}
/// <inheritdoc />
public IEnumerable<CountryInfo> GetCountries()
public IReadOnlyList<CountryInfo> GetCountries()
{
using StreamReader reader = new StreamReader(
_assembly.GetManifestResourceStream(CountriesPath) ?? throw new InvalidOperationException($"Invalid resource path: '{CountriesPath}'"));
return JsonSerializer.Deserialize<IEnumerable<CountryInfo>>(reader.ReadToEnd(), _jsonOptions)
?? throw new InvalidOperationException($"Resource contains invalid data: '{CountriesPath}'");
using var stream = _assembly.GetManifestResourceStream(CountriesPath) ?? throw new InvalidOperationException($"Invalid resource path: '{CountriesPath}'");
return JsonSerializer.Deserialize<IReadOnlyList<CountryInfo>>(stream, _jsonOptions) ?? [];
}
/// <inheritdoc />
public IEnumerable<ParentalRating> GetParentalRatings()
public IReadOnlyList<ParentalRating> GetParentalRatings()
{
// Use server default language for ratings
// Fall back to empty list if there are no parental ratings for that language
var ratings = GetParentalRatingsDictionary()?.Values.ToList()
?? new List<ParentalRating>();
var ratings = GetParentalRatingsDictionary()?.Select(x => new ParentalRating(x.Key, x.Value)).ToList() ?? [];
// Add common ratings to ensure them being available for selection
// Based on the US rating system due to it being the main source of rating in the metadata providers
// Unrated
if (!ratings.Any(x => x.Value is null))
if (!ratings.Any(x => x is null))
{
ratings.Add(new ParentalRating("Unrated", null));
ratings.Add(new("Unrated", null));
}
// Minimum rating possible
if (ratings.All(x => x.Value != 0))
if (ratings.All(x => x.RatingScore?.Score != 0))
{
ratings.Add(new ParentalRating("Approved", 0));
ratings.Add(new("Approved", new(0, null)));
}
// Matches PG (this has different age restrictions depending on country)
if (ratings.All(x => x.Value != 10))
if (ratings.All(x => x.RatingScore?.Score != 10))
{
ratings.Add(new ParentalRating("10", 10));
ratings.Add(new("10", new(10, null)));
}
// Matches PG-13
if (ratings.All(x => x.Value != 13))
if (ratings.All(x => x.RatingScore?.Score != 13))
{
ratings.Add(new ParentalRating("13", 13));
ratings.Add(new("13", new(13, null)));
}
// Matches TV-14
if (ratings.All(x => x.Value != 14))
if (ratings.All(x => x.RatingScore?.Score != 14))
{
ratings.Add(new ParentalRating("14", 14));
ratings.Add(new("14", new(14, null)));
}
// Catchall if max rating of country is less than 21
// Using 21 instead of 18 to be sure to allow access to all rated content except adult and banned
if (!ratings.Any(x => x.Value >= 21))
if (!ratings.Any(x => x.RatingScore?.Score >= 21))
{
ratings.Add(new ParentalRating("21", 21));
ratings.Add(new ParentalRating("21", new(21, null)));
}
// A lot of countries don't explicitly have a separate rating for adult content
if (ratings.All(x => x.Value != 1000))
if (ratings.All(x => x.RatingScore?.Score != 1000))
{
ratings.Add(new ParentalRating("XXX", 1000));
ratings.Add(new ParentalRating("XXX", new(1000, null)));
}
// A lot of countries don't explicitly have a separate rating for banned content
if (ratings.All(x => x.Value != 1001))
if (ratings.All(x => x.RatingScore?.Score != 1001))
{
ratings.Add(new ParentalRating("Banned", 1001));
ratings.Add(new ParentalRating("Banned", new(1001, null)));
}
return ratings.OrderBy(r => r.Value);
return [.. ratings.OrderBy(r => r.RatingScore?.Score).ThenBy(r => r.RatingScore?.SubScore)];
}
/// <summary>
/// Gets the parental ratings dictionary.
/// </summary>
/// <param name="countryCode">The optional two letter ISO language string.</param>
/// <returns><see cref="Dictionary{String, ParentalRating}" />.</returns>
private Dictionary<string, ParentalRating>? GetParentalRatingsDictionary(string? countryCode = null)
/// <returns><see cref="Dictionary{String, ParentalRatingScore}" />.</returns>
private Dictionary<string, ParentalRatingScore?>? GetParentalRatingsDictionary(string? countryCode = null)
{
// Fallback to server default if no country code is specified.
if (string.IsNullOrEmpty(countryCode))
@@ -268,7 +261,7 @@ namespace Emby.Server.Implementations.Localization
}
/// <inheritdoc />
public int? GetRatingLevel(string rating, string? countryCode = null)
public ParentalRatingScore? GetRatingScore(string rating, string? countryCode = null)
{
ArgumentException.ThrowIfNullOrEmpty(rating);
@@ -278,11 +271,11 @@ namespace Emby.Server.Implementations.Localization
return null;
}
// Convert integers directly
// Convert ints 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;
return new(ratingAge, null);
}
// Fairly common for some users to have "Rated R" in their rating field
@@ -295,9 +288,9 @@ namespace Emby.Server.Implementations.Localization
if (!string.IsNullOrEmpty(countryCode))
{
var ratingsDictionary = GetParentalRatingsDictionary(countryCode);
if (ratingsDictionary is not null && ratingsDictionary.TryGetValue(rating, out ParentalRating? value))
if (ratingsDictionary is not null && ratingsDictionary.TryGetValue(rating, out ParentalRatingScore? value))
{
return value.Value;
return value;
}
}
else
@@ -305,9 +298,9 @@ namespace Emby.Server.Implementations.Localization
// Fall back to server default language for ratings check
// If it has no ratings, use the US ratings
var ratingsDictionary = GetParentalRatingsDictionary() ?? GetParentalRatingsDictionary("us");
if (ratingsDictionary is not null && ratingsDictionary.TryGetValue(rating, out ParentalRating? value))
if (ratingsDictionary is not null && ratingsDictionary.TryGetValue(rating, out ParentalRatingScore? value))
{
return value.Value;
return value;
}
}
@@ -316,7 +309,7 @@ namespace Emby.Server.Implementations.Localization
{
if (dictionary.TryGetValue(rating, out var value))
{
return value.Value;
return value;
}
}
@@ -326,7 +319,7 @@ namespace Emby.Server.Implementations.Localization
var ratingLevelRightPart = rating.AsSpan().RightPart(':');
if (ratingLevelRightPart.Length != 0)
{
return GetRatingLevel(ratingLevelRightPart.ToString());
return GetRatingScore(ratingLevelRightPart.ToString());
}
}
@@ -342,7 +335,7 @@ namespace Emby.Server.Implementations.Localization
if (ratingLevelRightPart.Length != 0)
{
// Check rating system of culture
return GetRatingLevel(ratingLevelRightPart.ToString(), culture?.TwoLetterISOLanguageName);
return GetRatingScore(ratingLevelRightPart.ToString(), culture?.TwoLetterISOLanguageName);
}
}
@@ -406,7 +399,7 @@ namespace Emby.Server.Implementations.Localization
private async Task CopyInto(IDictionary<string, string> dictionary, string resourcePath)
{
await using var stream = _assembly.GetManifestResourceStream(resourcePath);
using var stream = _assembly.GetManifestResourceStream(resourcePath);
// 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 is null)
{
@@ -414,12 +407,7 @@ namespace Emby.Server.Implementations.Localization
return;
}
var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(stream, _jsonOptions).ConfigureAwait(false);
if (dict is null)
{
throw new InvalidOperationException($"Resource contains invalid data: '{stream}'");
}
var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(stream, _jsonOptions).ConfigureAwait(false) ?? throw new InvalidOperationException($"Resource contains invalid data: '{stream}'");
foreach (var key in dict.Keys)
{
dictionary[key] = dict[key];

View File

@@ -1,11 +0,0 @@
E,0
EC,0
T,7
M,18
AO,18
UR,18
RP,18
X,1000
XX,1000
XXX,1000
XXXX,1000
1 E 0
2 EC 0
3 T 7
4 M 18
5 AO 18
6 UR 18
7 RP 18
8 X 1000
9 XX 1000
10 XXX 1000
11 XXXX 1000

View File

@@ -0,0 +1,34 @@
{
"countryCode": "0-prefer",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["E", "EC"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["T"],
"ratingScore": {
"score": 7,
"subScore": null
}
},
{
"ratingStrings": ["M", "AO", "UR", "RP"],
"ratingScore": {
"score": 18,
"subScore": null
}
},
{
"ratingStrings": ["X", "XX", "XXX", "XXXX"],
"ratingScore": {
"score": 1000,
"subScore": null
}
}
]
}

View File

@@ -1,17 +0,0 @@
Exempt,0
G,0
7+,7
PG,15
M,15
MA,15
MA15+,15
MA 15+,15
16+,16
R,18
R18+,18
R 18+,18
18+,18
X18+,1000
X 18+,1000
X,1000
RC,1001
1 Exempt 0
2 G 0
3 7+ 7
4 PG 15
5 M 15
6 MA 15
7 MA15+ 15
8 MA 15+ 15
9 16+ 16
10 R 18
11 R18+ 18
12 R 18+ 18
13 18+ 18
14 X18+ 1000
15 X 18+ 1000
16 X 1000
17 RC 1001

View File

@@ -0,0 +1,69 @@
{
"countryCode": "au",
"supportsSubScores": true,
"ratings": [
{
"ratingStrings": ["Exempt", "G"],
"ratingScore": {
"score": 0,
"subScore": 0
}
},
{
"ratingStrings": ["7+"],
"ratingScore": {
"score": 7,
"subScore": 0
}
},
{
"ratingStrings": ["PG"],
"ratingScore": {
"score": 15,
"subScore": 1
}
},
{
"ratingStrings": ["M"],
"ratingScore": {
"score": 15,
"subScore": 2
}
},
{
"ratingStrings": ["MA", "MA 15+", "MA15+"],
"ratingScore": {
"score": 15,
"subScore": 3
}
},
{
"ratingStrings": ["16+"],
"ratingScore": {
"score": 16,
"subScore": 0
}
},
{
"ratingStrings": ["18+", "R", "R18+", "R 18+"],
"ratingScore": {
"score": 18,
"subScore": 1
}
},
{
"ratingStrings": ["X", "X18", "X 18"],
"ratingScore": {
"score": 1000,
"subScore": 0
}
},
{
"ratingStrings": ["RC"],
"ratingScore": {
"score": 1001,
"subScore": 0
}
}
]
}

View File

@@ -1,11 +0,0 @@
AL,0
KT,0
TOUS,0
MG6,6
6,6
9,9
KNT,12
12,12
14,14
16,16
18,18
1 AL 0
2 KT 0
3 TOUS 0
4 MG6 6
5 6 6
6 9 9
7 KNT 12
8 12 12
9 14 14
10 16 16
11 18 18

View File

@@ -0,0 +1,55 @@
{
"countryCode": "be",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["AL", "KT", "TOUS"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["6", "MG6"],
"ratingScore": {
"score": 6,
"subScore": null
}
},
{
"ratingStrings": ["9"],
"ratingScore": {
"score": 9,
"subScore": null
}
},
{
"ratingStrings": ["12", "KNT"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["14"],
"ratingScore": {
"score": 14,
"subScore": null
}
},
{
"ratingStrings": ["16"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["18"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,14 +0,0 @@
Livre,0
L,0
AL,0
ER,10
10,10
A10,10
12,12
A12,12
14,14
A14,14
16,16
A16,16
18,18
A18,18
1 Livre 0
2 L 0
3 AL 0
4 ER 10
5 10 10
6 A10 10
7 12 12
8 A12 12
9 14 14
10 A14 14
11 16 16
12 A16 16
13 18 18
14 A18 18

View File

@@ -0,0 +1,55 @@
{
"countryCode": "br",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["L", "AL", "Livre"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["9"],
"ratingScore": {
"score": 9,
"subScore": null
}
},
{
"ratingStrings": ["10", "A10", "ER"],
"ratingScore": {
"score": 10,
"subScore": null
}
},
{
"ratingStrings": ["12", "A12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["14", "A14"],
"ratingScore": {
"score": 14,
"subScore": null
}
},
{
"ratingStrings": ["16", "A16"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["18", "A18"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,18 +0,0 @@
E,0
G,0
TV-Y,0
TV-G,0
TV-Y7,7
TV-Y7-FV,7
PG,9
TV-PG,9
TV-14,14
14A,14
16+,16
NC-17,17
R,18
TV-MA,18
18A,18
18+,18
A,1000
Prohibited,1001
1 E 0
2 G 0
3 TV-Y 0
4 TV-G 0
5 TV-Y7 7
6 TV-Y7-FV 7
7 PG 9
8 TV-PG 9
9 TV-14 14
10 14A 14
11 16+ 16
12 NC-17 17
13 R 18
14 TV-MA 18
15 18A 18
16 18+ 18
17 A 1000
18 Prohibited 1001

View File

@@ -0,0 +1,90 @@
{
"countryCode": "ca",
"supportsSubScores": true,
"ratings": [
{
"ratingStrings": ["E", "G", "TV-Y", "TV-G"],
"ratingScore": {
"score": 0,
"subScore": 0
}
},
{
"ratingStrings": ["TV-Y7"],
"ratingScore": {
"score": 7,
"subScore": 0
}
},
{
"ratingStrings": ["TV-Y7-FV"],
"ratingScore": {
"score": 7,
"subScore": 1
}
},
{
"ratingStrings": ["PG", "TV-PG"],
"ratingScore": {
"score": 9,
"subScore": 0
}
},
{
"ratingStrings": ["14A"],
"ratingScore": {
"score": 14,
"subScore": 0
}
},
{
"ratingStrings": ["TV-14"],
"ratingScore": {
"score": 14,
"subScore": 1
}
},
{
"ratingStrings": ["16+"],
"ratingScore": {
"score": 16,
"subScore": 0
}
},
{
"ratingStrings": ["NC-17"],
"ratingScore": {
"score": 17,
"subScore": 0
}
},
{
"ratingStrings": ["18A"],
"ratingScore": {
"score": 18,
"subScore": 0
}
},
{
"ratingStrings": ["18+", "TV-MA", "R"],
"ratingScore": {
"score": 18,
"subScore": 1
}
},
{
"ratingStrings": ["A"],
"ratingScore": {
"score": 1000,
"subScore": 0
}
},
{
"ratingStrings": ["Prohibited"],
"ratingScore": {
"score": 1001,
"subScore": 0
}
}
]
}

View File

@@ -0,0 +1,41 @@
{
"countryCode": "cl",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["TE"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["6"],
"ratingScore": {
"score": 6,
"subScore": null
}
},
{
"ratingStrings": ["TE+7"],
"ratingScore": {
"score": 7,
"subScore": null
}
},
{
"ratingStrings": ["14"],
"ratingScore": {
"score": 14,
"subScore": null
}
},
{
"ratingStrings": ["18", "18V", "18S"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,7 +0,0 @@
T,0
7,7
12,12
15,15
18,18
X,1000
Prohibited,1001
1 T 0
2 7 7
3 12 12
4 15 15
5 18 18
6 X 1000
7 Prohibited 1001

View File

@@ -0,0 +1,55 @@
{
"countryCode": "co",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["T"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["7"],
"ratingScore": {
"score": 7,
"subScore": null
}
},
{
"ratingStrings": ["12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["15"],
"ratingScore": {
"score": 15,
"subScore": null
}
},
{
"ratingStrings": ["18"],
"ratingScore": {
"score": 18,
"subScore": null
}
},
{
"ratingStrings": ["X"],
"ratingScore": {
"score": 1000,
"subScore": null
}
},
{
"ratingStrings": ["Prohibited"],
"ratingScore": {
"score": 1001,
"subScore": null
}
}
]
}

View File

@@ -1,17 +0,0 @@
Educational,0
Infoprogramm,0
FSK-0,0
FSK 0,0
0,0
FSK-6,6
FSK 6,6
6,6
FSK-12,12
FSK 12,12
12,12
FSK-16,16
FSK 16,16
16,16
FSK-18,18
FSK 18,18
18,18
1 Educational 0
2 Infoprogramm 0
3 FSK-0 0
4 FSK 0 0
5 0 0
6 FSK-6 6
7 FSK 6 6
8 6 6
9 FSK-12 12
10 FSK 12 12
11 12 12
12 FSK-16 16
13 FSK 16 16
14 16 16
15 FSK-18 18
16 FSK 18 18
17 18 18

View File

@@ -0,0 +1,41 @@
{
"countryCode": "de",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["0", "FSK 0", "FSK-0", "Educational", "Infoprogramm"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["6", "FSK 6", "FSK-6"],
"ratingScore": {
"score": 6,
"subScore": null
}
},
{
"ratingStrings": ["12", "FSK 12", "FSK-12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["16", "FSK 16", "FSK-16"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["18", "FSK 18", "FSK-18"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,7 +0,0 @@
F,0
A,0
7,7
11,11
12,12
15,15
16,16
1 F 0
2 A 0
3 7 7
4 11 11
5 12 12
6 15 15
7 16 16

View File

@@ -0,0 +1,48 @@
{
"countryCode": "dk",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["F", "A"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["7"],
"ratingScore": {
"score": 7,
"subScore": null
}
},
{
"ratingStrings": ["11"],
"ratingScore": {
"score": 11,
"subScore": null
}
},
{
"ratingStrings": ["12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["15"],
"ratingScore": {
"score": 15,
"subScore": null
}
},
{
"ratingStrings": ["16"],
"ratingScore": {
"score": 16,
"subScore": null
}
}
]
}

View File

@@ -1,25 +0,0 @@
A,0
A/fig,0
A/i,0
A/i/fig,0
APTA,0
ERI,0
TP,0
0+,0
6+,6
7/fig,7
7/i,7
7/i/fig,7
7,7
9+,9
10,10
12,12
12/fig,12
13,13
14,14
16,16
16/fig,16
18,18
18/fig,18
X,1000
Banned,1001
1 A 0
2 A/fig 0
3 A/i 0
4 A/i/fig 0
5 APTA 0
6 ERI 0
7 TP 0
8 0+ 0
9 6+ 6
10 7/fig 7
11 7/i 7
12 7/i/fig 7
13 7 7
14 9+ 9
15 10 10
16 12 12
17 12/fig 12
18 13 13
19 14 14
20 16 16
21 16/fig 16
22 18 18
23 18/fig 18
24 X 1000
25 Banned 1001

View File

@@ -0,0 +1,90 @@
{
"countryCode": "es",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["0+", "A", "A/i", "A/fig", "A/i/fig", "APTA", "ERI", "TP"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["6+"],
"ratingScore": {
"score": 6,
"subScore": null
}
},
{
"ratingStrings": ["7", "7/i", "7/fig", "7/i/fig"],
"ratingScore": {
"score": 11,
"subScore": null
}
},
{
"ratingStrings": ["9+"],
"ratingScore": {
"score": 9,
"subScore": null
}
},
{
"ratingStrings": ["10"],
"ratingScore": {
"score": 10,
"subScore": null
}
},
{
"ratingStrings": ["12", "12/fig"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["13"],
"ratingScore": {
"score": 13,
"subScore": null
}
},
{
"ratingStrings": ["14"],
"ratingScore": {
"score": 14,
"subScore": null
}
},
{
"ratingStrings": ["16", "16/fig"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["18", "18/fig"],
"ratingScore": {
"score": 18,
"subScore": null
}
},
{
"ratingStrings": ["X"],
"ratingScore": {
"score": 1000,
"subScore": null
}
},
{
"ratingStrings": ["Banned"],
"ratingScore": {
"score": 1001,
"subScore": null
}
}
]
}

View File

@@ -1,10 +0,0 @@
S,0
T,0
K7,7
7,7
K12,12
12,12
K16,16
16,16
K18,18
18,18
1 S 0
2 T 0
3 K7 7
4 7 7
5 K12 12
6 12 12
7 K16 16
8 16 16
9 K18 18
10 18 18

View File

@@ -0,0 +1,41 @@
{
"countryCode": "fi",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["S", "T"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["7", "K7"],
"ratingScore": {
"score": 7,
"subScore": null
}
},
{
"ratingStrings": ["12", "K12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["16", "K16"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["18", "K18"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,13 +0,0 @@
Public Averti,0
Tous Publics,0
TP,0
U,0
0+,0
6+,6
9+,9
10,10
12,12
14+,14
16,16
18,18
X,1000
1 Public Averti 0
2 Tous Publics 0
3 TP 0
4 U 0
5 0+ 0
6 6+ 6
7 9+ 9
8 10 10
9 12 12
10 14+ 14
11 16 16
12 18 18
13 X 1000

View File

@@ -0,0 +1,69 @@
{
"countryCode": "fr",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["0+", "Public Averti", "Tous Publics", "TP", "U"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["6+"],
"ratingScore": {
"score": 6,
"subScore": null
}
},
{
"ratingStrings": ["9+"],
"ratingScore": {
"score": 9,
"subScore": null
}
},
{
"ratingStrings": ["10"],
"ratingScore": {
"score": 10,
"subScore": null
}
},
{
"ratingStrings": ["12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["14+"],
"ratingScore": {
"score": 14,
"subScore": null
}
},
{
"ratingStrings": ["16"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["18"],
"ratingScore": {
"score": 18,
"subScore": null
}
},
{
"ratingStrings": ["X"],
"ratingScore": {
"score": 1000,
"subScore": null
}
}
]
}

View File

@@ -1,23 +0,0 @@
All,0
E,0
G,0
U,0
0+,0
6+,6
7+,7
PG,8
9,9
12,12
12+,12
12A,12
12PG,12
Teen,13
13+,13
14+,14
15,15
16,16
Caution,18
18,18
Mature,1000
Adult,1000
R18,1000
1 All 0
2 E 0
3 G 0
4 U 0
5 0+ 0
6 6+ 6
7 7+ 7
8 PG 8
9 9 9
10 12 12
11 12+ 12
12 12A 12
13 12PG 12
14 Teen 13
15 13+ 13
16 14+ 14
17 15 15
18 16 16
19 Caution 18
20 18 18
21 Mature 1000
22 Adult 1000
23 R18 1000

View File

@@ -0,0 +1,97 @@
{
"countryCode": "gb",
"supportsSubScores": true,
"ratings": [
{
"ratingStrings": ["0+", "All", "E", "G", "U"],
"ratingScore": {
"score": 0,
"subScore": 0
}
},
{
"ratingStrings": ["6+"],
"ratingScore": {
"score": 6,
"subScore": 0
}
},
{
"ratingStrings": ["7+"],
"ratingScore": {
"score": 7,
"subScore": 0
}
},
{
"ratingStrings": ["PG"],
"ratingScore": {
"score": 8,
"subScore": 0
}
},
{
"ratingStrings": ["9"],
"ratingScore": {
"score": 9,
"subScore": 0
}
},
{
"ratingStrings": ["12A", "12PG"],
"ratingScore": {
"score": 12,
"subScore": 0
}
},
{
"ratingStrings": ["12", "12+"],
"ratingScore": {
"score": 12,
"subScore": 1
}
},
{
"ratingStrings": ["13+", "Teen"],
"ratingScore": {
"score": 13,
"subScore": 0
}
},
{
"ratingStrings": ["14+"],
"ratingScore": {
"score": 14,
"subScore": 0
}
},
{
"ratingStrings": ["15"],
"ratingScore": {
"score": 15,
"subScore": 3
}
},
{
"ratingStrings": ["16"],
"ratingScore": {
"score": 16,
"subScore": 0
}
},
{
"ratingStrings": ["18", "Caution"],
"ratingScore": {
"score": 18,
"subScore": 1
}
},
{
"ratingStrings": ["Mature", "Adult", "R18"],
"ratingScore": {
"score": 1000,
"subScore": 0
}
}
]
}

View File

@@ -1,10 +0,0 @@
G,4
PG,12
12,12
12A,12
12PG,12
15,15
15PG,15
15A,15
16,16
18,18
1 G 4
2 PG 12
3 12 12
4 12A 12
5 12PG 12
6 15 15
7 15PG 15
8 15A 15
9 16 16
10 18 18

View File

@@ -0,0 +1,55 @@
{
"countryCode": "ie",
"supportsSubScores": true,
"ratings": [
{
"ratingStrings": ["G"],
"ratingScore": {
"score": 4,
"subScore": 0
}
},
{
"ratingStrings": ["12A", "12PG", "PG"],
"ratingScore": {
"score": 12,
"subScore": 0
}
},
{
"ratingStrings": ["12"],
"ratingScore": {
"score": 12,
"subScore": 1
}
},
{
"ratingStrings": ["15A", "15PG"],
"ratingScore": {
"score": 15,
"subScore": 0
}
},
{
"ratingStrings": ["15"],
"ratingScore": {
"score": 15,
"subScore": 3
}
},
{
"ratingStrings": ["16"],
"ratingScore": {
"score": 16,
"subScore": 0
}
},
{
"ratingStrings": ["18"],
"ratingScore": {
"score": 18,
"subScore": 1
}
}
]
}

View File

@@ -1,11 +0,0 @@
A,0
G,0
B,12
PG12,12
C,15
15+,15
R15+,15
16+,16
D,17
Z,18
18+,18
1 A 0
2 G 0
3 B 12
4 PG12 12
5 C 15
6 15+ 15
7 R15+ 15
8 16+ 16
9 D 17
10 Z 18
11 18+ 18

View File

@@ -0,0 +1,62 @@
{
"countryCode": "jp",
"supportsSubScores": true,
"ratings": [
{
"ratingStrings": ["A", "G"],
"ratingScore": {
"score": 0,
"subScore": 0
}
},
{
"ratingStrings": ["PG12"],
"ratingScore": {
"score": 12,
"subScore": 0
}
},
{
"ratingStrings": ["B"],
"ratingScore": {
"score": 12,
"subScore": 1
}
},
{
"ratingStrings": ["15A", "15PG"],
"ratingScore": {
"score": 15,
"subScore": 0
}
},
{
"ratingStrings": ["C", "15+", "R15+"],
"ratingScore": {
"score": 15,
"subScore": 1
}
},
{
"ratingStrings": ["16+"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["D"],
"ratingScore": {
"score": 17,
"subScore": null
}
},
{
"ratingStrings": ["18+", "Z"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,6 +0,0 @@
K,0
БА,12
Б14,14
E16,16
E18,18
HA,18
1 K 0
2 БА 12
3 Б14 14
4 E16 16
5 E18 18
6 HA 18

View File

@@ -0,0 +1,41 @@
{
"countryCode": "kz",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["K"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["БА"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["Б14"],
"ratingScore": {
"score": 14,
"subScore": null
}
},
{
"ratingStrings": ["E16"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["E18", "HA"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,6 +0,0 @@
A,0
AA,0
B,12
B-15,15
C,18
D,1000
1 A 0
2 AA 0
3 B 12
4 B-15 15
5 C 18
6 D 1000

View File

@@ -0,0 +1,41 @@
{
"countryCode": "mx",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["A", "AA"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["B"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["B-15"],
"ratingScore": {
"score": 15,
"subScore": null
}
},
{
"ratingStrings": ["C"],
"ratingScore": {
"score": 18,
"subScore": null
}
},
{
"ratingStrings": ["D"],
"ratingScore": {
"score": 1000,
"subScore": null
}
}
]
}

View File

@@ -1,8 +0,0 @@
AL,0
MG6,6
6,6
9,9
12,12
14,14
16,16
18,18
1 AL 0
2 MG6 6
3 6 6
4 9 9
5 12 12
6 14 14
7 16 16
8 18 18

View File

@@ -0,0 +1,55 @@
{
"countryCode": "nl",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["AL"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["6", "MG6"],
"ratingScore": {
"score": 6,
"subScore": null
}
},
{
"ratingStrings": ["9"],
"ratingScore": {
"score": 9,
"subScore": null
}
},
{
"ratingStrings": ["12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["14"],
"ratingScore": {
"score": 14,
"subScore": null
}
},
{
"ratingStrings": ["16"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["18"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,10 +0,0 @@
A,0
6,6
7,7
9,9
11,11
12,12
15,15
18,18
C,18
Not approved,1001
1 A 0
2 6 6
3 7 7
4 9 9
5 11 11
6 12 12
7 15 15
8 18 18
9 C 18
10 Not approved 1001

View File

@@ -0,0 +1,69 @@
{
"countryCode": "no",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["A"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["6"],
"ratingScore": {
"score": 6,
"subScore": null
}
},
{
"ratingStrings": ["7"],
"ratingScore": {
"score": 7,
"subScore": null
}
},
{
"ratingStrings": ["9"],
"ratingScore": {
"score": 9,
"subScore": null
}
},
{
"ratingStrings": ["11"],
"ratingScore": {
"score": 11,
"subScore": null
}
},
{
"ratingStrings": ["12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["15"],
"ratingScore": {
"score": 15,
"subScore": null
}
},
{
"ratingStrings": ["18"],
"ratingScore": {
"score": 18,
"subScore": null
}
},
{
"ratingStrings": ["Not approved"],
"ratingScore": {
"score": 1001,
"subScore": null
}
}
]
}

View File

@@ -1,16 +0,0 @@
Exempt,0
G,0
GY,13
PG,13
R13,13
RP13,13
R15,15
M,16
R16,16
RP16,16
GA,18
R18,18
RP18,18
MA,1000
R,1001
Objectionable,1001
1 Exempt 0
2 G 0
3 GY 13
4 PG 13
5 R13 13
6 RP13 13
7 R15 15
8 M 16
9 R16 16
10 RP16 16
11 GA 18
12 R18 18
13 RP18 18
14 MA 1000
15 R 1001
16 Objectionable 1001

View File

@@ -0,0 +1,69 @@
{
"countryCode": "nz",
"supportsSubScores": true,
"ratings": [
{
"ratingStrings": ["Exempt", "G"],
"ratingScore": {
"score": 0,
"subScore": 0
}
},
{
"ratingStrings": ["RP13", "PG"],
"ratingScore": {
"score": 13,
"subScore": 0
}
},
{
"ratingStrings": ["GY", "R13"],
"ratingScore": {
"score": 13,
"subScore": 1
}
},
{
"ratingStrings": ["RP16", "M"],
"ratingScore": {
"score": 16,
"subScore": 0
}
},
{
"ratingStrings": ["R16"],
"ratingScore": {
"score": 16,
"subScore": 1
}
},
{
"ratingStrings": ["RP18"],
"ratingScore": {
"score": 18,
"subScore": 0
}
},
{
"ratingStrings": ["R18", "GA"],
"ratingScore": {
"score": 18,
"subScore": 1
}
},
{
"ratingStrings": ["MA"],
"ratingScore": {
"score": 1000,
"subScore": 0
}
},
{
"ratingStrings": ["Objectionable", "R"],
"ratingScore": {
"score": 1001,
"subScore": 0
}
}
]
}

View File

@@ -1,6 +0,0 @@
AG,0
AP-12,12
N-15,15
IM-18,18
IM-18-XXX,1000
IC,1001
1 AG 0
2 AP-12 12
3 N-15 15
4 IM-18 18
5 IM-18-XXX 1000
6 IC 1001

View File

@@ -0,0 +1,48 @@
{
"countryCode": "ro",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["AG"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["AP-12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["N-15"],
"ratingScore": {
"score": 15,
"subScore": null
}
},
{
"ratingStrings": ["IM-18"],
"ratingScore": {
"score": 18,
"subScore": null
}
},
{
"ratingStrings": ["IM-18-XXX"],
"ratingScore": {
"score": 1000,
"subScore": null
}
},
{
"ratingStrings": ["IC"],
"ratingScore": {
"score": 1001,
"subScore": null
}
}
]
}

View File

@@ -1,6 +0,0 @@
0+,0
6+,6
12+,12
16+,16
18+,18
Refused classification,1001
1 0+ 0
2 6+ 6
3 12+ 12
4 16+ 16
5 18+ 18
6 Refused classification 1001

View File

@@ -0,0 +1,48 @@
{
"countryCode": "ru",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["0+"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["6+"],
"ratingScore": {
"score": 6,
"subScore": null
}
},
{
"ratingStrings": ["12+"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["16+"],
"ratingScore": {
"score": 16,
"subScore": null
}
},
{
"ratingStrings": ["18+"],
"ratingScore": {
"score": 18,
"subScore": null
}
},
{
"ratingStrings": ["Refused classification"],
"ratingScore": {
"score": 1001,
"subScore": null
}
}
]
}

View File

@@ -1,10 +0,0 @@
Alla,0
Barntillåten,0
Btl,0
0+,0
7,7
9+,9
10+,10
11,11
14,14
15,15
1 Alla 0
2 Barntillåten 0
3 Btl 0
4 0+ 0
5 7 7
6 9+ 9
7 10+ 10
8 11 11
9 14 14
10 15 15

View File

@@ -0,0 +1,55 @@
{
"countryCode": "se",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["0+", "Alla", "Barntillåten", "Btl"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["7"],
"ratingScore": {
"score": 7,
"subScore": null
}
},
{
"ratingStrings": ["9+"],
"ratingScore": {
"score": 9,
"subScore": null
}
},
{
"ratingStrings": ["10+"],
"ratingScore": {
"score": 10,
"subScore": null
}
},
{
"ratingStrings": ["11"],
"ratingScore": {
"score": 11,
"subScore": null
}
},
{
"ratingStrings": ["14"],
"ratingScore": {
"score": 14,
"subScore": null
}
},
{
"ratingStrings": ["15"],
"ratingScore": {
"score": 15,
"subScore": null
}
}
]
}

View File

@@ -1,6 +0,0 @@
NR,0
U,0
7,7
12,12
15,15
18,18
1 NR 0
2 U 0
3 7 7
4 12 12
5 15 15
6 18 18

View File

@@ -0,0 +1,41 @@
{
"countryCode": "sk",
"supportsSubScores": false,
"ratings": [
{
"ratingStrings": ["U", "NR"],
"ratingScore": {
"score": 0,
"subScore": null
}
},
{
"ratingStrings": ["7"],
"ratingScore": {
"score": 7,
"subScore": null
}
},
{
"ratingStrings": ["12"],
"ratingScore": {
"score": 12,
"subScore": null
}
},
{
"ratingStrings": ["15"],
"ratingScore": {
"score": 15,
"subScore": null
}
},
{
"ratingStrings": ["18"],
"ratingScore": {
"score": 18,
"subScore": null
}
}
]
}

View File

@@ -1,22 +0,0 @@
All,0
E,0
G,0
U,0
0+,0
6+,6
7+,7
PG,8
9+,9
12,12
12+,12
12A,12
Teen,13
13+,13
14+,14
15,15
16,16
Caution,18
18,18
Mature,1000
Adult,1000
R18,1000
1 All 0
2 E 0
3 G 0
4 U 0
5 0+ 0
6 6+ 6
7 7+ 7
8 PG 8
9 9+ 9
10 12 12
11 12+ 12
12 12A 12
13 Teen 13
14 13+ 13
15 14+ 14
16 15 15
17 16 16
18 Caution 18
19 18 18
20 Mature 1000
21 Adult 1000
22 R18 1000

View File

@@ -0,0 +1,97 @@
{
"countryCode": "gb",
"supportsSubScores": true,
"ratings": [
{
"ratingStrings": ["0+", "All", "E", "G", "U"],
"ratingScore": {
"score": 0,
"subScore": 0
}
},
{
"ratingStrings": ["6+"],
"ratingScore": {
"score": 6,
"subScore": 0
}
},
{
"ratingStrings": ["7+"],
"ratingScore": {
"score": 7,
"subScore": 0
}
},
{
"ratingStrings": ["PG"],
"ratingScore": {
"score": 8,
"subScore": 0
}
},
{
"ratingStrings": ["9"],
"ratingScore": {
"score": 9,
"subScore": 0
}
},
{
"ratingStrings": ["12A", "12PG"],
"ratingScore": {
"score": 12,
"subScore": 0
}
},
{
"ratingStrings": ["12", "12+"],
"ratingScore": {
"score": 12,
"subScore": 1
}
},
{
"ratingStrings": ["13+", "Teen"],
"ratingScore": {
"score": 13,
"subScore": 0
}
},
{
"ratingStrings": ["14+"],
"ratingScore": {
"score": 14,
"subScore": 0
}
},
{
"ratingStrings": ["15"],
"ratingScore": {
"score": 15,
"subScore": 3
}
},
{
"ratingStrings": ["16"],
"ratingScore": {
"score": 16,
"subScore": 0
}
},
{
"ratingStrings": ["18", "Caution"],
"ratingScore": {
"score": 18,
"subScore": 1
}
},
{
"ratingStrings": ["Mature", "Adult", "R18"],
"ratingScore": {
"score": 1000,
"subScore": 0
}
}
]
}

View File

@@ -1,52 +0,0 @@
Approved,0
G,0
TV-G,0
TV-Y,0
TV-Y7,7
TV-Y7-FV,7
PG,10
TV-PG,10
TV-PG-D,10
TV-PG-L,10
TV-PG-S,10
TV-PG-V,10
TV-PG-DL,10
TV-PG-DS,10
TV-PG-DV,10
TV-PG-LS,10
TV-PG-LV,10
TV-PG-SV,10
TV-PG-DLS,10
TV-PG-DLV,10
TV-PG-DSV,10
TV-PG-LSV,10
TV-PG-DLSV,10
PG-13,13
TV-14,14
TV-14-D,14
TV-14-L,14
TV-14-S,14
TV-14-V,14
TV-14-DL,14
TV-14-DS,14
TV-14-DV,14
TV-14-LS,14
TV-14-LV,14
TV-14-SV,14
TV-14-DLS,14
TV-14-DLV,14
TV-14-DSV,14
TV-14-LSV,14
TV-14-DLSV,14
NC-17,17
R,17
TV-MA,17
TV-MA-L,17
TV-MA-S,17
TV-MA-V,17
TV-MA-LS,17
TV-MA-LV,17
TV-MA-SV,17
TV-MA-LSV,17
TV-X,18
TV-AO,18
1 Approved 0
2 G 0
3 TV-G 0
4 TV-Y 0
5 TV-Y7 7
6 TV-Y7-FV 7
7 PG 10
8 TV-PG 10
9 TV-PG-D 10
10 TV-PG-L 10
11 TV-PG-S 10
12 TV-PG-V 10
13 TV-PG-DL 10
14 TV-PG-DS 10
15 TV-PG-DV 10
16 TV-PG-LS 10
17 TV-PG-LV 10
18 TV-PG-SV 10
19 TV-PG-DLS 10
20 TV-PG-DLV 10
21 TV-PG-DSV 10
22 TV-PG-LSV 10
23 TV-PG-DLSV 10
24 PG-13 13
25 TV-14 14
26 TV-14-D 14
27 TV-14-L 14
28 TV-14-S 14
29 TV-14-V 14
30 TV-14-DL 14
31 TV-14-DS 14
32 TV-14-DV 14
33 TV-14-LS 14
34 TV-14-LV 14
35 TV-14-SV 14
36 TV-14-DLS 14
37 TV-14-DLV 14
38 TV-14-DSV 14
39 TV-14-LSV 14
40 TV-14-DLSV 14
41 NC-17 17
42 R 17
43 TV-MA 17
44 TV-MA-L 17
45 TV-MA-S 17
46 TV-MA-V 17
47 TV-MA-LS 17
48 TV-MA-LV 17
49 TV-MA-SV 17
50 TV-MA-LSV 17
51 TV-X 18
52 TV-AO 18

View File

@@ -0,0 +1,83 @@
{
"countryCode": "us",
"supportsSubScores": true,
"ratings": [
{
"ratingStrings": ["Approved", "G", "TV-G", "TV-Y"],
"ratingScore": {
"score": 0,
"subScore": 0
}
},
{
"ratingStrings": ["TV-Y7"],
"ratingScore": {
"score": 7,
"subScore": 0
}
},
{
"ratingStrings": ["TV-Y7-FV"],
"ratingScore": {
"score": 7,
"subScore": 1
}
},
{
"ratingStrings": ["PG", "TV-PG"],
"ratingScore": {
"score": 10,
"subScore": 0
}
},
{
"ratingStrings": ["TV-PG-D", "TV-PG-L", "TV-PG-S", "TV-PG-V", "TV-PG-DL", "TV-PG-DS", "TV-PG-DV", "TV-PG-LS", "TV-PG-LV", "TV-PG-SV", "TV-PG-DLS", "TV-PG-DLV", "TV-PG-DSV", "TV-PG-LSV", "TV-PG-DLSV"],
"ratingScore": {
"score": 10,
"subScore": 1
}
},
{
"ratingStrings": ["PG-13"],
"ratingScore": {
"score": 13,
"subScore": 0
}
},
{
"ratingStrings": ["TV-14"],
"ratingScore": {
"score": 14,
"subScore": 0
}
},
{
"ratingStrings": ["TV-14-D", "TV-14-L", "TV-14-S", "TV-14-V", "TV-14-DL", "TV-14-DS", "TV-14-DV", "TV-14-LS", "TV-14-LV", "TV-14-SV", "TV-14-DLS", "TV-14-DLV", "TV-14-DSV", "TV-14-LSV", "TV-14-DLSV"],
"ratingScore": {
"score": 14,
"subScore": 1
}
},
{
"ratingStrings": ["R"],
"ratingScore": {
"score": 17,
"subScore": 0
}
},
{
"ratingStrings": ["NC-17", "TV-MA", "TV-MA-L", "TV-MA-S", "TV-MA-V", "TV-MA-LS", "TV-MA-LV", "TV-MA-SV", "TV-MA-LSV"],
"ratingScore": {
"score": 17,
"subScore": 1
}
},
{
"ratingStrings": ["TV-X", "TV-AO"],
"ratingScore": {
"score": 18,
"subScore": 0
}
}
]
}

View File

@@ -1,45 +1,54 @@
#pragma warning disable CS1591
using System;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Querying;
namespace Emby.Server.Implementations.Sorting
namespace Emby.Server.Implementations.Sorting;
/// <summary>
/// Class providing comparison for official ratings.
/// </summary>
public class OfficialRatingComparer : IBaseItemComparer
{
public class OfficialRatingComparer : IBaseItemComparer
private readonly ILocalizationManager _localizationManager;
/// <summary>
/// Initializes a new instance of the <see cref="OfficialRatingComparer"/> class.
/// </summary>
/// <param name="localizationManager">Instance of the <see cref="ILocalizationManager"/> interface.</param>
public OfficialRatingComparer(ILocalizationManager localizationManager)
{
private readonly ILocalizationManager _localization;
_localizationManager = localizationManager;
}
public OfficialRatingComparer(ILocalizationManager localization)
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public ItemSortBy Type => ItemSortBy.OfficialRating;
/// <summary>
/// Compares the specified x.
/// </summary>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
/// <returns>System.Int32.</returns>
public int Compare(BaseItem? x, BaseItem? y)
{
ArgumentNullException.ThrowIfNull(x);
ArgumentNullException.ThrowIfNull(y);
var zeroRating = new ParentalRatingScore(0, 0);
var ratingX = string.IsNullOrEmpty(x.OfficialRating) ? zeroRating : _localizationManager.GetRatingScore(x.OfficialRating) ?? zeroRating;
var ratingY = string.IsNullOrEmpty(y.OfficialRating) ? zeroRating : _localizationManager.GetRatingScore(y.OfficialRating) ?? zeroRating;
var scoreCompare = ratingX.Score.CompareTo(ratingY.Score);
if (scoreCompare is 0)
{
_localization = localization;
return (ratingX.SubScore ?? 0).CompareTo(ratingY.SubScore ?? 0);
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public ItemSortBy Type => ItemSortBy.OfficialRating;
/// <summary>
/// Compares the specified x.
/// </summary>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
/// <returns>System.Int32.</returns>
public int Compare(BaseItem? x, BaseItem? y)
{
ArgumentNullException.ThrowIfNull(x);
ArgumentNullException.ThrowIfNull(y);
var levelX = string.IsNullOrEmpty(x.OfficialRating) ? 0 : _localization.GetRatingLevel(x.OfficialRating) ?? 0;
var levelY = string.IsNullOrEmpty(y.OfficialRating) ? 0 : _localization.GetRatingLevel(y.OfficialRating) ?? 0;
return levelX.CompareTo(levelY);
}
return scoreCompare;
}
}