mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Added Radarr and Sonarr settings pages #865
This commit is contained in:
parent
34d1309114
commit
ecae241049
9 changed files with 134 additions and 54 deletions
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Ombi.Api.Radarr.Models;
|
using Ombi.Api.Radarr.Models;
|
||||||
|
|
||||||
|
@ -7,9 +6,9 @@ namespace Ombi.Api.Radarr
|
||||||
{
|
{
|
||||||
public interface IRadarrApi
|
public interface IRadarrApi
|
||||||
{
|
{
|
||||||
Task<List<MovieResponse>> GetMovies(string apiKey, Uri baseUrl);
|
Task<List<MovieResponse>> GetMovies(string apiKey, string baseUrl);
|
||||||
Task<List<RadarrProfile>> GetProfiles(string apiKey, Uri baseUrl);
|
Task<List<RadarrProfile>> GetProfiles(string apiKey, string baseUrl);
|
||||||
Task<List<RadarrRootFolder>> GetRootFolders(string apiKey, Uri baseUrl);
|
Task<List<RadarrRootFolder>> GetRootFolders(string apiKey, string baseUrl);
|
||||||
Task<SystemStatus> SystemStatus(string apiKey, Uri baseUrl);
|
Task<SystemStatus> SystemStatus(string apiKey, string baseUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,33 +18,33 @@ namespace Ombi.Api.Radarr
|
||||||
private Api Api { get; }
|
private Api Api { get; }
|
||||||
private ILogger<RadarrApi> Logger { get; }
|
private ILogger<RadarrApi> Logger { get; }
|
||||||
|
|
||||||
public async Task<List<RadarrProfile>> GetProfiles(string apiKey, Uri baseUrl)
|
public async Task<List<RadarrProfile>> GetProfiles(string apiKey, string baseUrl)
|
||||||
{
|
{
|
||||||
var request = new Request(baseUrl.ToString(), "/api/profile", HttpMethod.Get);
|
var request = new Request(baseUrl, "/api/profile", HttpMethod.Get);
|
||||||
|
|
||||||
AddHeaders(request, apiKey);
|
AddHeaders(request, apiKey);
|
||||||
return await Api.Request<List<RadarrProfile>>(request);
|
return await Api.Request<List<RadarrProfile>>(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<RadarrRootFolder>> GetRootFolders(string apiKey, Uri baseUrl)
|
public async Task<List<RadarrRootFolder>> GetRootFolders(string apiKey, string baseUrl)
|
||||||
{
|
{
|
||||||
var request = new Request(baseUrl.ToString(), "/api/rootfolder", HttpMethod.Get);
|
var request = new Request(baseUrl, "/api/rootfolder", HttpMethod.Get);
|
||||||
|
|
||||||
AddHeaders(request, apiKey);
|
AddHeaders(request, apiKey);
|
||||||
return await Api.Request<List<RadarrRootFolder>>(request);
|
return await Api.Request<List<RadarrRootFolder>>(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SystemStatus> SystemStatus(string apiKey, Uri baseUrl)
|
public async Task<SystemStatus> SystemStatus(string apiKey, string baseUrl)
|
||||||
{
|
{
|
||||||
var request = new Request(baseUrl.ToString(), "/api/system/status", HttpMethod.Get);
|
var request = new Request(baseUrl, "/api/system/status", HttpMethod.Get);
|
||||||
AddHeaders(request, apiKey);
|
AddHeaders(request, apiKey);
|
||||||
|
|
||||||
return await Api.Request<SystemStatus>(request);
|
return await Api.Request<SystemStatus>(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<MovieResponse>> GetMovies(string apiKey, Uri baseUrl)
|
public async Task<List<MovieResponse>> GetMovies(string apiKey, string baseUrl)
|
||||||
{
|
{
|
||||||
var request = new Request(baseUrl.ToString(), "/api/movie", HttpMethod.Get);
|
var request = new Request(baseUrl, "/api/movie", HttpMethod.Get);
|
||||||
AddHeaders(request, apiKey);
|
AddHeaders(request, apiKey);
|
||||||
|
|
||||||
return await Api.Request<List<MovieResponse>>(request);
|
return await Api.Request<List<MovieResponse>>(request);
|
||||||
|
|
36
src/Ombi/Controllers/External/RadarrController.cs
vendored
Normal file
36
src/Ombi/Controllers/External/RadarrController.cs
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Ombi.Api.Radarr;
|
||||||
|
using Ombi.Api.Radarr.Models;
|
||||||
|
using Ombi.Attributes;
|
||||||
|
using Ombi.Core.Settings;
|
||||||
|
using Ombi.Settings.Settings.Models.External;
|
||||||
|
|
||||||
|
namespace Ombi.Controllers.External
|
||||||
|
{
|
||||||
|
[Admin]
|
||||||
|
public class RadarrController : BaseV1ApiController
|
||||||
|
{
|
||||||
|
public RadarrController(IRadarrApi radarr, ISettingsService<RadarrSettings> settings)
|
||||||
|
{
|
||||||
|
RadarrApi = radarr;
|
||||||
|
RadarrSettings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IRadarrApi RadarrApi { get; }
|
||||||
|
private ISettingsService<RadarrSettings> RadarrSettings { get; }
|
||||||
|
|
||||||
|
[HttpPost("Profiles")]
|
||||||
|
public async Task<IEnumerable<RadarrProfile>> GetProfiles([FromBody] RadarrSettings settings)
|
||||||
|
{
|
||||||
|
return await RadarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("RootFolders")]
|
||||||
|
public async Task<IEnumerable<RadarrRootFolder>> GetRootFolders([FromBody] RadarrSettings settings)
|
||||||
|
{
|
||||||
|
return await RadarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,6 +55,15 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Update="wwwroot\app\interfaces\ISonarr - Copy.js">
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="wwwroot\app\interfaces\ISonarr - Copy.js.map">
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Update="wwwroot\app\interfaces\ISonarr - Copy.ts">
|
||||||
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
|
</Content>
|
||||||
<Content Update="wwwroot\app\services\applications\sonarr - Copy.service.js">
|
<Content Update="wwwroot\app\services\applications\sonarr - Copy.service.js">
|
||||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
27
src/Ombi/wwwroot/app/interfaces/IRadarr.ts
Normal file
27
src/Ombi/wwwroot/app/interfaces/IRadarr.ts
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
export interface IRadarrRootFolder {
|
||||||
|
id: number,
|
||||||
|
path: string,
|
||||||
|
freespace:number,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IRadarrProfile {
|
||||||
|
name: string,
|
||||||
|
id: number,
|
||||||
|
cutoff: ICutoff,
|
||||||
|
items:IItem[],
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICutoff {
|
||||||
|
id: number,
|
||||||
|
name:string,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IItem {
|
||||||
|
allowed: boolean,
|
||||||
|
quality:IQuality,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IQuality {
|
||||||
|
id: number,
|
||||||
|
name:string,
|
||||||
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { AuthHttp } from 'angular2-jwt';
|
import { AuthHttp } from 'angular2-jwt';
|
||||||
//import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
|
||||||
import { ServiceAuthHelpers } from '../service.helpers';
|
import { ServiceAuthHelpers } from '../service.helpers';
|
||||||
//import { IRadarrSettings } from '../../interfaces/ISettings';
|
import { IRadarrSettings } from '../../interfaces/ISettings';
|
||||||
|
import { IRadarrProfile, IRadarrRootFolder } from '../../interfaces/IRadarr';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class RadarrService extends ServiceAuthHelpers {
|
export class RadarrService extends ServiceAuthHelpers {
|
||||||
|
@ -11,10 +12,10 @@ export class RadarrService extends ServiceAuthHelpers {
|
||||||
super(http, '/api/v1/Radarr');
|
super(http, '/api/v1/Radarr');
|
||||||
}
|
}
|
||||||
|
|
||||||
// getRootFolders(settings: IRadarrSettings): Observable<ISonarrRootFolder[]> {
|
getRootFolders(settings: IRadarrSettings): Observable<IRadarrRootFolder[]> {
|
||||||
// return this.http.post(`${this.url}/RootFolders/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}/RootFolders/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||||
// }
|
}
|
||||||
// getQualityProfiles(settings: IRadarrSettings): Observable<ISonarrProfile[]> {
|
getQualityProfiles(settings: IRadarrSettings): Observable<IRadarrProfile[]> {
|
||||||
// return this.http.post(`${this.url}/Profiles/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}/Profiles/`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||||
// }
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
<div *ngIf="settings">
|
<div *ngIf="settings">
|
||||||
<form class="form-horizontal" method="POST" id="mainForm">
|
<form class="form-horizontal" method="POST" id="mainForm">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Sonarr Settings</legend>
|
<legend>Radarr Settings</legend>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
<input hidden="hidden" name="FullRootPath" id="fullRootPath" value="settings.enable" />
|
<input hidden="hidden" name="FullRootPath" id="fullRootPath" value="settings.enable" />
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="Ip" class="control-label">Sonarr Hostname or IP</label>
|
<label for="Ip" class="control-label">Hostname or IP</label>
|
||||||
<div class="">
|
<div class="">
|
||||||
<input type="text" class="form-control form-control-custom " [(ngModel)]="settings.ip" id="Ip" name="Ip" placeholder="localhost" value="{{settings.ip}}">
|
<input type="text" class="form-control form-control-custom " [(ngModel)]="settings.ip" id="Ip" name="Ip" placeholder="localhost" value="{{settings.ip}}">
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="ApiKey" class="control-label">Sonarr API Key</label>
|
<label for="ApiKey" class="control-label">API Key</label>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" class="form-control form-control-custom " [(ngModel)]="settings.apiKey" id="ApiKey" name="ApiKey" value="{{settings.apiKey}}">
|
<input type="text" class="form-control form-control-custom " [(ngModel)]="settings.apiKey" id="ApiKey" name="ApiKey" value="{{settings.apiKey}}">
|
||||||
</div>
|
</div>
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="SubDir" class="control-label">Sonarr Base Url</label>
|
<label for="SubDir" class="control-label">Base Url</label>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" class="form-control form-control-custom" [(ngModel)]="settings.subDir" id="SubDir" name="SubDir" value="@Model.SubDir">
|
<input type="text" class="form-control form-control-custom" [(ngModel)]="settings.subDir" id="SubDir" name="SubDir" value="@Model.SubDir">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
import { Subject } from 'rxjs/Subject';
|
import { Subject } from 'rxjs/Subject';
|
||||||
import "rxjs/add/operator/takeUntil";
|
import "rxjs/add/operator/takeUntil";
|
||||||
|
|
||||||
import { IRadarrSettings } from '../../interfaces/ISettings'
|
import { IRadarrSettings } from '../../interfaces/ISettings';
|
||||||
import { ISonarrProfile, ISonarrRootFolder } from '../../interfaces/ISonarr'
|
import { IRadarrProfile, IRadarrRootFolder } from '../../interfaces/IRadarr';
|
||||||
import { SettingsService } from '../../services/settings.service';
|
import { SettingsService } from '../../services/settings.service';
|
||||||
// import { RadarrService } from '../../services/applications/radarr.service';
|
import { RadarrService } from '../../services/applications/radarr.service';
|
||||||
import { NotificationService } from "../../services/notification.service";
|
import { NotificationService } from "../../services/notification.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -15,15 +15,15 @@ import { NotificationService } from "../../services/notification.service";
|
||||||
})
|
})
|
||||||
export class RadarrComponent implements OnInit {
|
export class RadarrComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService, /*private radarrService: RadarrService,*/ private notificationService: NotificationService) { }
|
constructor(private settingsService: SettingsService, private radarrService: RadarrService, private notificationService: NotificationService) { }
|
||||||
|
|
||||||
settings: IRadarrSettings;
|
settings: IRadarrSettings;
|
||||||
|
|
||||||
qualities: ISonarrProfile[];
|
qualities: IRadarrProfile[];
|
||||||
rootFolders: ISonarrRootFolder[];
|
rootFolders: IRadarrRootFolder[];
|
||||||
|
|
||||||
selectedRootFolder:ISonarrRootFolder;
|
selectedRootFolder: IRadarrRootFolder;
|
||||||
selectedQuality: ISonarrProfile;
|
selectedQuality: IRadarrProfile;
|
||||||
|
|
||||||
profilesRunning: boolean;
|
profilesRunning: boolean;
|
||||||
rootFoldersRunning: boolean;
|
rootFoldersRunning: boolean;
|
||||||
|
@ -40,23 +40,23 @@ export class RadarrComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
getProfiles() {
|
getProfiles() {
|
||||||
// this.profilesRunning = true;
|
this.profilesRunning = true;
|
||||||
// this.sonarrService.getQualityProfiles(this.settings).subscribe(x => {
|
this.radarrService.getQualityProfiles(this.settings).subscribe(x => {
|
||||||
// this.qualities = x;
|
this.qualities = x;
|
||||||
//
|
|
||||||
// this.profilesRunning = false;
|
this.profilesRunning = false;
|
||||||
// this.notificationService.success("Quality Profiles", "Successfully retrevied the Quality Profiles");
|
this.notificationService.success("Quality Profiles", "Successfully retrevied the Quality Profiles");
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getRootFolders() {
|
getRootFolders() {
|
||||||
// this.rootFoldersRunning = true;
|
this.rootFoldersRunning = true;
|
||||||
// this.sonarrService.getRootFolders(this.settings).subscribe(x => {
|
this.radarrService.getRootFolders(this.settings).subscribe(x => {
|
||||||
// this.rootFolders = x;
|
this.rootFolders = x;
|
||||||
//
|
|
||||||
// this.rootFoldersRunning = false;
|
this.rootFoldersRunning = false;
|
||||||
// this.notificationService.success("Settings Saved", "Successfully retrevied the Root Folders");
|
this.notificationService.success("Settings Saved", "Successfully retrevied the Root Folders");
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
test() {
|
test() {
|
||||||
|
|
|
@ -8,12 +8,15 @@ import { AuthService } from '../auth/auth.service';
|
||||||
import { AuthGuard } from '../auth/auth.guard';
|
import { AuthGuard } from '../auth/auth.guard';
|
||||||
import { AuthModule } from '../auth/auth.module';
|
import { AuthModule } from '../auth/auth.module';
|
||||||
import { SonarrService } from '../services/applications/sonarr.service';
|
import { SonarrService } from '../services/applications/sonarr.service';
|
||||||
|
import { RadarrService } from '../services/applications/radarr.service';
|
||||||
|
|
||||||
import { OmbiComponent } from './ombi/ombi.component'
|
import { OmbiComponent } from './ombi/ombi.component';
|
||||||
import { PlexComponent } from './plex/plex.component'
|
import { PlexComponent } from './plex/plex.component';
|
||||||
import { EmbyComponent } from './emby/emby.component'
|
import { EmbyComponent } from './emby/emby.component';
|
||||||
import { LandingPageComponent } from './landingpage/landingpage.component'
|
import { SonarrComponent } from './sonarr/sonarr.component';
|
||||||
import { CustomizationComponent } from './customization/customization.component'
|
import { RadarrComponent } from './radarr/radarr.component';
|
||||||
|
import { LandingPageComponent } from './landingpage/landingpage.component';
|
||||||
|
import { CustomizationComponent } from './customization/customization.component';
|
||||||
|
|
||||||
import { SettingsMenuComponent } from './settingsmenu.component';
|
import { SettingsMenuComponent } from './settingsmenu.component';
|
||||||
|
|
||||||
|
@ -23,6 +26,8 @@ const routes: Routes = [
|
||||||
{ path: 'Settings/Ombi', component: OmbiComponent, canActivate: [AuthGuard] },
|
{ path: 'Settings/Ombi', component: OmbiComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Plex', component: PlexComponent, canActivate: [AuthGuard] },
|
{ path: 'Settings/Plex', component: PlexComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Emby', component: EmbyComponent, canActivate: [AuthGuard] },
|
{ path: 'Settings/Emby', component: EmbyComponent, canActivate: [AuthGuard] },
|
||||||
|
{ path: 'Settings/Sonarr', component: SonarrComponent, canActivate: [AuthGuard] },
|
||||||
|
{ path: 'Settings/Radarr', component: RadarrComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/LandingPage', component: LandingPageComponent, canActivate: [AuthGuard] },
|
{ path: 'Settings/LandingPage', component: LandingPageComponent, canActivate: [AuthGuard] },
|
||||||
{ path: 'Settings/Customization', component: CustomizationComponent, canActivate: [AuthGuard] },
|
{ path: 'Settings/Customization', component: CustomizationComponent, canActivate: [AuthGuard] },
|
||||||
];
|
];
|
||||||
|
@ -45,6 +50,8 @@ const routes: Routes = [
|
||||||
EmbyComponent,
|
EmbyComponent,
|
||||||
LandingPageComponent,
|
LandingPageComponent,
|
||||||
CustomizationComponent,
|
CustomizationComponent,
|
||||||
|
SonarrComponent,
|
||||||
|
RadarrComponent
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule
|
RouterModule
|
||||||
|
@ -52,6 +59,7 @@ const routes: Routes = [
|
||||||
providers: [
|
providers: [
|
||||||
SonarrService,
|
SonarrService,
|
||||||
AuthService,
|
AuthService,
|
||||||
|
RadarrService,
|
||||||
AuthGuard,
|
AuthGuard,
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue