1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Fixed: User TMBd lists paging

This commit is contained in:
Robin Dadswell 2021-03-15 18:21:42 +00:00
parent efeb216383
commit 6267497fc0

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using NLog;
using NzbDrone.Common.Http;
@ -15,7 +16,6 @@ public class TMDbUserRequestGenerator : IImportListRequestGenerator
public TMDbUserRequestGenerator()
{
MaxPages = 3;
}
public virtual ImportListPageableRequestChain GetMovies()
@ -55,7 +55,20 @@ private IEnumerable<ImportListRequest> GetMoviesRequests()
requestBuilder.Method = HttpMethod.GET;
yield return new ImportListRequest(requestBuilder.Build());
var jsonResponse = JsonConvert.DeserializeObject<MovieSearchResource>(HttpClient.Execute(requestBuilder.Build()).Content);
MaxPages = jsonResponse.TotalPages;
for (var pageNumber = 1; pageNumber <= MaxPages; pageNumber++)
{
requestBuilder.AddQueryParam("page", pageNumber, true);
var request = requestBuilder.Build();
Logger.Debug($"Importing TMDb movies from: {request.Url}");
yield return new ImportListRequest(request);
}
}
}
}