mirror of
https://github.com/Radarr/Radarr.git
synced 2026-03-05 13:21:25 -05:00
Prevent should refresh movie metadata from failing
Fixed: Prevent error checking if movie metadata should be refreshed from failing refresh movies task (cherry picked from commit 3eed84c67938fed308e562e69cf7bcd727063803)
This commit is contained in:
@@ -19,38 +19,48 @@ namespace NzbDrone.Core.Movies
|
||||
|
||||
public bool ShouldRefresh(MovieMetadata movie)
|
||||
{
|
||||
if (movie == null)
|
||||
try
|
||||
{
|
||||
_logger.Warn("Movie metadata does not exist, should not be refreshed.");
|
||||
if (movie == null)
|
||||
{
|
||||
_logger.Warn("Movie metadata does not exist, should not be refreshed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (movie.LastInfoSync < DateTime.UtcNow.AddDays(-180))
|
||||
{
|
||||
_logger.Trace("Movie {0} last updated more than 180 days ago, should refresh.", movie.Title);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (movie.LastInfoSync >= DateTime.UtcNow.AddHours(-12))
|
||||
{
|
||||
_logger.Trace("Movie {0} last updated less than 12 hours ago, should not be refreshed.",
|
||||
movie.Title);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (movie.Status is MovieStatusType.Announced or MovieStatusType.InCinemas)
|
||||
{
|
||||
_logger.Trace("Movie {0} is announced or in cinemas, should refresh.", movie.Title);
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (movie.LastInfoSync < DateTime.UtcNow.AddDays(-180))
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.Trace("Movie {0} last updated more than 180 days ago, should refresh.", movie.Title);
|
||||
_logger.Error(e, "Unable to determine if movie metadata should refresh, will try to refresh.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (movie.LastInfoSync >= DateTime.UtcNow.AddHours(-12))
|
||||
{
|
||||
_logger.Trace("Movie {0} last updated less than 12 hours ago, should not be refreshed.", movie.Title);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (movie.Status == MovieStatusType.Announced || movie.Status == MovieStatusType.InCinemas)
|
||||
{
|
||||
_logger.Trace("Movie {0} is announced or in cinemas, should refresh.", movie.Title);
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user