Rework parental ratings (#12615)
This commit is contained in:
@@ -1,33 +1,40 @@
|
||||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
namespace MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Model.Entities
|
||||
/// <summary>
|
||||
/// Class ParentalRating.
|
||||
/// </summary>
|
||||
public class ParentalRating
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ParentalRating.
|
||||
/// Initializes a new instance of the <see cref="ParentalRating"/> class.
|
||||
/// </summary>
|
||||
public class ParentalRating
|
||||
/// <param name="name">The name.</param>
|
||||
/// <param name="score">The score.</param>
|
||||
public ParentalRating(string name, ParentalRatingScore? score)
|
||||
{
|
||||
public ParentalRating()
|
||||
{
|
||||
}
|
||||
|
||||
public ParentalRating(string name, int? value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public int? Value { get; set; }
|
||||
Name = name;
|
||||
Value = score?.Score;
|
||||
RatingScore = score;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
/// <remarks>
|
||||
/// Deprecated.
|
||||
/// </remarks>
|
||||
public int? Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the rating score.
|
||||
/// </summary>
|
||||
/// <value>The rating score.</value>
|
||||
public ParentalRatingScore? RatingScore { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// A class representing an parental rating entry.
|
||||
/// </summary>
|
||||
public class ParentalRatingEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the rating strings.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ratingStrings")]
|
||||
public required IReadOnlyList<string> RatingStrings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the score.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ratingScore")]
|
||||
public required ParentalRatingScore RatingScore { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// A class representing an parental rating score.
|
||||
/// </summary>
|
||||
public class ParentalRatingScore
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParentalRatingScore"/> class.
|
||||
/// </summary>
|
||||
/// <param name="score">The score.</param>
|
||||
/// <param name="subScore">The sub score.</param>
|
||||
public ParentalRatingScore(int score, int? subScore)
|
||||
{
|
||||
Score = score;
|
||||
SubScore = subScore;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the score.
|
||||
/// </summary>
|
||||
[JsonPropertyName("score")]
|
||||
public int Score { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sub score.
|
||||
/// </summary>
|
||||
[JsonPropertyName("subScore")]
|
||||
public int? SubScore { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MediaBrowser.Model.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// A class representing a parental rating system.
|
||||
/// </summary>
|
||||
public class ParentalRatingSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the country code.
|
||||
/// </summary>
|
||||
[JsonPropertyName("countryCode")]
|
||||
public required string CountryCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether sub scores are supported.
|
||||
/// </summary>
|
||||
[JsonPropertyName("supportsSubScores")]
|
||||
public bool SupportsSubScores { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ratings.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ratings")]
|
||||
public IReadOnlyList<ParentalRatingEntry>? Ratings { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user