1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-07 03:22:37 +01:00

Added Linq post filtering to indexer searches.

This commit is contained in:
kay.one 2012-01-19 22:01:30 -08:00
parent 3d214f0f0b
commit 9d90f04b6e
2 changed files with 9 additions and 3 deletions

View File

@ -209,6 +209,8 @@ public void nzbsorg_search_returns_valid_results(string title, int season, int e
ExceptionVerification.MarkInconclusive(typeof(WebException));
result.Should().NotBeEmpty();
result.Should().OnlyContain(r => r.SeasonNumber == season);
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
result.Should().OnlyContain(r => r.CleanTitle == Parser.NormalizeTitle(title));
result.Should().Contain(r => r.SeasonNumber == season && r.EpisodeNumbers.Contains(episode));
}

View File

@ -115,7 +115,8 @@ public virtual IList<EpisodeParseResult> FetchPartialSeason(string seriesTitle,
var result = Fetch(searchUrls);
result = result.Where(e => e.CleanTitle == Parser.NormalizeTitle(seriesTitle)).ToList();
result = result.Where(e => e.CleanTitle == Parser.NormalizeTitle(seriesTitle) &&
e.SeasonNumber == seasonNumber).ToList();
_logger.Info("Finished searching {0} for {1}-S{2}, Found {3}", Name, seriesTitle, seasonNumber, result.Count);
return result;
@ -129,7 +130,9 @@ public virtual IList<EpisodeParseResult> FetchEpisode(string seriesTitle, int se
var result = Fetch(searchUrls);
result = result.Where(e => e.CleanTitle == Parser.NormalizeTitle(seriesTitle)).ToList();
result = result.Where(e => e.CleanTitle == Parser.NormalizeTitle(seriesTitle) &&
e.SeasonNumber == seasonNumber && e.EpisodeNumbers.Contains(episodeNumber))
.ToList();
_logger.Info("Finished searching {0} for {1}-S{2}E{3:00}, Found {4}", Name, seriesTitle, seasonNumber, episodeNumber, result.Count);
return result;
@ -144,7 +147,8 @@ public virtual IList<EpisodeParseResult> FetchDailyEpisode(string seriesTitle, D
var result = Fetch(searchUrls);
result = result.Where(e => e.CleanTitle == Parser.NormalizeTitle(seriesTitle)).ToList();
result = result.Where(e => e.CleanTitle == Parser.NormalizeTitle(seriesTitle) &&
e.AirDate.HasValue && e.AirDate.Value.Date == airDate.Date).ToList();
_logger.Info("Finished searching {0} for {1}-{2}, Found {3}", Name, seriesTitle, airDate.ToShortDateString(), result.Count);
return result;