Fixed: Scene numbered season searches when some episode weren't monitored

This commit is contained in:
Mark McDowall 2015-03-24 17:11:46 -07:00
parent a1a91878ad
commit 210524b51a
5 changed files with 31 additions and 1 deletions

View File

@ -123,5 +123,19 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
WithFirstEpisodeUnmonitored();
_monitoredEpisodeSpecification.IsSatisfiedBy(_parseResultSingle, new SeasonSearchCriteria()).Accepted.Should().BeFalse();
}
[Test]
public void should_return_true_if_episode_is_not_monitored_and_monitoredEpisodesOnly_flag_is_false()
{
WithFirstEpisodeUnmonitored();
_monitoredEpisodeSpecification.IsSatisfiedBy(_parseResultSingle, new SingleEpisodeSearchCriteria { MonitoredEpisodesOnly = false }).Accepted.Should().BeTrue();
}
[Test]
public void should_return_false_if_episode_is_not_monitored_and_monitoredEpisodesOnly_flag_is_true()
{
WithFirstEpisodeUnmonitored();
_monitoredEpisodeSpecification.IsSatisfiedBy(_parseResultSingle, new SingleEpisodeSearchCriteria{ MonitoredEpisodesOnly = true}).Accepted.Should().BeFalse();
}
}
}

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
{
if (searchCriteria != null)
{
if ((searchCriteria as SeasonSearchCriteria) == null)
if (!searchCriteria.MonitoredEpisodesOnly)
{
_logger.Debug("Skipping monitored check during search");
return Decision.Accept();

View File

@ -17,6 +17,7 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
public Series Series { get; set; }
public List<String> SceneTitles { get; set; }
public List<Episode> Episodes { get; set; }
public virtual bool MonitoredEpisodesOnly { get; set; }
public List<String> QueryTitles
{

View File

@ -4,6 +4,14 @@ namespace NzbDrone.Core.IndexerSearch.Definitions
{
public int SeasonNumber { get; set; }
public override bool MonitoredEpisodesOnly
{
get
{
return true;
}
}
public override string ToString()
{
return string.Format("[{0} : S{1:00}]", Series.Title, SeasonNumber);

View File

@ -115,11 +115,18 @@ namespace NzbDrone.Core.IndexerSearch
{
var episode = sceneSeasonEpisodes.First();
var searchSpec = Get<SingleEpisodeSearchCriteria>(series, sceneSeasonEpisodes.ToList());
searchSpec.SeasonNumber = sceneSeasonEpisodes.Key;
searchSpec.MonitoredEpisodesOnly = true;
if (episode.SceneSeasonNumber.HasValue && episode.SceneEpisodeNumber.HasValue)
{
searchSpec.EpisodeNumber = episode.SceneEpisodeNumber.Value;
}
else
{
searchSpec.EpisodeNumber = episode.EpisodeNumber;
}
var decisions = Dispatch(indexer => indexer.Fetch(searchSpec), searchSpec);
downloadDecisions.AddRange(decisions);