|
|
@ -1,7 +1,7 @@
|
|
|
|
import { Component, OnInit, Input } from "@angular/core";
|
|
|
|
import { Component, OnInit, Input } from "@angular/core";
|
|
|
|
import { IDiscoverCardResult } from "../../interfaces";
|
|
|
|
import { IDiscoverCardResult } from "../../interfaces";
|
|
|
|
import { RequestType } from "../../../interfaces";
|
|
|
|
import { RequestType } from "../../../interfaces";
|
|
|
|
import { SearchV2Service } from "../../../services";
|
|
|
|
import { SearchService, SearchV2Service } from "../../../services";
|
|
|
|
import { MatDialog } from "@angular/material/dialog";
|
|
|
|
import { MatDialog } from "@angular/material/dialog";
|
|
|
|
import { DiscoverCardDetailsComponent } from "./discover-card-details.component";
|
|
|
|
import { DiscoverCardDetailsComponent } from "./discover-card-details.component";
|
|
|
|
import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2";
|
|
|
|
import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2";
|
|
|
@ -18,7 +18,7 @@ export class DiscoverCardComponent implements OnInit {
|
|
|
|
public RequestType = RequestType;
|
|
|
|
public RequestType = RequestType;
|
|
|
|
public hide: boolean;
|
|
|
|
public hide: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchV2Service, private dialog: MatDialog) { }
|
|
|
|
constructor(private searchService: SearchV2Service, private v1Search: SearchService, private dialog: MatDialog) { }
|
|
|
|
|
|
|
|
|
|
|
|
public ngOnInit() {
|
|
|
|
public ngOnInit() {
|
|
|
|
if (this.result.type == RequestType.tvShow) {
|
|
|
|
if (this.result.type == RequestType.tvShow) {
|
|
|
@ -27,6 +27,9 @@ export class DiscoverCardComponent implements OnInit {
|
|
|
|
if (this.result.type == RequestType.movie) {
|
|
|
|
if (this.result.type == RequestType.movie) {
|
|
|
|
this.getExtraMovieInfo();
|
|
|
|
this.getExtraMovieInfo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (this.result.type == RequestType.album) {
|
|
|
|
|
|
|
|
this.getAlbumInformation();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public openDetails(details: IDiscoverCardResult) {
|
|
|
|
public openDetails(details: IDiscoverCardResult) {
|
|
|
@ -35,9 +38,9 @@ export class DiscoverCardComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
public async getExtraTvInfo() {
|
|
|
|
public async getExtraTvInfo() {
|
|
|
|
if (this.result.tvMovieDb) {
|
|
|
|
if (this.result.tvMovieDb) {
|
|
|
|
var result = await this.searchService.getTvInfoWithMovieDbId(this.result.id);
|
|
|
|
var result = await this.searchService.getTvInfoWithMovieDbId(+this.result.id);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var result = await this.searchService.getTvInfo(this.result.id);
|
|
|
|
var result = await this.searchService.getTvInfo(+this.result.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(result.status === "404") {
|
|
|
|
if(result.status === "404") {
|
|
|
|
this.hide = true;
|
|
|
|
this.hide = true;
|
|
|
@ -48,6 +51,34 @@ export class DiscoverCardComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async getAlbumInformation() {
|
|
|
|
|
|
|
|
this.searchService.getArtistInformation(this.result.id.toString()).subscribe(x => {
|
|
|
|
|
|
|
|
if (x.poster) {
|
|
|
|
|
|
|
|
this.result.posterPath = x.poster;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.searchService.getReleaseGroupArt(this.result.id.toString()).subscribe(art => {
|
|
|
|
|
|
|
|
if(art.image) {
|
|
|
|
|
|
|
|
this.result.posterPath = art.image;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.result.title = x.startYear ? `${x.name} (${x.startYear})` : x.name;
|
|
|
|
|
|
|
|
this.result.overview = x.overview;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public generateDetailsLink(): string {
|
|
|
|
|
|
|
|
let link = "";
|
|
|
|
|
|
|
|
switch(this.result.type){
|
|
|
|
|
|
|
|
case RequestType.movie:
|
|
|
|
|
|
|
|
return `/details/movie/${this.result.id}`;
|
|
|
|
|
|
|
|
case RequestType.tvShow:
|
|
|
|
|
|
|
|
return `/details/tv/${this.result.id}`;
|
|
|
|
|
|
|
|
case RequestType.album: //Actually artist
|
|
|
|
|
|
|
|
return `/details/artist/${this.result.id}`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public getStatusClass(): string {
|
|
|
|
public getStatusClass(): string {
|
|
|
|
if (this.result.available) {
|
|
|
|
if (this.result.available) {
|
|
|
|
return "available";
|
|
|
|
return "available";
|
|
|
@ -76,7 +107,7 @@ export class DiscoverCardComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
|
|
private getExtraMovieInfo() {
|
|
|
|
private getExtraMovieInfo() {
|
|
|
|
if (!this.result.imdbid) {
|
|
|
|
if (!this.result.imdbid) {
|
|
|
|
this.searchService.getFullMovieDetails(this.result.id)
|
|
|
|
this.searchService.getFullMovieDetails(+this.result.id)
|
|
|
|
.subscribe(m => {
|
|
|
|
.subscribe(m => {
|
|
|
|
this.updateMovieItem(m);
|
|
|
|
this.updateMovieItem(m);
|
|
|
|
});
|
|
|
|
});
|
|
|
|