mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Use Radarr API change feed for changed movies (#4629)
* Use Radarr API change feed for changed movies * Adjust StartTime for cache overlap
This commit is contained in:
parent
5b38edfff9
commit
0a414f37dc
@ -16,7 +16,6 @@
|
||||
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 @@ public SkyHookProxy(IHttpClient httpClient,
|
||||
|
||||
public HashSet<int> GetChangedMovies(DateTime startTime)
|
||||
{
|
||||
var startDate = startTime.ToString("o");
|
||||
// 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 = _movieBuilder.Create()
|
||||
.SetSegment("api", "3")
|
||||
.SetSegment("route", "movie")
|
||||
.SetSegment("id", "")
|
||||
.SetSegment("secondaryRoute", "changes")
|
||||
.AddQueryParam("start_date", startDate)
|
||||
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…
Reference in New Issue
Block a user