|
|
|
@ -2,6 +2,8 @@ import { Component, OnInit } from "@angular/core";
|
|
|
|
|
import { ActivatedRoute } from "@angular/router";
|
|
|
|
|
import { SearchV2Service } from "../../services";
|
|
|
|
|
import { IMovieCollectionsViewModel } from "../../interfaces/ISearchTvResultV2";
|
|
|
|
|
import { IDiscoverCardResult } from "../interfaces";
|
|
|
|
|
import { RequestType } from "../../interfaces";
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
templateUrl: "./discover-collections.component.html",
|
|
|
|
@ -11,6 +13,9 @@ export class DiscoverCollectionsComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
public collectionId: number;
|
|
|
|
|
public collection: IMovieCollectionsViewModel;
|
|
|
|
|
public loadingFlag: boolean;
|
|
|
|
|
|
|
|
|
|
public discoverResults: IDiscoverCardResult[] = [];
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchV2Service, private route: ActivatedRoute) {
|
|
|
|
|
this.route.params.subscribe((params: any) => {
|
|
|
|
@ -19,6 +24,34 @@ export class DiscoverCollectionsComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async ngOnInit() {
|
|
|
|
|
this.collection = await this.searchService.getMovieCollections(this.collectionId);
|
|
|
|
|
this.loadingFlag = true;
|
|
|
|
|
this.collection = await this.searchService.getMovieCollections(this.collectionId);
|
|
|
|
|
this.createModel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private createModel() {
|
|
|
|
|
this.finishLoading();
|
|
|
|
|
this.collection.collection.forEach(m => {
|
|
|
|
|
this.discoverResults.push({
|
|
|
|
|
available: m.available,
|
|
|
|
|
posterPath: `https://image.tmdb.org/t/p/w300/${m.posterPath}`,
|
|
|
|
|
requested: m.requested,
|
|
|
|
|
title: m.title,
|
|
|
|
|
type: RequestType.movie,
|
|
|
|
|
id: m.id,
|
|
|
|
|
url: `http://www.imdb.com/title/${m.imdbId}/`,
|
|
|
|
|
rating: 0,
|
|
|
|
|
overview: m.overview,
|
|
|
|
|
approved: m.approved
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private loading() {
|
|
|
|
|
this.loadingFlag = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private finishLoading() {
|
|
|
|
|
this.loadingFlag = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|