pull/3895/head
TidusJar 6 years ago
parent df9f5cb339
commit 121b242159

@ -68,15 +68,15 @@
</a>
<span class="left-seperator" *ngIf="movie.available">
<a *ngIf="movie.plexUrl" class="media-icons" href="{{movie.plexUrl}}" target="_blank">
<i matTooltip=" {{'Search.ViewOnPlex' | translate}}"
class="fa fa-play-circle fa-2x grow"></i>
</a>
<a *ngIf="movie.plexUrl" class="media-icons" href="{{movie.plexUrl}}" target="_blank">
<i matTooltip=" {{'Search.ViewOnPlex' | translate}}"
class="fa fa-play-circle fa-2x grow"></i>
</a>
<a *ngIf="movie.embyUrl" class="media-icons" href="{{movie.embyUrl}}" target="_blank">
<i matTooltip=" {{'Search.ViewOnEmby' | translate}}"
class="fa fa-play-circle fa-2x grow"></i>
</a>
<a *ngIf="movie.embyUrl" class="media-icons" href="{{movie.embyUrl}}" target="_blank">
<i matTooltip=" {{'Search.ViewOnEmby' | translate}}"
class="fa fa-play-circle fa-2x grow"></i>
</a>
</span>
@ -102,8 +102,13 @@
'Common.Request' | translate }}</button>
</ng-template>
</span>
<span *ngIf="isAdmin && hasRequest"><button mat-raised-button class="btn-spacing" color="warn"
(click)="deny()">{{ 'Requests.Deny' | translate }}</button></span>
<span *ngIf="isAdmin && hasRequest">
<button (click)="approve()" mat-raised-button class="btn-spacing" color="accent">
<i class="fa fa-plus"></i> {{ 'Common.Approve' | translate }}
</button>
<button mat-raised-button class="btn-spacing" color="warn"
(click)="deny()"> <i class="fa fa-times"></i> {{ 'Requests.Deny' | translate }}</button></span>
</div>
</div>

@ -1,12 +1,12 @@
import { Component, ViewEncapsulation } from "@angular/core";
import { ImageService, SearchV2Service, RequestService, MessageService } from "../../services";
import { ImageService, SearchV2Service, RequestService, MessageService, RadarrService } from "../../services";
import { ActivatedRoute } from "@angular/router";
import { DomSanitizer } from "@angular/platform-browser";
import { ISearchMovieResultV2 } from "../../interfaces/ISearchMovieResultV2";
import { MatDialog } from "@angular/material";
import { YoutubeTrailerComponent } from "../youtube-trailer.component";
import { AuthService } from "../../auth/auth.service";
import { IMovieRequests } from "../../interfaces";
import { IMovieRequests, IRadarrProfile, IRadarrRootFolder } from "../../interfaces";
@Component({
templateUrl: "./movie-details.component.html",
@ -18,12 +18,17 @@ export class MovieDetailsComponent {
public hasRequest: boolean;
public movieRequest: IMovieRequests;
public isAdmin: boolean;
public radarrProfiles: IRadarrProfile[];
public radarrRootFolders: IRadarrRootFolder[];
private theMovidDbId: number;
constructor(private searchService: SearchV2Service, private route: ActivatedRoute,
private sanitizer: DomSanitizer, private imageService: ImageService,
public dialog: MatDialog, private requestService: RequestService,
public messageService: MessageService, private auth: AuthService) {
public messageService: MessageService, private auth: AuthService,
private radarrService: RadarrService) {
this.route.params.subscribe((params: any) => {
this.theMovidDbId = params.movieDbId;
this.load();
@ -39,6 +44,18 @@ export class MovieDetailsComponent {
// Load up this request
this.hasRequest = true;
this.movieRequest = await this.requestService.getMovieRequest(this.movie.requestId);
if (this.isAdmin) {
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
this.radarrProfiles = c;
this.setQualityOverrides();
});
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
this.radarrRootFolders = c;
this.setRootFolderOverrides();
});
}
}
this.imageService.getMovieBanner(this.theMovidDbId.toString()).subscribe(x => {
this.movie.background = this.sanitizer.bypassSecurityTrustStyle
@ -74,4 +91,35 @@ export class MovieDetailsComponent {
this.messageService.send(result.errorMessage, "Ok");
}
}
public async approve() {
const result = await this.requestService.approveMovie({id: this.theMovidDbId}).toPromise();
if (result.result) {
this.movie.approved = false;
this.messageService.send(result.message, "Ok");
} else {
this.messageService.send(result.errorMessage, "Ok");
}
}
private setQualityOverrides(): void {
if (this.radarrProfiles) {
const profile = this.radarrProfiles.filter((p) => {
return p.id === this.movieRequest.qualityOverride;
});
if (profile.length > 0) {
this.movieRequest.qualityOverrideTitle = profile[0].name;
}
}
}
private setRootFolderOverrides(): void {
if (this.radarrRootFolders) {
const path = this.radarrRootFolders.filter((folder) => {
return folder.id === this.movieRequest.rootPathOverride;
});
if (path.length > 0) {
this.movieRequest.rootPathOverrideTitle = path[0].path;
}
}
}
}

Loading…
Cancel
Save