mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-04 05:55:09 +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()
|
_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 @@ public void should_not_search_if_episodes_air_in_the_future()
|
||||||
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 @@ public void Execute(MissingEpisodeSearchCommand message)
|
||||||
|
|
||||||
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 @@ public void Handle(EpisodeInfoRefreshedEvent message)
|
||||||
|
|
||||||
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 a new issue