Skip to content

Commit

Permalink
fix: fix episode parent series field usage (take 2)
Browse files Browse the repository at this point in the history
- Moved the check from code path A to code path B, because the check was a no-operation on code path A and should had been placed on code path B in the first place. 🤦
  • Loading branch information
revam committed Oct 7, 2024
1 parent fa261c5 commit 720e48c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Shokofin/API/ShokoAPIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,13 +353,7 @@ public Task<Episode> GetEpisode(string id)
// If the episode has no 'movie' images, get the series images to compensate.
if (episodeImages.Posters.Count is 0) {
var episode1 = await GetEpisode(id);
var seriesId = episode1.IDs.ParentSeries.ToString();
if (UseEpisodeGetSeriesEndpoint) {
var series = await GetSeriesFromEpisode(id);
if (series != null)
seriesId = series.IDs.Shoko.ToString();
}
var seriesImages1 = seriesId is not "0" ? await GetSeriesImages(seriesId) ?? new() : new();
var seriesImages1 = await GetSeriesImages(episode1.IDs.ParentSeries.ToString()) ?? new();

episodeImages.Posters = seriesImages1.Posters;
episodeImages.Logos = seriesImages1.Logos;
Expand All @@ -370,7 +364,13 @@ public Task<Episode> GetEpisode(string id)
}

var episode0 = await GetEpisode(id);
var seriesImages0 = await GetSeriesImages(episode0.IDs.ParentSeries.ToString()) ?? new();
var seriesId0 = episode0.IDs.ParentSeries.ToString();
if (UseEpisodeGetSeriesEndpoint) {
var series = await GetSeriesFromEpisode(id);
if (series != null)
seriesId0 = series.IDs.Shoko.ToString();
}
var seriesImages0 = seriesId0 is not "0" ? await GetSeriesImages(seriesId0) ?? new() : new();
return new() {
Banners = seriesImages0.Banners,
Backdrops = seriesImages0.Backdrops,
Expand Down

0 comments on commit 720e48c

Please sign in to comment.