Skip to content

Commit

Permalink
Small fixes in APIv2
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Jan 5, 2025
1 parent a165338 commit 9dfedb0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Shoko.Server/API/v2/Models/common/Episode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Runtime.Serialization;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Shoko.Commons.Extensions;
using Shoko.Plugin.Abstractions.Enums;
using Shoko.Server.Extensions;
using Shoko.Server.Models;
Expand Down Expand Up @@ -106,7 +105,7 @@ internal static Episode GenerateFromAnimeEpisode(HttpContext ctx, SVR_AnimeEpiso
{
TMDB_Image thumbnail = null;
var tmdbEpisode = tmdbEpisodes[0];
if (pic > 0 && tmdbEpisode.GetImages(ImageEntityType.Thumbnail) is { } thumbnailImages && thumbnailImages.Count > 0)
if (pic > 0 && tmdbEpisode.GetImages(ImageEntityType.Thumbnail) is { Count: > 0 } thumbnailImages)
{
thumbnail = thumbnailImages
.Where(image => image.ImageType == ImageEntityType.Thumbnail && image.IsLocalAvailable)
Expand All @@ -121,15 +120,15 @@ internal static Episode GenerateFromAnimeEpisode(HttpContext ctx, SVR_AnimeEpiso
});
}
}
if (pic > 0 && tmdbEpisode.GetImages(ImageEntityType.Backdrop) is { } backdropImages && backdropImages.Count > 0)
if (pic > 0 && tmdbEpisode.GetImages(ImageEntityType.Backdrop) is { Count: > 0 } backdropImages)
{
var backdrop = backdropImages
.Where(image => image.ImageType == ImageEntityType.Backdrop && image.IsLocalAvailable)
.OrderByDescending(image => image.IsPreferred)
.FirstOrDefault();
backdrop ??= thumbnail;
if (backdrop is not null)
{
backdrop ??= thumbnail;
ep.art.fanart.Add(new Art
{
index = 0,
Expand Down

0 comments on commit 9dfedb0

Please sign in to comment.