mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-21 05:43:19 -07:00
Fixed the movies page
This commit is contained in:
parent
cc5fb56e7b
commit
e418cbae57
4 changed files with 34 additions and 19 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { NgModule } from "@angular/core";
|
import { NgModule } from "@angular/core";
|
||||||
import { RouterModule, Routes } from "@angular/router";
|
import { RouterModule, Routes } from "@angular/router";
|
||||||
|
|
||||||
import { SearchService, RequestService } from "../services";
|
import { SearchService, RequestService, RadarrService } from "../services";
|
||||||
|
|
||||||
import {CarouselModule} from 'primeng/carousel';
|
import {CarouselModule} from 'primeng/carousel';
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ const routes: Routes = [
|
||||||
providers: [
|
providers: [
|
||||||
SearchService,
|
SearchService,
|
||||||
RequestService,
|
RequestService,
|
||||||
|
RadarrService,
|
||||||
],
|
],
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -36,24 +36,26 @@ export class MovieDetailsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public load() {
|
public load() {
|
||||||
|
|
||||||
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser");
|
||||||
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);
|
||||||
|
|
||||||
if (this.isAdmin) {
|
if (this.isAdmin) {
|
||||||
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
if (await this.radarrService.isRadarrEnabled()) {
|
||||||
this.radarrProfiles = c;
|
this.radarrService.getQualityProfilesFromSettings().subscribe(c => {
|
||||||
this.setQualityOverrides();
|
this.radarrProfiles = c;
|
||||||
});
|
this.setQualityOverrides();
|
||||||
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
});
|
||||||
this.radarrRootFolders = c;
|
this.radarrService.getRootFoldersFromSettings().subscribe(c => {
|
||||||
this.setRootFolderOverrides();
|
this.radarrRootFolders = c;
|
||||||
});
|
this.setRootFolderOverrides();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -83,7 +85,7 @@ export class MovieDetailsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async deny() {
|
public async deny() {
|
||||||
const result = await this.requestService.denyMovie({id: this.theMovidDbId, reason: ""}).toPromise();
|
const result = await this.requestService.denyMovie({ id: this.theMovidDbId, reason: "" }).toPromise();
|
||||||
if (result.result) {
|
if (result.result) {
|
||||||
this.movie.approved = false;
|
this.movie.approved = false;
|
||||||
this.messageService.send(result.message, "Ok");
|
this.messageService.send(result.message, "Ok");
|
||||||
|
@ -93,7 +95,7 @@ export class MovieDetailsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async approve() {
|
public async approve() {
|
||||||
const result = await this.requestService.approveMovie({id: this.theMovidDbId}).toPromise();
|
const result = await this.requestService.approveMovie({ id: this.theMovidDbId }).toPromise();
|
||||||
if (result.result) {
|
if (result.result) {
|
||||||
this.movie.approved = false;
|
this.movie.approved = false;
|
||||||
this.messageService.send(result.message, "Ok");
|
this.messageService.send(result.message, "Ok");
|
||||||
|
|
|
@ -14,16 +14,19 @@ export class RadarrService extends ServiceHelpers {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> {
|
public getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> {
|
||||||
return this.http.post<IRadarrRootFolder[]>(`${this.url}/RootFolders/`, JSON.stringify(settings), {headers: this.headers});
|
return this.http.post<IRadarrRootFolder[]>(`${this.url}/RootFolders/`, JSON.stringify(settings), { headers: this.headers });
|
||||||
}
|
}
|
||||||
public getQualityProfiles(settings: IRadarrSettings): Observable<IRadarrProfile[]> {
|
public getQualityProfiles(settings: IRadarrSettings): Observable<IRadarrProfile[]> {
|
||||||
return this.http.post<IRadarrProfile[]>(`${this.url}/Profiles/`, JSON.stringify(settings), {headers: this.headers});
|
return this.http.post<IRadarrProfile[]>(`${this.url}/Profiles/`, JSON.stringify(settings), { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRootFoldersFromSettings(): Observable<IRadarrRootFolder[]> {
|
public getRootFoldersFromSettings(): Observable<IRadarrRootFolder[]> {
|
||||||
return this.http.get<IRadarrRootFolder[]>(`${this.url}/RootFolders/`, {headers: this.headers});
|
return this.http.get<IRadarrRootFolder[]>(`${this.url}/RootFolders/`, { headers: this.headers });
|
||||||
}
|
}
|
||||||
public getQualityProfilesFromSettings(): Observable<IRadarrProfile[]> {
|
public getQualityProfilesFromSettings(): Observable<IRadarrProfile[]> {
|
||||||
return this.http.get<IRadarrProfile[]>(`${this.url}/Profiles/`, {headers: this.headers});
|
return this.http.get<IRadarrProfile[]>(`${this.url}/Profiles/`, { headers: this.headers });
|
||||||
|
}
|
||||||
|
public isRadarrEnabled(): Promise<boolean> {
|
||||||
|
return this.http.get<boolean>(`${this.url}/enabled/`, { headers: this.headers }).toPromise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,10 @@ namespace Ombi.Controllers.V1.External
|
||||||
{
|
{
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[ApiV1]
|
[ApiV1]
|
||||||
|
[ApiController]
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
public class RadarrController : Controller
|
public class RadarrController : ControllerBase
|
||||||
{
|
{
|
||||||
public RadarrController(IRadarrApi radarr, ISettingsService<RadarrSettings> settings,
|
public RadarrController(IRadarrApi radarr, ISettingsService<RadarrSettings> settings,
|
||||||
ICacheService mem)
|
ICacheService mem)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +40,14 @@ namespace Ombi.Controllers.V1.External
|
||||||
return await RadarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
|
return await RadarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("enabled")]
|
||||||
|
[PowerUser]
|
||||||
|
public async Task<bool> Enabled()
|
||||||
|
{
|
||||||
|
var settings = await RadarrSettings.GetSettingsAsync();
|
||||||
|
return settings.Enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the Radarr root folders.
|
/// Gets the Radarr root folders.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue