mirror of
https://github.com/Radarr/Radarr
synced 2024-12-27 02:09:59 +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 @@ public void Setup()
|
|||
{
|
||||
_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 @@ public void should_not_search_if_episodes_air_in_the_future()
|
|||
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 @@ public void Execute(MissingEpisodeSearchCommand 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))
|
||||
{
|
||||
_logger.Debug("Appears to be a new series, skipping search.");
|
||||
|
@ -141,6 +147,12 @@ public void Handle(EpisodeInfoRefreshedEvent message)
|
|||
|
||||
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