Fixed build

pull/3895/head
Jamie Rees 5 years ago
parent 2fe4c1f456
commit 1829786f8b

@ -1,4 +1,4 @@
import { Component, ViewEncapsulation, Input } from "@angular/core"; import { Component, ViewEncapsulation, Input, OnInit } from "@angular/core";
import { ISearchTvResultV2 } from "../../../../interfaces/ISearchTvResultV2"; import { ISearchTvResultV2 } from "../../../../interfaces/ISearchTvResultV2";
@Component({ @Component({
@ -7,6 +7,17 @@ import { ISearchTvResultV2 } from "../../../../interfaces/ISearchTvResultV2";
selector: "tv-information-panel", selector: "tv-information-panel",
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class TvInformationPanelComponent { export class TvInformationPanelComponent implements OnInit {
@Input() public tv: ISearchTvResultV2; @Input() public tv: ISearchTvResultV2;
public seasonCount: number;
public totalEpisodes: number = 0;
public nextEpisode: any;
public ngOnInit(): void {
this.tv.seasonRequests.forEach(season => {
this.totalEpisodes = this.totalEpisodes + season.episodes.length;
});
this.seasonCount = this.tv.seasonRequests.length;
}
} }

@ -1,5 +1,5 @@
import { Component, ViewEncapsulation } from "@angular/core"; import { Component, ViewEncapsulation } from "@angular/core";
import { ImageService, SearchV2Service, RequestService, MessageService } from "../../../services"; import { ImageService, SearchV2Service, MessageService } from "../../../services";
import { ActivatedRoute } from "@angular/router"; import { ActivatedRoute } from "@angular/router";
import { DomSanitizer } from "@angular/platform-browser"; import { DomSanitizer } from "@angular/platform-browser";
import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2"; import { ISearchTvResultV2 } from "../../../interfaces/ISearchTvResultV2";
@ -16,10 +16,6 @@ export class TvDetailsComponent {
public tv: ISearchTvResultV2; public tv: ISearchTvResultV2;
public fromSearch: boolean; public fromSearch: boolean;
public seasonCount: number;
public totalEpisodes: number = 0;
public nextEpisode: any;
private tvdbId: number; private tvdbId: number;
constructor(private searchService: SearchV2Service, private route: ActivatedRoute, constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
@ -41,12 +37,7 @@ export class TvDetailsComponent {
this.tv = await this.searchService.getTvInfo(this.tvdbId); this.tv = await this.searchService.getTvInfo(this.tvdbId);
} }
this.tv.seasonRequests.forEach(season => { const tvBanner = await this.imageService.getTvBanner(this.tvdbId).toPromise();
this.totalEpisodes = this.totalEpisodes + season.episodes.length;
});
this.seasonCount = this.tv.seasonRequests.length;
const tvBanner = await this.imageService.getTvBanner(this.tvdbId).toPromise();
this.tv.background = this.sanitizer.bypassSecurityTrustStyle("url(" + tvBanner + ")"); this.tv.background = this.sanitizer.bypassSecurityTrustStyle("url(" + tvBanner + ")");
} }

Loading…
Cancel
Save