Skip to content

Commit

Permalink
fix: fix the new movie exception
Browse files Browse the repository at this point in the history
fixes 03b2e9d
  • Loading branch information
revam committed May 18, 2024
1 parent 9ad3f4b commit bb59dca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Shokofin/API/Info/SeasonInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ public SeasonInfo(Series series, DateTime? earliestImportedAt, DateTime? lastImp
int index = 0;
int lastNormalEpisode = 0;
foreach (var episode in episodes) {
if (episode.Shoko.IsHidden)
continue;
switch (episode.AniDB.Type) {
case EpisodeType.Normal:
episodesList.Add(episode);
Expand Down Expand Up @@ -186,7 +188,7 @@ public SeasonInfo(Series series, DateTime? earliestImportedAt, DateTime? lastImp
}
}
// Also switch the type from movie to web if we're hidden the main movies, but the parts are normal episodes.
else if (type == SeriesType.Movie && episodesList.Any(episodeInfo => string.Equals(episodeInfo.AniDB.Titles.FirstOrDefault(title => title.LanguageCode == "en")?.Value, "The Complete Movie", StringComparison.InvariantCultureIgnoreCase) && episodeInfo.Shoko.IsHidden)) {
else if (type == SeriesType.Movie && episodes.Any(episodeInfo => string.Equals(episodeInfo.AniDB.Titles.FirstOrDefault(title => title.LanguageCode == "en")?.Value, "Complete Movie", StringComparison.InvariantCultureIgnoreCase) && episodeInfo.Shoko.IsHidden)) {
type = SeriesType.Web;
}

Expand Down
2 changes: 1 addition & 1 deletion Shokofin/API/ShokoAPIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public Task<Episode> GetEpisode(string id)

public Task<ListResult<Episode>> GetEpisodesFromSeries(string seriesId)
{
return Get<ListResult<Episode>>($"/api/v3/Series/{seriesId}/Episode?pageSize=0&includeMissing=true&includeDataFrom=AniDB,TvDB&includeXRefs=true");
return Get<ListResult<Episode>>($"/api/v3/Series/{seriesId}/Episode?pageSize=0&includeHidden=true&includeMissing=true&includeDataFrom=AniDB,TvDB&includeXRefs=true");
}

public Task<Series> GetSeries(string id)
Expand Down
1 change: 0 additions & 1 deletion Shokofin/API/ShokoAPIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,6 @@ private Task<SeasonInfo> CreateSeasonInfo(Series series, string seriesId)
var (earliestImportedAt, lastImportedAt)= await GetEarliestImportedAtForSeries(seriesId).ConfigureAwait(false);
var episodes = (await APIClient.GetEpisodesFromSeries(seriesId).ConfigureAwait(false) ?? new()).List
.Select(e => CreateEpisodeInfo(e, e.IDs.Shoko.ToString()))
.Where(e => !e.Shoko.IsHidden)
.OrderBy(e => e.AniDB.AirDate)
.ToList();
var cast = await APIClient.GetSeriesCast(seriesId).ConfigureAwait(false);
Expand Down

0 comments on commit bb59dca

Please sign in to comment.