diff --git a/src/Ombi.Core/Engine/Interfaces/IMovieEngineV2.cs b/src/Ombi.Core/Engine/Interfaces/IMovieEngineV2.cs index 20b5db148..34cdd2590 100644 --- a/src/Ombi.Core/Engine/Interfaces/IMovieEngineV2.cs +++ b/src/Ombi.Core/Engine/Interfaces/IMovieEngineV2.cs @@ -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> PopularMovies(int currentlyLoaded, int toLoad); Task> TopRatedMovies(int currentlyLoaded, int toLoad); Task> UpcomingMovies(int currentlyLoaded, int toLoad); + Task GetMoviesByActor(int actorId, string langCode); int ResultLimit { get; set; } } } \ No newline at end of file diff --git a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs index a6f185eb3..dc558a71b 100644 --- a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs @@ -227,6 +227,14 @@ namespace Ombi.Core.Engine.V2 return null; } + public async Task 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> TransformMovieResultsToResponse( IEnumerable movies) { diff --git a/src/Ombi/Controllers/V2/SearchController.cs b/src/Ombi/Controllers/V2/SearchController.cs index b898f98c2..a2ee31a3a 100644 --- a/src/Ombi/Controllers/V2/SearchController.cs +++ b/src/Ombi/Controllers/V2/SearchController.cs @@ -317,5 +317,19 @@ namespace Ombi.Controllers.V2 { return await _tvSearchEngine.Trending(currentPosition, amountToLoad); } + + + /// + /// Returns all the movies that is by the actor id + /// + /// TheMovieDb Actor ID + /// + [HttpGet("actor/{actorId}/movie")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesDefaultResponseType] + public async Task GetMoviesByActor(int actorId) + { + return await _movieEngineV2.GetMoviesByActor(actorId, null); + } } } \ No newline at end of file