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 @@ namespace NzbDrone.Core.Test
ExceptionVerification.MarkInconclusive(typeof(WebException)); ExceptionVerification.MarkInconclusive(typeof(WebException));
result.Should().NotBeEmpty(); 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().OnlyContain(r => r.CleanTitle == Parser.NormalizeTitle(title));
result.Should().Contain(r => r.SeasonNumber == season && r.EpisodeNumbers.Contains(episode)); result.Should().Contain(r => r.SeasonNumber == season && r.EpisodeNumbers.Contains(episode));
} }

View File

@ -115,7 +115,8 @@ namespace NzbDrone.Core.Providers.Indexer
var result = Fetch(searchUrls); 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); _logger.Info("Finished searching {0} for {1}-S{2}, Found {3}", Name, seriesTitle, seasonNumber, result.Count);
return result; return result;
@ -129,7 +130,9 @@ namespace NzbDrone.Core.Providers.Indexer
var result = Fetch(searchUrls); 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); _logger.Info("Finished searching {0} for {1}-S{2}E{3:00}, Found {4}", Name, seriesTitle, seasonNumber, episodeNumber, result.Count);
return result; return result;
@ -144,7 +147,8 @@ namespace NzbDrone.Core.Providers.Indexer
var result = Fetch(searchUrls); 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); _logger.Info("Finished searching {0} for {1}-{2}, Found {3}", Name, seriesTitle, airDate.ToShortDateString(), result.Count);
return result; return result;