mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-26 09:47:39 +00:00
Fixed: Don't search for newly added episodes if they aren't monitored
This commit is contained in:
parent
af24456148
commit
4f5c437ddd
2 changed files with 38 additions and 1 deletions
|
@ -24,6 +24,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
|||
{
|
||||
_series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Added = DateTime.UtcNow.AddDays(-7))
|
||||
.With(s => s.Monitored = true)
|
||||
.Build();
|
||||
|
||||
_added = new List<Episode>();
|
||||
|
@ -96,12 +97,36 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
|
|||
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]
|
||||
public void should_search_for_a_newly_added_episode()
|
||||
{
|
||||
GivenUpdated();
|
||||
|
||||
_added.Add(new Episode { AirDateUtc = DateTime.UtcNow });
|
||||
_added.Add(new Episode { AirDateUtc = DateTime.UtcNow, Monitored = true });
|
||||
|
||||
Mocker.GetMock<IProcessDownloadDecisions>()
|
||||
.Setup(s => s.ProcessDecisions(It.IsAny<List<DownloadDecision>>()))
|
||||
|
|
|
@ -113,6 +113,12 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
|
||||
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))
|
||||
{
|
||||
_logger.Debug("Appears to be a new series, skipping search.");
|
||||
|
@ -141,6 +147,12 @@ namespace NzbDrone.Core.IndexerSearch
|
|||
|
||||
foreach (var episode in previouslyAired)
|
||||
{
|
||||
if (!episode.Monitored)
|
||||
{
|
||||
_logger.Debug("Episode is not monitored");
|
||||
continue;
|
||||
}
|
||||
|
||||
var decisions = _nzbSearchService.EpisodeSearch(episode);
|
||||
var processed = _processDownloadDecisions.ProcessDecisions(decisions);
|
||||
|
||||
|
|
Loading…
Reference in a new issue