Fixed: Searching for unmonitored anime episodes during season/all missing searches

This commit is contained in:
Mark McDowall 2015-03-26 09:06:20 -07:00
parent adfaa00ce1
commit 90b047f0d4
2 changed files with 25 additions and 3 deletions

View File

@ -37,6 +37,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
_xemSeries = Builder<Series>.CreateNew() _xemSeries = Builder<Series>.CreateNew()
.With(v => v.UseSceneNumbering = true) .With(v => v.UseSceneNumbering = true)
.With(v => v.Monitored = true)
.Build(); .Build();
_xemEpisodes = new List<Episode>(); _xemEpisodes = new List<Episode>();
@ -63,6 +64,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
.With(v => v.EpisodeNumber, episodeNumber) .With(v => v.EpisodeNumber, episodeNumber)
.With(v => v.SceneSeasonNumber, sceneSeasonNumber) .With(v => v.SceneSeasonNumber, sceneSeasonNumber)
.With(v => v.SceneEpisodeNumber, sceneEpisodeNumber) .With(v => v.SceneEpisodeNumber, sceneEpisodeNumber)
.With(v => v.Monitored = true)
.Build(); .Build();
_xemEpisodes.Add(episode); _xemEpisodes.Add(episode);
@ -196,12 +198,12 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
} }
[Test] [Test]
public void season_search_for_anime_should_search_for_each_episode() public void season_search_for_anime_should_search_for_each_monitored_episode()
{ {
WithEpisodes(); WithEpisodes();
_xemSeries.SeriesType = SeriesTypes.Anime; _xemSeries.SeriesType = SeriesTypes.Anime;
var seasonNumber = 1;
var seasonNumber = 1;
var allCriteria = WatchForSearchCriteria(); var allCriteria = WatchForSearchCriteria();
Subject.SeasonSearch(_xemSeries.Id, seasonNumber); Subject.SeasonSearch(_xemSeries.Id, seasonNumber);
@ -210,5 +212,22 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
criteria.Count.Should().Be(_xemEpisodes.Count(e => e.SeasonNumber == seasonNumber)); criteria.Count.Should().Be(_xemEpisodes.Count(e => e.SeasonNumber == seasonNumber));
} }
[Test]
public void season_search_for_anime_should_not_search_for_unmonitored_episodes()
{
WithEpisodes();
_xemSeries.SeriesType = SeriesTypes.Anime;
_xemEpisodes.ForEach(e => e.Monitored = false);
var seasonNumber = 1;
var allCriteria = WatchForSearchCriteria();
Subject.SeasonSearch(_xemSeries.Id, seasonNumber);
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
criteria.Count.Should().Be(0);
}
} }
} }

View File

@ -217,7 +217,10 @@ namespace NzbDrone.Core.IndexerSearch
foreach (var episode in episodes) foreach (var episode in episodes)
{ {
downloadDecisions.AddRange(SearchAnime(series, episode)); if (episode.Monitored)
{
downloadDecisions.AddRange(SearchAnime(series, episode));
}
} }
return downloadDecisions; return downloadDecisions;