Fixed: Don't search for newly added episodes if they aren't monitored
This commit is contained in:
parent
af24456148
commit
4f5c437ddd
|
@ -24,6 +24,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
{
|
{
|
||||||
_series = Builder<Series>.CreateNew()
|
_series = Builder<Series>.CreateNew()
|
||||||
.With(s => s.Added = DateTime.UtcNow.AddDays(-7))
|
.With(s => s.Added = DateTime.UtcNow.AddDays(-7))
|
||||||
|
.With(s => s.Monitored = true)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_added = new List<Episode>();
|
_added = new List<Episode>();
|
||||||
|
@ -96,12 +97,36 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||||
VerifyNoSearch();
|
VerifyNoSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_not_search_if_series_is_not_monitored()
|
||||||
|
{
|
||||||
|
GivenUpdated();
|
||||||
|
|
||||||
|
_series.Monitored = false;
|
||||||
|
|
||||||
|
Subject.Handle(new EpisodeInfoRefreshedEvent(_series, _added, _updated));
|
||||||
|
|
||||||
|
VerifyNoSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void should_not_search_if_episode_is_not_monitored()
|
||||||
|
{
|
||||||
|
GivenUpdated();
|
||||||
|
|
||||||
|
_added.Add(new Episode { AirDateUtc = DateTime.UtcNow, Monitored = false });
|
||||||
|
|
||||||
|
Subject.Handle(new EpisodeInfoRefreshedEvent(_series, _added, _updated));
|
||||||
|
|
||||||
|
VerifyNoSearch();
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_search_for_a_newly_added_episode()
|
public void should_search_for_a_newly_added_episode()
|
||||||
{
|
{
|
||||||
GivenUpdated();
|
GivenUpdated();
|
||||||
|
|
||||||
_added.Add(new Episode { AirDateUtc = DateTime.UtcNow });
|
_added.Add(new Episode { AirDateUtc = DateTime.UtcNow, Monitored = true });
|
||||||
|
|
||||||
Mocker.GetMock<IProcessDownloadDecisions>()
|
Mocker.GetMock<IProcessDownloadDecisions>()
|
||||||
.Setup(s => s.ProcessDecisions(It.IsAny<List<DownloadDecision>>()))
|
.Setup(s => s.ProcessDecisions(It.IsAny<List<DownloadDecision>>()))
|
||||||
|
|
|
@ -113,6 +113,12 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
public void Handle(EpisodeInfoRefreshedEvent message)
|
public void Handle(EpisodeInfoRefreshedEvent message)
|
||||||
{
|
{
|
||||||
|
if (!message.Series.Monitored)
|
||||||
|
{
|
||||||
|
_logger.Debug("Series is not monitored");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (message.Updated.Empty() || message.Series.Added.InLastDays(1))
|
if (message.Updated.Empty() || message.Series.Added.InLastDays(1))
|
||||||
{
|
{
|
||||||
_logger.Debug("Appears to be a new series, skipping search.");
|
_logger.Debug("Appears to be a new series, skipping search.");
|
||||||
|
@ -141,6 +147,12 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
foreach (var episode in previouslyAired)
|
foreach (var episode in previouslyAired)
|
||||||
{
|
{
|
||||||
|
if (!episode.Monitored)
|
||||||
|
{
|
||||||
|
_logger.Debug("Episode is not monitored");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var decisions = _nzbSearchService.EpisodeSearch(episode);
|
var decisions = _nzbSearchService.EpisodeSearch(episode);
|
||||||
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue