mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Started on a infinite scroll on the discover page
This commit is contained in:
parent
aedc94686b
commit
ea54dfa3bf
11 changed files with 111 additions and 96 deletions
|
@ -15,6 +15,7 @@ namespace Ombi.Core.Engine.Interfaces
|
|||
Task<IEnumerable<SearchMovieViewModel>> NowPlayingMovies();
|
||||
Task<MovieCollectionsViewModel> GetCollection(int collectionId, string langCode = null);
|
||||
Task<int> GetTvDbId(int theMovieDbId);
|
||||
Task<IEnumerable<SearchMovieViewModel>> PopularMovies(int currentlyLoaded, int toLoad);
|
||||
int ResultLimit { get; set; }
|
||||
}
|
||||
}
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue