Use Radarr API change feed for changed movies (#4629)

* Use Radarr API change feed for changed movies

* Adjust StartTime for cache overlap
pull/2/head
Qstick 4 years ago committed by GitHub
parent 5b38edfff9
commit 0a414f37dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -16,7 +16,6 @@ using NzbDrone.Core.Movies;
using NzbDrone.Core.Movies.AlternativeTitles;
using NzbDrone.Core.Movies.Credits;
using NzbDrone.Core.Movies.Translations;
using NzbDrone.Core.NetImport.TMDb;
using NzbDrone.Core.Parser;
namespace NzbDrone.Core.MetadataSource.SkyHook
@ -51,22 +50,21 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
public HashSet<int> GetChangedMovies(DateTime startTime)
{
var startDate = startTime.ToString("o");
var request = _movieBuilder.Create()
.SetSegment("api", "3")
.SetSegment("route", "movie")
.SetSegment("id", "")
.SetSegment("secondaryRoute", "changes")
.AddQueryParam("start_date", startDate)
// Round down to the hour to ensure we cover gap and don't kill cache every call
var cacheAdjustedStart = startTime.AddMinutes(-15);
var startDate = cacheAdjustedStart.Date.AddHours(cacheAdjustedStart.Hour).ToString("s");
var request = _radarrMetadata.Create()
.SetSegment("route", "movie/changed")
.AddQueryParam("since", startDate)
.Build();
request.AllowAutoRedirect = true;
request.SuppressHttpError = true;
var response = _httpClient.Get<MovieSearchResource>(request);
var response = _httpClient.Get<List<int>>(request);
return new HashSet<int>(response.Resource.Results.Select(c => c.Id));
return new HashSet<int>(response.Resource);
}
public Tuple<Movie, List<Credit>> GetMovieInfo(int tmdbId)

Loading…
Cancel
Save