From b06108fb455464d3206235ba18bdacc90bf5449d Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Fri, 28 Jul 2017 16:59:06 +0200 Subject: [PATCH] Fixed: Older movies (released more than 30 days ago) are now not refreshed as often anymore (every 30 days) --- src/NzbDrone.Core/Tv/Movie.cs | 5 +++++ src/NzbDrone.Core/Tv/ShouldRefreshMovie.cs | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Tv/Movie.cs b/src/NzbDrone.Core/Tv/Movie.cs index 8e22eb096..8bfd0d8c0 100644 --- a/src/NzbDrone.Core/Tv/Movie.cs +++ b/src/NzbDrone.Core/Tv/Movie.cs @@ -109,6 +109,11 @@ namespace NzbDrone.Core.Tv return DateTime.Now >= MinimumAvailabilityDate.AddDays((double)delay); } + public DateTime PhysicalReleaseDate() + { + return PhysicalRelease ?? (InCinemas?.AddDays(90) ?? DateTime.MaxValue); + } + public override string ToString() { return string.Format("[{0}][{1} ({2})]", ImdbId, Title.NullSafe(), Year.NullSafe()); diff --git a/src/NzbDrone.Core/Tv/ShouldRefreshMovie.cs b/src/NzbDrone.Core/Tv/ShouldRefreshMovie.cs index 4b5d650eb..7845b6a04 100644 --- a/src/NzbDrone.Core/Tv/ShouldRefreshMovie.cs +++ b/src/NzbDrone.Core/Tv/ShouldRefreshMovie.cs @@ -34,13 +34,19 @@ namespace NzbDrone.Core.Tv return false; } - if (movie.Status != MovieStatusType.TBA) + if (movie.Status == MovieStatusType.Announced || movie.Status == MovieStatusType.InCinemas) { - _logger.Trace("Movie {0} is announced or released, should refresh.", movie.Title); //We probably have to change this. + _logger.Trace("Movie {0} is announced or in cinemas, should refresh.", movie.Title); //We probably have to change this. return true; } - _logger.Trace("Movie {0} ended long ago, should not be refreshed.", movie.Title); + if (movie.Status == MovieStatusType.Released && movie.PhysicalReleaseDate() >= DateTime.UtcNow.AddDays(-30)) + { + _logger.Trace("Movie {0} is released since less than 30 days, should refresh", movie.Title); + return true; + } + + _logger.Trace("Movie {0} came out long ago, should not be refreshed.", movie.Title); return false; } }