mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-10-01 07:55:22 +02:00
DeleteInvalidEpisodes Deletes by TvDbId only, skipping any manually added episodes (TvDbEpisodeId is 0 or null)
This commit is contained in:
@@ -373,22 +373,6 @@ namespace NzbDrone.Core.Providers
|
||||
{
|
||||
Logger.Info("Starting deletion of invalid episode for series: {0}", series.Title.WithDefault(series.SeriesId));
|
||||
|
||||
var seasons = tvDbSeriesInfo.Episodes.Select(e => e.SeasonNumber).Distinct();
|
||||
|
||||
foreach (var s in seasons)
|
||||
{
|
||||
//Avoiding accessing modified closure
|
||||
var season = s;
|
||||
Logger.Trace("Processing invalid episodes for {0}, Season: {1}", series.SeriesId, season);
|
||||
|
||||
var episodesInSeason = tvDbSeriesInfo.Episodes.Where(e => e.SeasonNumber == season).Select(e => e.EpisodeNumber);
|
||||
var episodesString = String.Join(", ", episodesInSeason);
|
||||
var seasonQuery = String.Format("DELETE FROM Episodes WHERE SeriesId = {0} AND SeasonNumber = {1} AND EpisodeNumber NOT IN ({2})",
|
||||
series.SeriesId, season, episodesString);
|
||||
|
||||
_database.Execute(seasonQuery);
|
||||
}
|
||||
|
||||
//Delete Episodes not matching TvDbIds for this series
|
||||
var tvDbIds = tvDbSeriesInfo.Episodes.Select(e => e.Id);
|
||||
var tvDbIdString = String.Join(", ", tvDbIds);
|
||||
|
Reference in New Issue
Block a user