Skip to content

Commit

Permalink
Fix image selecting again
Browse files Browse the repository at this point in the history
  • Loading branch information
Xzonn committed May 19, 2024
1 parent ab5f602 commit 63cacc9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Jellyfin.Plugin.Douban/Provider/MovieImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, Cancell
ThumbnailUrl = $"{Configuration.CdnServer}/view/photo/s/public/{subject.PosterId}.jpg",
Type = ImageType.Primary,
Url = $"{Configuration.CdnServer}/view/photo/l/public/{subject.PosterId}.jpg",
CommunityRating = 10.0,
CommunityRating = -1,
RatingType = RatingType.Score,
};
images.Add(image);
Expand All @@ -74,6 +74,10 @@ public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, Cancell
{
(await api.FetchMovieImages(id.ToString(), _.Key, _.Value, token)).ForEach(images.Add);
}
if (images.FirstOrDefault()?.CommunityRating < 0)
{
images.FirstOrDefault()!.CommunityRating = (images.OrderBy(_ => _.CommunityRating).FirstOrDefault()?.CommunityRating ?? 0) + 1;
}

return images;
}
Expand Down
6 changes: 5 additions & 1 deletion Jellyfin.Plugin.Douban/Provider/PersonImageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@ public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, Cancell
ThumbnailUrl = subject.PosterUrl,
Type = ImageType.Primary,
Url = subject.PosterUrl,
CommunityRating = 10.0,
CommunityRating = -1,
RatingType = RatingType.Score,
};
images.Add(image);
}
(await api.FetchPersonImages(pid.ToString(), token)).ForEach(images.Add);
if (images.FirstOrDefault()?.CommunityRating < 0)
{
images.FirstOrDefault()!.CommunityRating = (images.OrderBy(_ => _.CommunityRating).FirstOrDefault()?.CommunityRating ?? 0) + 1;
}

return images;
}
Expand Down

0 comments on commit 63cacc9

Please sign in to comment.