New: Don't search for unaired anime episodes when searching for season

Closes #2530
pull/3090/head
Mark McDowall 6 years ago
parent 8143237d25
commit 2ee0ae1f9e

@ -246,6 +246,24 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
criteria.Count.Should().Be(0); criteria.Count.Should().Be(0);
} }
[Test]
public void season_search_for_anime_should_not_search_for_unaired_episodes()
{
WithEpisodes();
_xemSeries.SeriesType = SeriesTypes.Anime;
_xemEpisodes.ForEach(e => e.AirDateUtc = DateTime.UtcNow.AddDays(5));
_xemEpisodes.ForEach(e => e.EpisodeFileId = 0);
var seasonNumber = 1;
var allCriteria = WatchForSearchCriteria();
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, false, true, false);
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
criteria.Count.Should().Be(0);
}
[Test] [Test]
public void season_search_for_anime_should_not_search_for_episodes_with_files() public void season_search_for_anime_should_not_search_for_episodes_with_files()
{ {

@ -229,7 +229,8 @@ namespace NzbDrone.Core.IndexerSearch
{ {
var downloadDecisions = new List<DownloadDecision>(); var downloadDecisions = new List<DownloadDecision>();
foreach (var episode in episodes.Where(e => e.Monitored)) // Only search for aired episodes when performing a season anime search
foreach (var episode in episodes.Where(e => e.Monitored && e.AirDateUtc.HasValue && e.AirDateUtc.Value.Before(DateTime.UtcNow)))
{ {
downloadDecisions.AddRange(SearchAnime(series, episode, userInvokedSearch, interactiveSearch)); downloadDecisions.AddRange(SearchAnime(series, episode, userInvokedSearch, interactiveSearch));
} }

Loading…
Cancel
Save