diff --git a/src/Ombi.Api/Api.cs b/src/Ombi.Api/Api.cs index 19dab7530..e405b6bca 100644 --- a/src/Ombi.Api/Api.cs +++ b/src/Ombi.Api/Api.cs @@ -41,7 +41,7 @@ namespace Ombi.Api { if (!request.IgnoreErrors) { - LogError(request, httpResponseMessage); + await LogError(request, httpResponseMessage); } if (request.Retry) @@ -105,7 +105,7 @@ namespace Ombi.Api { if (!request.IgnoreErrors) { - LogError(request, httpResponseMessage); + await LogError(request, httpResponseMessage); } } // do something with the response @@ -126,7 +126,7 @@ namespace Ombi.Api { if (!request.IgnoreErrors) { - LogError(request, httpResponseMessage); + await LogError(request, httpResponseMessage); } } } @@ -149,10 +149,15 @@ namespace Ombi.Api } } - private void LogError(Request request, HttpResponseMessage httpResponseMessage) + private async Task LogError(Request request, HttpResponseMessage httpResponseMessage) { Logger.LogError(LoggingEvents.Api, $"StatusCode: {httpResponseMessage.StatusCode}, Reason: {httpResponseMessage.ReasonPhrase}, RequestUri: {request.FullUri}"); + if (Logger.IsEnabled(LogLevel.Debug)) + { + var content = await httpResponseMessage.Content.ReadAsStringAsync(); + Logger.LogDebug(content); + } } } } diff --git a/src/Ombi.Core/Engine/MovieSearchEngine.cs b/src/Ombi.Core/Engine/MovieSearchEngine.cs index a82feb28a..dda58348f 100644 --- a/src/Ombi.Core/Engine/MovieSearchEngine.cs +++ b/src/Ombi.Core/Engine/MovieSearchEngine.cs @@ -197,15 +197,16 @@ namespace Ombi.Core.Engine private async Task ProcessSingleMovie(SearchMovieViewModel viewMovie, bool lookupExtraInfo = false) { - if (lookupExtraInfo) + if (lookupExtraInfo && viewMovie.ImdbId.IsNullOrEmpty()) { var showInfo = await MovieApi.GetMovieInformation(viewMovie.Id); viewMovie.Id = showInfo.Id; // TheMovieDbId viewMovie.ImdbId = showInfo.ImdbId; - var usDates = viewMovie.ReleaseDates?.Results?.FirstOrDefault(x => x.IsoCode == "US"); - viewMovie.DigitalReleaseDate = usDates?.ReleaseDate?.FirstOrDefault(x => x.Type == ReleaseDateType.Digital)?.ReleaseDate; } + var usDates = viewMovie.ReleaseDates?.Results?.FirstOrDefault(x => x.IsoCode == "US"); + viewMovie.DigitalReleaseDate = usDates?.ReleaseDate?.FirstOrDefault(x => x.Type == ReleaseDateType.Digital)?.ReleaseDate; + viewMovie.TheMovieDbId = viewMovie.Id.ToString(); await RunSearchRules(viewMovie); diff --git a/src/Ombi.Store/Context/SettingsContext.cs b/src/Ombi.Store/Context/SettingsContext.cs index af5c91d20..6a53e598f 100644 --- a/src/Ombi.Store/Context/SettingsContext.cs +++ b/src/Ombi.Store/Context/SettingsContext.cs @@ -66,5 +66,10 @@ namespace Ombi.Store.Context SaveChanges(); } + + ~SettingsContext() + { + + } } } \ No newline at end of file diff --git a/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs b/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs index 34875a50f..79ccc5bb7 100644 --- a/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs +++ b/src/Ombi.TheMovieDbApi/TheMovieDbApi.cs @@ -56,9 +56,8 @@ namespace Ombi.Api.TheMovieDb public async Task GetActorMovieCredits(int actorId, string langCode) { - var request = new Request($"search/person", BaseUri, HttpMethod.Get); + var request = new Request($"person/{actorId}/movie_credits", BaseUri, HttpMethod.Get); request.FullUri = request.FullUri.AddQueryParameter("api_key", ApiToken); - request.FullUri = request.FullUri.AddQueryParameter("person_id", actorId.ToString()); request.FullUri = request.FullUri.AddQueryParameter("language", langCode); var result = await Api.Request(request); diff --git a/src/Ombi/ClientApp/app/requests/remainingrequests.component.ts b/src/Ombi/ClientApp/app/requests/remainingrequests.component.ts index bf43b7330..b7d23a3df 100644 --- a/src/Ombi/ClientApp/app/requests/remainingrequests.component.ts +++ b/src/Ombi/ClientApp/app/requests/remainingrequests.component.ts @@ -23,17 +23,11 @@ export class RemainingRequestsComponent implements OnInit { } public ngOnInit() { - const self = this; - this.update(); - this.quotaRefreshEvents.subscribe(() => { + this.quotaRefreshEvents.subscribe(() => { this.update(); }); - - setInterval(() => { - self.update(); - }, 60000); } public update(): void { @@ -43,7 +37,6 @@ export class RemainingRequestsComponent implements OnInit { this.calculateTime(); } }); - if (this.movie) { this.requestService.getRemainingMovieRequests().subscribe(callback); } diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.html b/src/Ombi/ClientApp/app/search/moviesearch.component.html index bc30a1fff..7d8a4653a 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.html +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.html @@ -27,28 +27,35 @@
-
-
- - +
+
+ + -
+
+ + +
+
+ +
+ +
+
+
- -
-
- -
- -
-
- +
+
+
+ + +
-
+
+
@@ -70,7 +77,8 @@
- poster + poster
diff --git a/src/Ombi/ClientApp/app/search/moviesearch.component.ts b/src/Ombi/ClientApp/app/search/moviesearch.component.ts index 8c82b58fd..90502bb93 100644 --- a/src/Ombi/ClientApp/app/search/moviesearch.component.ts +++ b/src/Ombi/ClientApp/app/search/moviesearch.component.ts @@ -27,6 +27,7 @@ export class MovieSearchComponent implements OnInit { public searchApplied = false; public refineSearchEnabled = false; public searchYear?: number; + public actorSearch: boolean; public selectedLanguage: string; public langauges: ILanguageRefine[]; @@ -204,7 +205,7 @@ export class MovieSearchComponent implements OnInit { } val.background = this.sanitizer.bypassSecurityTrustStyle ("url(" + "https://image.tmdb.org/t/p/w1280" + val.backdropPath + ")"); - + if (this.applyRefinedSearch) { this.searchService.getMovieInformationWithRefined(val.id, this.selectedLanguage) .subscribe(m => { @@ -212,9 +213,9 @@ export class MovieSearchComponent implements OnInit { }); } else { this.searchService.getMovieInformation(val.id) - .subscribe(m => { - this.updateItem(val, m); - }); + .subscribe(m => { + this.updateItem(val, m); + }); } }); } @@ -239,14 +240,25 @@ export class MovieSearchComponent implements OnInit { return; } if (this.refineOpen) { - this.searchService.searchMovieWithRefined(this.searchText, this.searchYear, this.selectedLanguage) - .subscribe(x => { - this.movieResults = x; - this.searchApplied = true; - // Now let's load some extra info including IMDB Id - // This way the search is fast at displaying results. - this.getExtraInfo(); - }); + if (!this.actorSearch) { + this.searchService.searchMovieWithRefined(this.searchText, this.searchYear, this.selectedLanguage) + .subscribe(x => { + this.movieResults = x; + this.searchApplied = true; + // Now let's load some extra info including IMDB Id + // This way the search is fast at displaying results. + this.getExtraInfo(); + }); + } else { + this.searchService.searchMovieByActor(this.searchText, this.selectedLanguage) + .subscribe(x => { + this.movieResults = x; + this.searchApplied = true; + // Now let's load some extra info including IMDB Id + // This way the search is fast at displaying results. + this.getExtraInfo(); + }); + } } else { this.searchService.searchMovie(this.searchText) .subscribe(x => { diff --git a/src/Ombi/ClientApp/app/services/search.service.ts b/src/Ombi/ClientApp/app/services/search.service.ts index a0abd6d24..5379e23e7 100644 --- a/src/Ombi/ClientApp/app/services/search.service.ts +++ b/src/Ombi/ClientApp/app/services/search.service.ts @@ -49,6 +49,10 @@ export class SearchService extends ServiceHelpers { return this.http.post(`${this.url}/Movie/info`, { theMovieDbId, languageCode: langCode }); } + public searchMovieByActor(searchTerm: string, langCode: string): Observable { + return this.http.post(`${this.url}/Movie/Actor`, { searchTerm, languageCode: langCode }); + } + // TV public searchTv(searchTerm: string): Observable { return this.http.get(`${this.url}/Tv/${searchTerm}`, { headers: this.headers }); diff --git a/src/Ombi/Controllers/SearchController.cs b/src/Ombi/Controllers/SearchController.cs index 872a3305e..08f889f08 100644 --- a/src/Ombi/Controllers/SearchController.cs +++ b/src/Ombi/Controllers/SearchController.cs @@ -51,6 +51,25 @@ namespace Ombi.Controllers } } + /// + /// Searches for movies by a certain actor. + /// + /// The refinement model, language code and year are both optional. Language code uses ISO 639-1 + /// + [HttpPost("movie/actor")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + [ProducesDefaultResponseType] + public async Task SearchActor([FromBody] SearchMovieRefineModel model) + { + if (model == null) + { + return BadRequest(); + } + + return Json(await MovieEngine.SearchActor(model.SearchTerm, model.LanguageCode)); + } + /// /// Searches for a movie. ///