Fixed the broken images on the cards

pull/3895/head
Jamie Rees 5 years ago
parent fe23a01081
commit 09bf919d4d

@ -231,7 +231,7 @@ namespace Ombi.Core.Engine.V2
{ {
var result = await Cache.GetOrAdd(nameof(GetMoviesByActor) + actorId + langCode, var result = await Cache.GetOrAdd(nameof(GetMoviesByActor) + actorId + langCode,
async () => await MovieApi.GetActorMovieCredits(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; return result;
} }

@ -1,6 +1,6 @@
import { Component } from "@angular/core"; import { Component, AfterViewInit } from "@angular/core";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { SearchV2Service, RequestService, MessageService } from "../../services"; import { SearchV2Service } from "../../services";
import { IActorCredits } from "../../interfaces/ISearchTvResultV2"; import { IActorCredits } from "../../interfaces/ISearchTvResultV2";
import { IDiscoverCardResult } from "../interfaces"; import { IDiscoverCardResult } from "../interfaces";
import { RequestType } from "../../interfaces"; import { RequestType } from "../../interfaces";
@ -9,7 +9,7 @@ import { RequestType } from "../../interfaces";
templateUrl: "./discover-actor.component.html", templateUrl: "./discover-actor.component.html",
styleUrls: ["./discover-actor.component.scss"], styleUrls: ["./discover-actor.component.scss"],
}) })
export class DiscoverActorComponent { export class DiscoverActorComponent implements AfterViewInit {
public actorId: number; public actorId: number;
public actorCredits: IActorCredits; public actorCredits: IActorCredits;
public loadingFlag: boolean; public loadingFlag: boolean;
@ -17,9 +17,7 @@ export class DiscoverActorComponent {
public discoverResults: IDiscoverCardResult[] = []; public discoverResults: IDiscoverCardResult[] = [];
constructor(private searchService: SearchV2Service, constructor(private searchService: SearchV2Service,
private route: ActivatedRoute, private route: ActivatedRoute) {
private requestService: RequestService,
private messageService: MessageService) {
this.route.params.subscribe((params: any) => { this.route.params.subscribe((params: any) => {
this.actorId = params.actorId; this.actorId = params.actorId;
this.loading(); 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() { private createModel() {
this.finishLoading(); this.finishLoading();
this.discoverResults = []; this.discoverResults = [];
this.actorCredits.cast.forEach(m => { this.actorCredits.cast.forEach(m => {
this.discoverResults.push({ this.discoverResults.push({
available: false, // TODO available: false,
posterPath: `https://image.tmdb.org/t/p/w300/${m.poster_path}`, posterPath: m.poster_path ? `https://image.tmdb.org/t/p/w300/${m.poster_path}` : "../../../images/default_movie_poster.png",
requested: false, // TODO requested: false,
title: m.title, title: m.title,
type: RequestType.movie, type: RequestType.movie,
id: m.id, id: m.id,
url: null, // TODO url: null,
rating: 0, rating: 0,
overview: m.overview, overview: m.overview,
approved: false // TODO approved: false
}); });
}); });
} }

@ -130,7 +130,7 @@ export class DiscoverComponent implements OnInit {
this.movies.forEach(m => { this.movies.forEach(m => {
tempResults.push({ tempResults.push({
available: m.available, 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, requested: m.requested,
title: m.title, title: m.title,
type: RequestType.movie, type: RequestType.movie,

@ -2,7 +2,6 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Ombi.Attributes; using Ombi.Attributes;
using Ombi.Core.Authentication; using Ombi.Core.Authentication;

Loading…
Cancel
Save