mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-26 18:48:21 +01:00
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
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:
@@ -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; }
|
||||
}
|
||||
|
||||
22
MediaBrowser.Model/Entities/ParentalRatingEntry.cs
Normal file
22
MediaBrowser.Model/Entities/ParentalRatingEntry.cs
Normal file
@@ -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; }
|
||||
}
|
||||
32
MediaBrowser.Model/Entities/ParentalRatingScore.cs
Normal file
32
MediaBrowser.Model/Entities/ParentalRatingScore.cs
Normal file
@@ -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; }
|
||||
}
|
||||
28
MediaBrowser.Model/Entities/ParentalRatingSystem.cs
Normal file
28
MediaBrowser.Model/Entities/ParentalRatingSystem.cs
Normal file
@@ -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