Skip to content

Commit

Permalink
Set ContentRatings list to be nullable (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
scampower3 authored Aug 5, 2024
1 parent a4e518b commit 7ec50a2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Jellyfin.Plugin.Tvdb/Providers/TvdbMovieProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private void MapMovieToResult(MetadataResult<Movie> result, MovieExtendedRecord
movie.OriginalTitle = tvdbMovie.Name;
result.ResultLanguage = info.MetadataLanguage;
// Attempts to default to USA if not found
movie.OfficialRating = tvdbMovie.ContentRatings.FirstOrDefault(x => string.Equals(x.Country, TvdbCultureInfo.GetCountryInfo(info.MetadataCountryCode)?.ThreeLetterISORegionName, StringComparison.OrdinalIgnoreCase))?.Name ?? tvdbMovie.ContentRatings.FirstOrDefault(x => string.Equals(x.Country, "usa", StringComparison.OrdinalIgnoreCase))?.Name;
movie.OfficialRating = tvdbMovie.ContentRatings?.FirstOrDefault(x => string.Equals(x.Country, TvdbCultureInfo.GetCountryInfo(info.MetadataCountryCode)?.ThreeLetterISORegionName, StringComparison.OrdinalIgnoreCase))?.Name ?? tvdbMovie.ContentRatings?.FirstOrDefault(x => string.Equals(x.Country, "usa", StringComparison.OrdinalIgnoreCase))?.Name;

var collectionIds = tvdbMovie.Lists.Where(x => x.IsOfficial is true)
.Select(x => x.Id?.ToString(CultureInfo.InvariantCulture))
Expand Down
2 changes: 1 addition & 1 deletion Jellyfin.Plugin.Tvdb/Providers/TvdbSeriesProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ private void MapSeriesToResult(MetadataResult<Series> result, SeriesExtendedReco
series.AirTime = tvdbSeries.AirsTime;
// series.CommunityRating = (float?)tvdbSeries.SiteRating;
// Attempts to default to USA if not found
series.OfficialRating = tvdbSeries.ContentRatings.FirstOrDefault(x => string.Equals(x.Country, TvdbCultureInfo.GetCountryInfo(info.MetadataCountryCode)?.ThreeLetterISORegionName, StringComparison.OrdinalIgnoreCase))?.Name ?? tvdbSeries.ContentRatings.FirstOrDefault(x => string.Equals(x.Country, "usa", StringComparison.OrdinalIgnoreCase))?.Name;
series.OfficialRating = tvdbSeries.ContentRatings?.FirstOrDefault(x => string.Equals(x.Country, TvdbCultureInfo.GetCountryInfo(info.MetadataCountryCode)?.ThreeLetterISORegionName, StringComparison.OrdinalIgnoreCase))?.Name ?? tvdbSeries.ContentRatings?.FirstOrDefault(x => string.Equals(x.Country, "usa", StringComparison.OrdinalIgnoreCase))?.Name;
if (tvdbSeries.Lists is not null && tvdbSeries.Lists is JsonElement jsonElement)
{
var collections = jsonElement.Deserialize<List<object>>();
Expand Down

0 comments on commit 7ec50a2

Please sign in to comment.