From 09bf919d4dbf42a07e4e7d630368b7b3fae4d089 Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Wed, 8 May 2019 16:06:14 +0100 Subject: [PATCH] Fixed the broken images on the cards --- .../Engine/V2/MovieSearchEngineV2.cs | 2 +- .../actor/discover-actor.component.ts | 32 ++++++++++++------- .../src/app/discover/discover.component.ts | 2 +- src/Ombi/Controllers/V2/HubController.cs | 1 - 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs index dc558a71b..46b8e0361 100644 --- a/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/V2/MovieSearchEngineV2.cs @@ -231,7 +231,7 @@ namespace Ombi.Core.Engine.V2 { 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 + // Later we run this through the rules engine return result; } diff --git a/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.ts b/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.ts index 36496889b..da132a1c3 100644 --- a/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/actor/discover-actor.component.ts @@ -1,6 +1,6 @@ -import { Component } from "@angular/core"; +import { Component, AfterViewInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; -import { SearchV2Service, RequestService, MessageService } from "../../services"; +import { SearchV2Service } from "../../services"; import { IActorCredits } from "../../interfaces/ISearchTvResultV2"; import { IDiscoverCardResult } from "../interfaces"; import { RequestType } from "../../interfaces"; @@ -9,7 +9,7 @@ import { RequestType } from "../../interfaces"; templateUrl: "./discover-actor.component.html", styleUrls: ["./discover-actor.component.scss"], }) -export class DiscoverActorComponent { +export class DiscoverActorComponent implements AfterViewInit { public actorId: number; public actorCredits: IActorCredits; public loadingFlag: boolean; @@ -17,9 +17,7 @@ export class DiscoverActorComponent { public discoverResults: IDiscoverCardResult[] = []; constructor(private searchService: SearchV2Service, - private route: ActivatedRoute, - private requestService: RequestService, - private messageService: MessageService) { + private route: ActivatedRoute) { this.route.params.subscribe((params: any) => { this.actorId = params.actorId; this.loading(); @@ -30,21 +28,33 @@ export class DiscoverActorComponent { }); } + public async ngAfterViewInit() { + this.discoverResults.forEach((result) => { + this.searchService.getFullMovieDetails(result.id).subscribe(x => { + result.available = x.available; + result.approved = x.approved; + result.rating = x.voteAverage; + result.requested = x.requested; + result.url = x.homepage; + }); + }); + } + private createModel() { this.finishLoading(); this.discoverResults = []; this.actorCredits.cast.forEach(m => { this.discoverResults.push({ - available: false, // TODO - posterPath: `https://image.tmdb.org/t/p/w300/${m.poster_path}`, - requested: false, // TODO + available: false, + posterPath: m.poster_path ? `https://image.tmdb.org/t/p/w300/${m.poster_path}` : "../../../images/default_movie_poster.png", + requested: false, title: m.title, type: RequestType.movie, id: m.id, - url: null, // TODO + url: null, rating: 0, overview: m.overview, - approved: false // TODO + approved: false }); }); } diff --git a/src/Ombi/ClientApp/src/app/discover/discover.component.ts b/src/Ombi/ClientApp/src/app/discover/discover.component.ts index e1935f2f4..b9f977005 100644 --- a/src/Ombi/ClientApp/src/app/discover/discover.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/discover.component.ts @@ -130,7 +130,7 @@ export class DiscoverComponent implements OnInit { this.movies.forEach(m => { tempResults.push({ available: m.available, - posterPath: `https://image.tmdb.org/t/p/w300/${m.posterPath}`, + posterPath: m.posterPath ? `https://image.tmdb.org/t/p/w300/${m.posterPath}` : "../../../images/default_movie_poster.png", requested: m.requested, title: m.title, type: RequestType.movie, diff --git a/src/Ombi/Controllers/V2/HubController.cs b/src/Ombi/Controllers/V2/HubController.cs index 9b6c5fc34..b49226a4e 100644 --- a/src/Ombi/Controllers/V2/HubController.cs +++ b/src/Ombi/Controllers/V2/HubController.cs @@ -2,7 +2,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; -using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Ombi.Attributes; using Ombi.Core.Authentication;