|
|
@ -27,8 +27,8 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
public movie: ISearchMovieResultV2;
|
|
|
|
public movie: ISearchMovieResultV2;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchV2Service, private dialog: MatDialog,
|
|
|
|
constructor(private searchService: SearchV2Service, private dialog: MatDialog,
|
|
|
|
private requestService: RequestService, private notification: MatSnackBar,
|
|
|
|
private requestService: RequestService, private notification: MatSnackBar,
|
|
|
|
private router: Router, private sanitizer: DomSanitizer, private imageService: ImageService) { }
|
|
|
|
private router: Router, private sanitizer: DomSanitizer, private imageService: ImageService) { }
|
|
|
|
|
|
|
|
|
|
|
|
public ngOnInit() {
|
|
|
|
public ngOnInit() {
|
|
|
|
if (this.result.type == RequestType.tvShow) {
|
|
|
|
if (this.result.type == RequestType.tvShow) {
|
|
|
@ -40,7 +40,7 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async getExtraTvInfo() {
|
|
|
|
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.setTvDefaults(this.tv);
|
|
|
|
this.updateTvItem(this.tv);
|
|
|
|
this.updateTvItem(this.tv);
|
|
|
|
const creator = this.tv.crew.filter(tv => {
|
|
|
|
const creator = this.tv.crew.filter(tv => {
|
|
|
@ -80,35 +80,33 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private getExtraMovieInfo() {
|
|
|
|
private getExtraMovieInfo() {
|
|
|
|
// if (!this.result.imdbid) {
|
|
|
|
this.searchService.getFullMovieDetails(+this.result.id)
|
|
|
|
this.searchService.getFullMovieDetails(this.result.id)
|
|
|
|
.subscribe(m => {
|
|
|
|
.subscribe(m => {
|
|
|
|
this.movie = m;
|
|
|
|
this.movie = m;
|
|
|
|
this.updateMovieItem(m);
|
|
|
|
this.updateMovieItem(m);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.setMovieBackground()
|
|
|
|
this.setMovieBackground()
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private setMovieBackground(): void {
|
|
|
|
private setMovieBackground(): void {
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
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 + ")");
|
|
|
|
("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 {
|
|
|
|
private setTvBackground(): void {
|
|
|
|
if (this.result.background != null) {
|
|
|
|
if (this.result.background != null) {
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
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 + ")");
|
|
|
|
("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 {
|
|
|
|
} else {
|
|
|
|
this.imageService.getTvBanner(this.result.id).subscribe(x => {
|
|
|
|
this.imageService.getTvBanner(+this.result.id).subscribe(x => {
|
|
|
|
if (x) {
|
|
|
|
if (x) {
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
this.result.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
("linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(" + x + ")");
|
|
|
|
("linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(" + x + ")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private updateMovieItem(updated: ISearchMovieResultV2) {
|
|
|
|
private updateMovieItem(updated: ISearchMovieResultV2) {
|
|
|
|
this.result.url = "http://www.imdb.com/title/" + updated.imdbId + "/";
|
|
|
|
this.result.url = "http://www.imdb.com/title/" + updated.imdbId + "/";
|
|
|
@ -139,7 +137,7 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
public async request() {
|
|
|
|
public async request() {
|
|
|
|
this.requesting = true;
|
|
|
|
this.requesting = true;
|
|
|
|
if (this.result.type === RequestType.movie) {
|
|
|
|
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) {
|
|
|
|
if (result.result) {
|
|
|
|
this.result.requested = true;
|
|
|
|
this.result.requested = true;
|
|
|
@ -148,7 +146,7 @@ export class DiscoverGridComponent implements OnInit {
|
|
|
|
this.notification.open(result.errorMessage, "Ok");
|
|
|
|
this.notification.open(result.errorMessage, "Ok");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (this.result.type === RequestType.tvShow) {
|
|
|
|
} 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;
|
|
|
|
this.requesting = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|