Started on a infinite scroll on the discover page

This commit is contained in:
tidusjar 2019-04-14 22:52:38 +01:00
parent aedc94686b
commit ea54dfa3bf
11 changed files with 111 additions and 96 deletions

View file

@ -98,6 +98,31 @@ namespace Ombi.Core.Engine.V2
return null;
}
/// <summary>
/// Gets popular movies by paging
/// </summary>
/// <returns></returns>
public async Task<IEnumerable<SearchMovieViewModel>> PopularMovies(int currentlyLoaded, int toLoad)
{
var langCode = await DefaultLanguageCode(null);
// Pages of 20
if(toLoad > 20)
{
throw new ApplicationException("Please load less than 20 items at a time due to a API limit");
}
var result = await MovieApi.PopularMovies(langCode);
if (result != null)
{
return await TransformMovieResultsToResponse(result.Shuffle().Take(ResultLimit)); // Take x to stop us overloading the API
}
return null;
}
/// <summary>
/// Gets top rated movies.
/// </summary>