mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-20 21:33:15 -07:00
Nothing to see here. Move along !wip #2313
This commit is contained in:
parent
74a17773cf
commit
2eec6c9c30
7 changed files with 270 additions and 0 deletions
12
src/Ombi.Settings/Settings/Models/External/LidarrSettings.cs
vendored
Normal file
12
src/Ombi.Settings/Settings/Models/External/LidarrSettings.cs
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
using Ombi.Core.Settings.Models.External;
|
||||||
|
|
||||||
|
namespace Ombi.Settings.Settings.Models.External
|
||||||
|
{
|
||||||
|
public class LidarrSettings : ExternalSettings
|
||||||
|
{
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
public string ApiKey { get; set; }
|
||||||
|
public string DefaultQualityProfile { get; set; }
|
||||||
|
public string DefaultRootPath { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -83,6 +83,14 @@ export interface IRadarrSettings extends IExternalSettings {
|
||||||
minimumAvailability: string;
|
minimumAvailability: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ILidarrSettings extends IExternalSettings {
|
||||||
|
enabled: boolean;
|
||||||
|
apiKey: string;
|
||||||
|
defaultQualityProfile: string;
|
||||||
|
defaultRootPath: string;
|
||||||
|
fullRootPath: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface ILandingPageSettings extends ISettings {
|
export interface ILandingPageSettings extends ISettings {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,14 @@ export class SettingsService extends ServiceHelpers {
|
||||||
return this.http.post<boolean>(`${this.url}/Radarr`, JSON.stringify(settings), {headers: this.headers});
|
return this.http.post<boolean>(`${this.url}/Radarr`, JSON.stringify(settings), {headers: this.headers});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getLidarr(): Observable<ILidarrSettings> {
|
||||||
|
return this.http.get<ILidarrSettings>(`${this.url}/Lidarr`, {headers: this.headers});
|
||||||
|
}
|
||||||
|
|
||||||
|
public saveLidarr(settings: ILidarrSettings): Observable<boolean> {
|
||||||
|
return this.http.post<boolean>(`${this.url}/Lidarr`, JSON.stringify(settings), {headers: this.headers});
|
||||||
|
}
|
||||||
|
|
||||||
public getAuthentication(): Observable<IAuthenticationSettings> {
|
public getAuthentication(): Observable<IAuthenticationSettings> {
|
||||||
return this.http.get<IAuthenticationSettings>(`${this.url}/Authentication`, {headers: this.headers});
|
return this.http.get<IAuthenticationSettings>(`${this.url}/Authentication`, {headers: this.headers});
|
||||||
}
|
}
|
||||||
|
|
101
src/Ombi/ClientApp/app/settings/lidarr/lidarr.component.html
Normal file
101
src/Ombi/ClientApp/app/settings/lidarr/lidarr.component.html
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
|
||||||
|
<settings-menu></settings-menu>
|
||||||
|
<div *ngIf="form">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Lidarr Settings</legend>
|
||||||
|
<form novalidate [formGroup]="form" (ngSubmit)="onSubmit(form)" style="padding-top:5%;">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
<input type="checkbox" id="enable" formControlName="enabled" ng-checked="form.enabled">
|
||||||
|
<label for="enable">Enable</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="Ip" class="control-label">Hostname or IP</label>
|
||||||
|
|
||||||
|
<input type="text" class="form-control form-control-custom " id="Ip" name="Ip" placeholder="localhost" formControlName="ip" [ngClass]="{'form-error': form.get('ip').hasError('required')}">
|
||||||
|
<small *ngIf="form.get('ip').hasError('required')" class="error-text">The IP/Hostname is required</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="portNumber" class="control-label">Port</label>
|
||||||
|
|
||||||
|
<input type="text" class="form-control form-control-custom " formControlName="port" id="portNumber" name="Port" placeholder="Port Number" [ngClass]="{'form-error': form.get('port').hasError('required')}">
|
||||||
|
<small *ngIf="form.get('port').hasError('required')" class="error-text">The Port is required</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="ApiKey" class="control-label">API Key</label>
|
||||||
|
|
||||||
|
<input type="text" class="form-control form-control-custom " [ngClass]="{'form-error': form.get('apiKey').hasError('required')}" id="ApiKey" name="ApiKey" formControlName="apiKey">
|
||||||
|
<small *ngIf="form.get('apiKey').hasError('required')" class="error-text">The API Key is required</small>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox">
|
||||||
|
|
||||||
|
<input type="checkbox" id="Ssl" name="Ssl" formControlName="ssl"><label for="Ssl">SSL</label>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="SubDir" class="control-label">Base Url</label>
|
||||||
|
<div>
|
||||||
|
<input type="text" class="form-control form-control-custom" formControlName="subDir" id="SubDir" name="SubDir">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<div>
|
||||||
|
<button (click)="getProfiles(form)" type="button" class="btn btn-primary-outline">Get Quality Profiles <span *ngIf="profilesRunning" class="fa fa-spinner fa-spin"> </span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="select" class="control-label">Quality Profiles</label>
|
||||||
|
<div id="profiles">
|
||||||
|
<select formControlName="defaultQualityProfile" class="form-control form-control-custom" id="select" [ngClass]="{'form-error': form.get('defaultQualityProfile').hasError('required')}">
|
||||||
|
<option *ngFor="let quality of qualities" value="{{quality.id}}">{{quality.name}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<small *ngIf="form.get('defaultQualityProfile').hasError('required')" class="error-text">A Default Quality Profile is required</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div>
|
||||||
|
<button (click)="getRootFolders(form)" type="button" class="btn btn-primary-outline">Get Root Folders <span *ngIf="rootFoldersRunning" class="fa fa-spinner fa-spin"></span></button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="rootFolders" class="control-label">Default Root Folders</label>
|
||||||
|
<div id="rootFolders">
|
||||||
|
<select formControlName="defaultRootPath" class="form-control form-control-custom" [ngClass]="{'form-error': form.get('defaultRootPath').hasError('required')}">
|
||||||
|
<option *ngFor="let folder of rootFolders" value="{{folder.path}}" >{{folder.path}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<small *ngIf="form.get('defaultRootPath').hasError('required')" class="error-text">A Default Root Path is required</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div>
|
||||||
|
<button type="button" [disabled]="form.invalid" (click)="test(form)" class="btn btn-primary-outline">Test Connectivity <span id="spinner"></span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div>
|
||||||
|
<button type="submit" [disabled]="form.invalid" class="btn btn-primary-outline ">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
117
src/Ombi/ClientApp/app/settings/lidarr/lidarr.component.ts
Normal file
117
src/Ombi/ClientApp/app/settings/lidarr/lidarr.component.ts
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
import { Component, OnInit } from "@angular/core";
|
||||||
|
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||||
|
|
||||||
|
import { ILidarrSettings, IMinimumAvailability, IRadarrProfile, IRadarrRootFolder } from "../../interfaces";
|
||||||
|
import { IRadarrSettings } from "../../interfaces";
|
||||||
|
import { RadarrService } from "../../services";
|
||||||
|
import { TesterService } from "../../services";
|
||||||
|
import { NotificationService } from "../../services";
|
||||||
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
templateUrl: "./Lidarr.component.html",
|
||||||
|
})
|
||||||
|
export class LidarrComponent implements OnInit {
|
||||||
|
|
||||||
|
public qualities: IRadarrProfile[];
|
||||||
|
public rootFolders: IRadarrRootFolder[];
|
||||||
|
public minimumAvailabilityOptions: IMinimumAvailability[];
|
||||||
|
public profilesRunning: boolean;
|
||||||
|
public rootFoldersRunning: boolean;
|
||||||
|
public advanced = false;
|
||||||
|
public form: FormGroup;
|
||||||
|
|
||||||
|
constructor(private settingsService: SettingsService,
|
||||||
|
private radarrService: RadarrService,
|
||||||
|
private notificationService: NotificationService,
|
||||||
|
private fb: FormBuilder,
|
||||||
|
private testerService: TesterService) { }
|
||||||
|
|
||||||
|
public ngOnInit() {
|
||||||
|
this.settingsService.getLidarr()
|
||||||
|
.subscribe(x => {
|
||||||
|
|
||||||
|
this.form = this.fb.group({
|
||||||
|
enabled: [x.enabled],
|
||||||
|
apiKey: [x.apiKey, [Validators.required]],
|
||||||
|
defaultQualityProfile: [x.defaultQualityProfile, [Validators.required]],
|
||||||
|
defaultRootPath: [x.defaultRootPath, [Validators.required]],
|
||||||
|
ssl: [x.ssl],
|
||||||
|
subDir: [x.subDir],
|
||||||
|
ip: [x.ip, [Validators.required]],
|
||||||
|
port: [x.port, [Validators.required]],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (x.defaultQualityProfile) {
|
||||||
|
this.getProfiles(this.form);
|
||||||
|
}
|
||||||
|
if (x.defaultRootPath) {
|
||||||
|
this.getRootFolders(this.form);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.qualities = [];
|
||||||
|
this.qualities.push({ name: "Please Select", id: -1 });
|
||||||
|
|
||||||
|
this.rootFolders = [];
|
||||||
|
this.rootFolders.push({ path: "Please Select", id: -1 });
|
||||||
|
}
|
||||||
|
|
||||||
|
public getProfiles(form: FormGroup) {
|
||||||
|
this.profilesRunning = true;
|
||||||
|
this.radarrService.getQualityProfiles(form.value).subscribe(x => {
|
||||||
|
this.qualities = x;
|
||||||
|
this.qualities.unshift({ name: "Please Select", id: -1 });
|
||||||
|
|
||||||
|
this.profilesRunning = false;
|
||||||
|
this.notificationService.success("Successfully retrieved the Quality Profiles");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public getRootFolders(form: FormGroup) {
|
||||||
|
this.rootFoldersRunning = true;
|
||||||
|
this.radarrService.getRootFolders(form.value).subscribe(x => {
|
||||||
|
this.rootFolders = x;
|
||||||
|
this.rootFolders.unshift({ path: "Please Select", id: -1 });
|
||||||
|
|
||||||
|
this.rootFoldersRunning = false;
|
||||||
|
this.notificationService.success("Successfully retrieved the Root Folders");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public test(form: FormGroup) {
|
||||||
|
if (form.invalid) {
|
||||||
|
this.notificationService.error("Please check your entered values");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const settings = <IRadarrSettings>form.value;
|
||||||
|
this.testerService.radarrTest(settings).subscribe(x => {
|
||||||
|
if (x === true) {
|
||||||
|
this.notificationService.success("Successfully connected to Lidarr!");
|
||||||
|
} else {
|
||||||
|
this.notificationService.error("We could not connect to Lidarr!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public onSubmit(form: FormGroup) {
|
||||||
|
if (form.invalid) {
|
||||||
|
this.notificationService.error("Please check your entered values");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(form.controls.defaultQualityProfile.value === "-1" || form.controls.defaultRootPath.value === "Please Select") {
|
||||||
|
this.notificationService.error("Please check your entered values");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const settings = <ILidarrSettings>form.value;
|
||||||
|
this.settingsService.saveLidarr(settings).subscribe(x => {
|
||||||
|
if (x) {
|
||||||
|
this.notificationService.success("Successfully saved Lidarr settings");
|
||||||
|
} else {
|
||||||
|
this.notificationService.success("There was an error when saving the Lidarr settings");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,6 +34,7 @@ import { TelegramComponent } from "./notifications/telegram.component";
|
||||||
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 { RadarrComponent } from "./radarr/radarr.component";
|
import { RadarrComponent } from "./radarr/radarr.component";
|
||||||
|
import { LidarrComponent } from "./lidarr/lidarr.component";
|
||||||
import { SickRageComponent } from "./sickrage/sickrage.component";
|
import { SickRageComponent } from "./sickrage/sickrage.component";
|
||||||
import { SonarrComponent } from "./sonarr/sonarr.component";
|
import { SonarrComponent } from "./sonarr/sonarr.component";
|
||||||
import { UpdateComponent } from "./update/update.component";
|
import { UpdateComponent } from "./update/update.component";
|
||||||
|
@ -71,6 +72,7 @@ const routes: Routes = [
|
||||||
{ path: "Mobile", component: MobileComponent, canActivate: [AuthGuard] },
|
{ path: "Mobile", component: MobileComponent, canActivate: [AuthGuard] },
|
||||||
{ path: "MassEmail", component: MassEmailComponent, canActivate: [AuthGuard] },
|
{ path: "MassEmail", component: MassEmailComponent, canActivate: [AuthGuard] },
|
||||||
{ path: "Newsletter", component: NewsletterComponent, canActivate: [AuthGuard] },
|
{ path: "Newsletter", component: NewsletterComponent, canActivate: [AuthGuard] },
|
||||||
|
{ path: "Lidarr", component: LidarrComponent, canActivate: [AuthGuard] },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -122,6 +124,7 @@ const routes: Routes = [
|
||||||
MobileComponent,
|
MobileComponent,
|
||||||
MassEmailComponent,
|
MassEmailComponent,
|
||||||
NewsletterComponent,
|
NewsletterComponent,
|
||||||
|
LidarrComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
|
|
@ -301,6 +301,27 @@ namespace Ombi.Controllers
|
||||||
return await Get<RadarrSettings>();
|
return await Get<RadarrSettings>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Lidarr Settings.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("lidarr")]
|
||||||
|
public async Task<LidarrSettings> LidarrSettings()
|
||||||
|
{
|
||||||
|
return await Get<LidarrSettings>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Save the Lidarr settings.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="settings">The settings.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("sonarr")]
|
||||||
|
public async Task<bool> LidarrSettings([FromBody]LidarrSettings settings)
|
||||||
|
{
|
||||||
|
return await Save(settings);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save the Authentication settings.
|
/// Save the Authentication settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue