1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

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 @@ public void should_return_false_if_episode_is_not_monitored_for_season_search()
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 @@ public virtual Decision IsSatisfiedBy(RemoteEpisode subject, SearchCriteriaBase
{
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 @@ public abstract class SearchCriteriaBase
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 @@ public class SeasonSearchCriteria : SearchCriteriaBase
{
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 @@ public List<DownloadDecision> SeasonSearch(int seriesId, int seasonNumber)
{
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);