Added the api for getting all movies by actor

pull/3895/head
Jamie Rees 5 years ago
parent 08abb53923
commit f138b28016

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Ombi.Api.TheMovieDb.Models;
using Ombi.Core.Models.Search;
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>> TopRatedMovies(int currentlyLoaded, int toLoad);
Task<IEnumerable<SearchMovieViewModel>> UpcomingMovies(int currentlyLoaded, int toLoad);
Task<ActorCredits> GetMoviesByActor(int actorId, string langCode);
int ResultLimit { get; set; }
}
}

@ -227,6 +227,14 @@ namespace Ombi.Core.Engine.V2
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(
IEnumerable<MovieSearchResult> movies)
{

@ -317,5 +317,19 @@ namespace Ombi.Controllers.V2
{
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…
Cancel
Save