mirror of https://github.com/Ombi-app/Ombi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.3 KiB
71 lines
2.3 KiB
import { Component, AfterViewInit } from "@angular/core";
|
|
import { ActivatedRoute } from "@angular/router";
|
|
import { SearchV2Service } from "../../../services";
|
|
import { IActorCredits } from "../../../interfaces/ISearchTvResultV2";
|
|
import { IDiscoverCardResult } from "../../interfaces";
|
|
import { RequestType } from "../../../interfaces";
|
|
|
|
@Component({
|
|
templateUrl: "./discover-actor.component.html",
|
|
styleUrls: ["./discover-actor.component.scss"],
|
|
})
|
|
export class DiscoverActorComponent implements AfterViewInit {
|
|
public actorId: number;
|
|
public actorCredits: IActorCredits;
|
|
public loadingFlag: boolean;
|
|
|
|
public discoverResults: IDiscoverCardResult[] = [];
|
|
|
|
constructor(private searchService: SearchV2Service,
|
|
private route: ActivatedRoute) {
|
|
this.route.params.subscribe((params: any) => {
|
|
this.actorId = params.actorId;
|
|
this.loading();
|
|
this.searchService.getMoviesByActor(this.actorId).subscribe(res => {
|
|
this.actorCredits = res;
|
|
this.createModel();
|
|
});
|
|
});
|
|
}
|
|
|
|
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,
|
|
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,
|
|
rating: 0,
|
|
overview: m.overview,
|
|
approved: false,
|
|
imdbid: "",
|
|
});
|
|
});
|
|
}
|
|
|
|
private loading() {
|
|
this.loadingFlag = true;
|
|
}
|
|
|
|
private finishLoading() {
|
|
this.loadingFlag = false;
|
|
}
|
|
}
|