|
|
|
@ -27,8 +27,8 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
|
public movie: ISearchMovieResultV2;
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchV2Service, private dialog: MatDialog,
|
|
|
|
|
private requestService: RequestService, private notification: MatSnackBar,
|
|
|
|
|
private router: Router, private sanitizer: DomSanitizer, private imageService: ImageService) { }
|
|
|
|
|
private requestService: RequestService, private notification: MatSnackBar,
|
|
|
|
|
private router: Router, private sanitizer: DomSanitizer, private imageService: ImageService) { }
|
|
|
|
|
|
|
|
|
|
public ngOnInit() {
|
|
|
|
|
if (this.result.type == RequestType.tvShow) {
|
|
|
|
@ -40,7 +40,7 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async getExtraTvInfo() {
|
|
|
|
|
this.tv = await this.searchService.getTvInfo(this.result.id);
|
|
|
|
|
this.tv = await this.searchService.getTvInfo(+this.result.id);
|
|
|
|
|
this.setTvDefaults(this.tv);
|
|
|
|
|
this.updateTvItem(this.tv);
|
|
|
|
|
const creator = this.tv.crew.filter(tv => {
|
|
|
|
@ -80,35 +80,33 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getExtraMovieInfo() {
|
|
|
|
|
// if (!this.result.imdbid) {
|
|
|
|
|
this.searchService.getFullMovieDetails(this.result.id)
|
|
|
|
|
.subscribe(m => {
|
|
|
|
|
this.movie = m;
|
|
|
|
|
this.updateMovieItem(m);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.setMovieBackground()
|
|
|
|
|
// }
|
|
|
|
|
this.searchService.getFullMovieDetails(+this.result.id)
|
|
|
|
|
.subscribe(m => {
|
|
|
|
|
this.movie = m;
|
|
|
|
|
this.updateMovieItem(m);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.setMovieBackground()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private setMovieBackground(): void {
|
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
|
("linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(" + "https://image.tmdb.org/t/p/original" + this.result.background + ")");
|
|
|
|
|
}
|
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
|
("linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(" + "https://image.tmdb.org/t/p/original" + this.result.background + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private setTvBackground(): void {
|
|
|
|
|
if (this.result.background != null) {
|
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
|
("linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(https://image.tmdb.org/t/p/original" + this.result.background + ")");
|
|
|
|
|
} else {
|
|
|
|
|
this.imageService.getTvBanner(this.result.id).subscribe(x => {
|
|
|
|
|
if (x) {
|
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
|
("linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(" + x + ")");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private setTvBackground(): void {
|
|
|
|
|
if (this.result.background != null) {
|
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
|
("linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(https://image.tmdb.org/t/p/original" + this.result.background + ")");
|
|
|
|
|
} else {
|
|
|
|
|
this.imageService.getTvBanner(+this.result.id).subscribe(x => {
|
|
|
|
|
if (x) {
|
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
|
("linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(" + x + ")");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private updateMovieItem(updated: ISearchMovieResultV2) {
|
|
|
|
|
this.result.url = "http://www.imdb.com/title/" + updated.imdbId + "/";
|
|
|
|
@ -139,7 +137,7 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
|
public async request() {
|
|
|
|
|
this.requesting = true;
|
|
|
|
|
if (this.result.type === RequestType.movie) {
|
|
|
|
|
const result = await this.requestService.requestMovie({ theMovieDbId: this.result.id, languageCode: "", requestOnBehalf: null }).toPromise();
|
|
|
|
|
const result = await this.requestService.requestMovie({ theMovieDbId: +this.result.id, languageCode: "", requestOnBehalf: null }).toPromise();
|
|
|
|
|
|
|
|
|
|
if (result.result) {
|
|
|
|
|
this.result.requested = true;
|
|
|
|
@ -148,7 +146,7 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
|
this.notification.open(result.errorMessage, "Ok");
|
|
|
|
|
}
|
|
|
|
|
} else if (this.result.type === RequestType.tvShow) {
|
|
|
|
|
this.dialog.open(EpisodeRequestComponent, { width: "700px", data: <EpisodeRequestData> { series: this.tv, requestOnBehalf: null }, panelClass: 'modal-panel' })
|
|
|
|
|
this.dialog.open(EpisodeRequestComponent, { width: "700px", data: <EpisodeRequestData>{ series: this.tv, requestOnBehalf: null }, panelClass: 'modal-panel' })
|
|
|
|
|
}
|
|
|
|
|
this.requesting = false;
|
|
|
|
|
}
|
|
|
|
|