mirror of
https://github.com/Radarr/Radarr
synced 2025-01-01 21:04:22 +00:00
New: Only Refresh on TMDB Refersh
This commit is contained in:
parent
d2065bfa1b
commit
edcc0ba7ce
3 changed files with 27 additions and 3 deletions
|
@ -9,5 +9,6 @@ public interface IProvideMovieInfo
|
|||
{
|
||||
Movie GetMovieInfo(string ImdbId);
|
||||
Movie GetMovieInfo(int TmdbId, Profile profile, bool hasPreDBEntry);
|
||||
HashSet<int> GetChangedMovies(DateTime startTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,22 @@ public SkyHookProxy(IHttpClient httpClient, IRadarrCloudRequestBuilder requestBu
|
|||
_logger = logger;
|
||||
}
|
||||
|
||||
public HashSet<int> GetChangedMovies (DateTime startTime)
|
||||
{
|
||||
var request = _movieBuilder.Create()
|
||||
.SetSegment("route", "movie")
|
||||
.SetSegment("id", "")
|
||||
.SetSegment("secondaryRoute", "changes")
|
||||
.Build();
|
||||
|
||||
request.AllowAutoRedirect = true;
|
||||
request.SuppressHttpError = true;
|
||||
|
||||
var response = _httpClient.Get<MovieSearchRoot>(request);
|
||||
|
||||
return new HashSet<int>(response.Resource.results.Select(c => c.id));
|
||||
}
|
||||
|
||||
public Movie GetMovieInfo(int TmdbId, Profile profile = null, bool hasPreDBEntry = false)
|
||||
{
|
||||
var langCode = profile != null ? IsoLanguages.Get(profile.Language)?.TwoLetterCode ?? "en" : "en";
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.MediaFiles.Commands;
|
||||
using NzbDrone.Core.MetadataSource.RadarrAPI;
|
||||
using NzbDrone.Core.Movies.AlternativeTitles;
|
||||
using NzbDrone.Core.Movies.Commands;
|
||||
|
@ -219,9 +218,17 @@ public void Execute(RefreshMovieCommand message)
|
|||
{
|
||||
var allMovie = _movieService.GetAllMovies().OrderBy(c => c.SortTitle).ToList();
|
||||
|
||||
var updatedTMDBMovies = new HashSet<int>();
|
||||
|
||||
if (message.LastExecutionTime.HasValue && message.LastExecutionTime.Value.AddDays(14) > DateTime.UtcNow)
|
||||
{
|
||||
// TODO: Should we add some overlap to ensure we get everything?
|
||||
updatedTMDBMovies = _movieInfo.GetChangedMovies(message.LastExecutionTime.Value);
|
||||
}
|
||||
|
||||
foreach (var movie in allMovie)
|
||||
{
|
||||
if (message.Trigger == CommandTrigger.Manual || _checkIfMovieShouldBeRefreshed.ShouldRefresh(movie))
|
||||
if ((updatedTMDBMovies.Count == 0 && _checkIfMovieShouldBeRefreshed.ShouldRefresh(movie)) || updatedTMDBMovies.Contains(movie.TmdbId) || message.Trigger == CommandTrigger.Manual)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue