mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 05:13:18 -07:00
Added the api for getting all movies by actor
This commit is contained in:
parent
08abb53923
commit
f138b28016
3 changed files with 24 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Ombi.Api.TheMovieDb.Models;
|
||||||
using Ombi.Core.Models.Search;
|
using Ombi.Core.Models.Search;
|
||||||
using Ombi.Core.Models.Search.V2;
|
using Ombi.Core.Models.Search.V2;
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ namespace Ombi.Core.Engine.Interfaces
|
||||||
Task<IEnumerable<SearchMovieViewModel>> PopularMovies(int currentlyLoaded, int toLoad);
|
Task<IEnumerable<SearchMovieViewModel>> PopularMovies(int currentlyLoaded, int toLoad);
|
||||||
Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies(int currentlyLoaded, int toLoad);
|
Task<IEnumerable<SearchMovieViewModel>> TopRatedMovies(int currentlyLoaded, int toLoad);
|
||||||
Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies(int currentlyLoaded, int toLoad);
|
Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies(int currentlyLoaded, int toLoad);
|
||||||
|
Task<ActorCredits> GetMoviesByActor(int actorId, string langCode);
|
||||||
int ResultLimit { get; set; }
|
int ResultLimit { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -227,6 +227,14 @@ namespace Ombi.Core.Engine.V2
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ActorCredits> GetMoviesByActor(int actorId, string langCode)
|
||||||
|
{
|
||||||
|
var result = await Cache.GetOrAdd(nameof(GetMoviesByActor) + actorId + langCode,
|
||||||
|
async () => await MovieApi.GetActorMovieCredits(actorId, langCode));
|
||||||
|
//TODO need to run through the rules so we can get the availability etc
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
protected async Task<List<SearchMovieViewModel>> TransformMovieResultsToResponse(
|
protected async Task<List<SearchMovieViewModel>> TransformMovieResultsToResponse(
|
||||||
IEnumerable<MovieSearchResult> movies)
|
IEnumerable<MovieSearchResult> movies)
|
||||||
{
|
{
|
||||||
|
|
|
@ -317,5 +317,19 @@ namespace Ombi.Controllers.V2
|
||||||
{
|
{
|
||||||
return await _tvSearchEngine.Trending(currentPosition, amountToLoad);
|
return await _tvSearchEngine.Trending(currentPosition, amountToLoad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all the movies that is by the actor id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="actorId">TheMovieDb Actor ID</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("actor/{actorId}/movie")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesDefaultResponseType]
|
||||||
|
public async Task<ActorCredits> GetMoviesByActor(int actorId)
|
||||||
|
{
|
||||||
|
return await _movieEngineV2.GetMoviesByActor(actorId, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue