|
|
@ -24,55 +24,55 @@ export class MovieDetailsComponent {
|
|
|
|
public showAdvanced: boolean; // Set on the UI
|
|
|
|
public showAdvanced: boolean; // Set on the UI
|
|
|
|
|
|
|
|
|
|
|
|
private theMovidDbId: number;
|
|
|
|
private theMovidDbId: number;
|
|
|
|
|
|
|
|
private imdbId: string;
|
|
|
|
|
|
|
|
|
|
|
|
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
|
|
|
|
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
|
|
|
|
private sanitizer: DomSanitizer, private imageService: ImageService,
|
|
|
|
private sanitizer: DomSanitizer, private imageService: ImageService,
|
|
|
|
public dialog: MatDialog, private requestService: RequestService,
|
|
|
|
public dialog: MatDialog, private requestService: RequestService,
|
|
|
|
public messageService: MessageService, private auth: AuthService) {
|
|
|
|
public messageService: MessageService, private auth: AuthService) {
|
|
|
|
this.route.params.subscribe((params: any) => {
|
|
|
|
this.route.params.subscribe((params: any) => {
|
|
|
|
|
|
|
|
debugger;
|
|
|
|
|
|
|
|
if (typeof params.movieDbId === 'string' || params.movieDbId instanceof String) {
|
|
|
|
|
|
|
|
if (params.movieDbId.startsWith("tt")) {
|
|
|
|
|
|
|
|
this.imdbId = params.movieDbId;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
this.theMovidDbId = params.movieDbId;
|
|
|
|
this.theMovidDbId = params.movieDbId;
|
|
|
|
if (params.requestId) {
|
|
|
|
this.load();
|
|
|
|
this.load(+params.requestId);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.load(undefined);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async load(requestId: number|undefined) {
|
|
|
|
public async load() {
|
|
|
|
|
|
|
|
|
|
|
|
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
|
|
|
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
|
|
|
|
|
|
|
|
|
|
|
if (requestId) {
|
|
|
|
if (this.imdbId) {
|
|
|
|
var result = await this.searchService.getFullMovieDetailsByRequestId(requestId);
|
|
|
|
this.searchService.getMovieByImdbId(this.imdbId).subscribe(async x => {
|
|
|
|
this.theMovidDbId = result.id
|
|
|
|
this.movie = x;
|
|
|
|
|
|
|
|
if (this.movie.requestId > 0) {
|
|
|
|
this.movie = result;
|
|
|
|
// Load up this request
|
|
|
|
if (this.movie.requestId > 0) {
|
|
|
|
this.hasRequest = true;
|
|
|
|
// Load up this request
|
|
|
|
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
|
|
|
|
this.hasRequest = true;
|
|
|
|
}
|
|
|
|
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
|
|
|
|
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
|
|
|
|
}
|
|
|
|
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
|
|
|
|
("url(" + x + ")");
|
|
|
|
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
});
|
|
|
|
("url(" + x + ")");
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => {
|
|
|
|
this.searchService.getFullMovieDetails(this.theMovidDbId).subscribe(async x => {
|
|
|
|
this.movie = x;
|
|
|
|
this.movie = x;
|
|
|
|
if (this.movie.requestId > 0) {
|
|
|
|
if (this.movie.requestId > 0) {
|
|
|
|
// Load up this request
|
|
|
|
// Load up this request
|
|
|
|
this.hasRequest = true;
|
|
|
|
this.hasRequest = true;
|
|
|
|
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
|
|
|
|
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
|
|
|
|
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
|
|
|
|
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
|
|
|
|
("url(" + x + ")");
|
|
|
|
("url(" + x + ")");
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public async request() {
|
|
|
|
public async request() {
|
|
|
@ -109,7 +109,7 @@ export class MovieDetailsComponent {
|
|
|
|
public async issue() {
|
|
|
|
public async issue() {
|
|
|
|
const dialogRef = this.dialog.open(NewIssueComponent, {
|
|
|
|
const dialogRef = this.dialog.open(NewIssueComponent, {
|
|
|
|
width: '500px',
|
|
|
|
width: '500px',
|
|
|
|
data: {requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, imdbid: this.movie.imdbId, title: this.movie.title}
|
|
|
|
data: {requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, providerId: this.movie.imdbId ? this.movie.imdbId : this.movie.id, title: this.movie.title}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|