From 010c65af9cca201adf58d616076c6a3b1b4bac29 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 1 Feb 2020 13:03:11 -0800 Subject: [PATCH] Fixed: Don't monitor new seasons if series is not monitored Fixes #3547 --- .../TvTests/RefreshSeriesServiceFixture.cs | 20 ++++++++++++++++++- src/NzbDrone.Core/Tv/RefreshSeriesService.cs | 5 +++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs b/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs index fcf7d39e2..d59e30e8d 100644 --- a/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs @@ -54,8 +54,9 @@ namespace NzbDrone.Core.Test.TvTests } [Test] - public void should_monitor_new_seasons_automatically() + public void should_monitor_new_seasons_automatically_if_series_is_monitored() { + _series.Monitored = true; var newSeriesInfo = _series.JsonClone(); newSeriesInfo.Seasons.Add(Builder.CreateNew() .With(s => s.SeasonNumber = 2) @@ -69,6 +70,23 @@ namespace NzbDrone.Core.Test.TvTests .Verify(v => v.UpdateSeries(It.Is(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true), It.IsAny())); } + [Test] + public void should_not_monitor_new_seasons_automatically_if_series_is_not_monitored() + { + _series.Monitored = false; + var newSeriesInfo = _series.JsonClone(); + newSeriesInfo.Seasons.Add(Builder.CreateNew() + .With(s => s.SeasonNumber = 2) + .Build()); + + GivenNewSeriesInfo(newSeriesInfo); + + Subject.Execute(new RefreshSeriesCommand(_series.Id)); + + Mocker.GetMock() + .Verify(v => v.UpdateSeries(It.Is(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == false), It.IsAny())); + } + [Test] public void should_not_monitor_new_special_season_automatically() { diff --git a/src/NzbDrone.Core/Tv/RefreshSeriesService.cs b/src/NzbDrone.Core/Tv/RefreshSeriesService.cs index 4cd6ca656..3828a65f1 100644 --- a/src/NzbDrone.Core/Tv/RefreshSeriesService.cs +++ b/src/NzbDrone.Core/Tv/RefreshSeriesService.cs @@ -130,12 +130,13 @@ namespace NzbDrone.Core.Tv { if (season.SeasonNumber == 0) { + _logger.Debug("Ignoring season 0 for series [{0}] {1} by default", series.TvdbId, series.Title); season.Monitored = false; continue; } - _logger.Debug("New season ({0}) for series: [{1}] {2}, setting monitored to true", season.SeasonNumber, series.TvdbId, series.Title); - season.Monitored = true; + _logger.Debug("New season ({0}) for series: [{1}] {2}, setting monitored to {3}", season.SeasonNumber, series.TvdbId, series.Title, series.Monitored.ToString().ToLowerInvariant()); + season.Monitored = series.Monitored; } else