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.
Ombi/src/Ombi/ClientApp/src/app/media-details/components/tv/panels/tv-information-panel/tv-information-panel.compon...

35 lines
1.3 KiB

import { Component, ViewEncapsulation, Input, OnInit } from "@angular/core";
import { ITvRequests } from "../../../../../interfaces";
import { ITvRatings } from "../../../../../interfaces/IRatings";
import { ISearchTvResultV2 } from "../../../../../interfaces/ISearchTvResultV2";
import { SearchV2Service } from "../../../../../services";
@Component({
templateUrl: "./tv-information-panel.component.html",
styleUrls: ["../../../../media-details.component.scss"],
selector: "tv-information-panel",
encapsulation: ViewEncapsulation.None
})
export class TvInformationPanelComponent implements OnInit {
constructor(private searchService: SearchV2Service) { }
@Input() public tv: ISearchTvResultV2;
@Input() public request: ITvRequests;
@Input() public advancedOptions: boolean;
public ratings: ITvRatings;
public seasonCount: number;
public totalEpisodes: number = 0;
public nextEpisode: any;
public ngOnInit(): void {
this.searchService.getRottenTvRatings(this.tv.title, +this.tv.firstAired.toString().substring(0,4))
.subscribe(x => this.ratings = x);
this.tv.seasonRequests.forEach(season => {
this.totalEpisodes = this.totalEpisodes + season.episodes.length;
});
this.seasonCount = this.tv.seasonRequests.length;
}
}