mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +01:00
Ignore older episodes in latest season
New: Ignore episodes that aired more than 90 days ago when adding with Latest Season Closes #826
This commit is contained in:
parent
9b617af713
commit
4ea5e9ce9b
@ -207,6 +207,22 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeMonitoredServiceTests
|
||||
VerifyNotMonitored(e => e.HasFile);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_monitor_latest_season_if_all_episodes_aired_more_than_90_days_ago()
|
||||
{
|
||||
_episodes.ForEach(e => e.AirDateUtc = DateTime.UtcNow.AddDays(-100));
|
||||
|
||||
var monitoringOptions = new MonitoringOptions
|
||||
{
|
||||
Monitor = MonitorTypes.LatestSeason
|
||||
};
|
||||
|
||||
Subject.SetEpisodeMonitoredStatus(_series, monitoringOptions);
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Verify(v => v.UpdateEpisodes(It.Is<List<Episode>>(l => l.All(e => !e.Monitored))));
|
||||
}
|
||||
|
||||
private void VerifyMonitored(Func<Episode, bool> predicate)
|
||||
{
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
|
@ -77,7 +77,17 @@ namespace NzbDrone.Core.Tv
|
||||
break;
|
||||
|
||||
case MonitorTypes.LatestSeason:
|
||||
|
||||
if (episodes.Where(e => e.SeasonNumber == lastSeason)
|
||||
.All(e => e.AirDateUtc.HasValue && !e.AirDateUtc.Value.InLastDays(90)))
|
||||
{
|
||||
_logger.Debug("[{0}] Unmonitoring all episodes because latest season aired more than 90 days ago", series.Title);
|
||||
ToggleEpisodesMonitoredState(episodes, e => false);
|
||||
break;
|
||||
}
|
||||
|
||||
_logger.Debug("[{0}] Monitoring latest season episodes", series.Title);
|
||||
|
||||
ToggleEpisodesMonitoredState(episodes, e => e.SeasonNumber > 0 && e.SeasonNumber == lastSeason);
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user