Skip to content

Commit

Permalink
Fix Specials being added during season refresh when IncludeMissingSpe…
Browse files Browse the repository at this point in the history
…cials is disabled (#152)
  • Loading branch information
scampower3 authored Jun 4, 2024
1 parent 9c7a524 commit f42a468
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Jellyfin.Plugin.Tvdb/Configuration/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ <h2 class="sectionTitle">TheTVDB Settings:</h2>
document.getElementById('cacheDurationInDays').value = config.CacheDurationInDays;
document.getElementById('metadataUpdateInHours').value = config.MetadataUpdateInHours;
document.getElementById('fallbackLanguages').value = config.FallbackLanguages;
document.getElementById('includeMissingSpecials').checked = config.IncludeMissingSpecials || true;
document.getElementById('includeMissingSpecials').checked = config.IncludeMissingSpecials;
Dashboard.hideLoadingMsg();
});
},
Expand Down
7 changes: 7 additions & 0 deletions Jellyfin.Plugin.Tvdb/Providers/TvdbMissingEpisodeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ private async Task HandleSeason(Season season, IReadOnlyList<EpisodeBaseRecord>?
var allEpisodes = allEpisodesRemote ?? await GetAllEpisodes(tvdbId, series.DisplayOrder, season.GetPreferredMetadataLanguage())
.ConfigureAwait(false);

// Skip if called from HandleSeries since it will be filtered there, allEpisodesRemote will not be null when called from HandleSeries
// Remove specials if IncludeMissingSpecials is false
if (allEpisodesRemote is null && !IncludeMissingSpecials)
{
allEpisodes = allEpisodes.Where(e => e.SeasonNumber != 0).ToList();
}

var seasonEpisodes = allEpisodes.Where(e => e.SeasonNumber == season.IndexNumber).ToList();
var existingEpisodes = season.GetEpisodes().OfType<Episode>().ToHashSet();

Expand Down

0 comments on commit f42a468

Please sign in to comment.