mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 00:32:57 -07:00
commit
6d619003ad
7 changed files with 81 additions and 4 deletions
|
@ -21,5 +21,6 @@ namespace Ombi.Api.Lidarr
|
|||
Task<List<AlbumResponse>> GetAllAlbumsByArtistId(int artistId, string apiKey, string baseUrl);
|
||||
Task<List<MetadataProfile>> GetMetadataProfile(string apiKey, string baseUrl);
|
||||
Task<List<LanguageProfiles>> GetLanguageProfile(string apiKey, string baseUrl);
|
||||
Task<LidarrStatus> Status(string apiKey, string baseUrl);
|
||||
}
|
||||
}
|
|
@ -147,6 +147,13 @@ namespace Ombi.Api.Lidarr
|
|||
return Api.Request<List<MetadataProfile>>(request);
|
||||
}
|
||||
|
||||
public Task<LidarrStatus> Status(string apiKey, string baseUrl)
|
||||
{
|
||||
var request = new Request($"{ApiVersion}/system/status", baseUrl, HttpMethod.Get);
|
||||
AddHeaders(request, apiKey);
|
||||
return Api.Request<LidarrStatus>(request);
|
||||
}
|
||||
|
||||
private void AddHeaders(Request request, string key)
|
||||
{
|
||||
request.AddHeader("X-Api-Key", key);
|
||||
|
|
31
src/Ombi.Api.Lidarr/Models/LidarrStatus.cs
Normal file
31
src/Ombi.Api.Lidarr/Models/LidarrStatus.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
|
||||
namespace Ombi.Api.Lidarr.Models
|
||||
{
|
||||
public class LidarrStatus
|
||||
{
|
||||
public string version { get; set; }
|
||||
public DateTime buildTime { get; set; }
|
||||
public bool isDebug { get; set; }
|
||||
public bool isProduction { get; set; }
|
||||
public bool isAdmin { get; set; }
|
||||
public bool isUserInteractive { get; set; }
|
||||
public string startupPath { get; set; }
|
||||
public string appData { get; set; }
|
||||
public string osName { get; set; }
|
||||
public string osVersion { get; set; }
|
||||
public bool isMonoRuntime { get; set; }
|
||||
public bool isMono { get; set; }
|
||||
public bool isLinux { get; set; }
|
||||
public bool isOsx { get; set; }
|
||||
public bool isWindows { get; set; }
|
||||
public string mode { get; set; }
|
||||
public string branch { get; set; }
|
||||
public string authentication { get; set; }
|
||||
public string sqliteVersion { get; set; }
|
||||
public int migrationVersion { get; set; }
|
||||
public string urlBase { get; set; }
|
||||
public string runtimeVersion { get; set; }
|
||||
public string runtimeName { get; set; }
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ import {
|
|||
IDiscordNotifcationSettings,
|
||||
IEmailNotificationSettings,
|
||||
IEmbyServer,
|
||||
ILidarrSettings,
|
||||
IMattermostNotifcationSettings,
|
||||
IMobileNotificationTestSettings,
|
||||
INewsletterNotificationSettings,
|
||||
|
@ -66,6 +67,10 @@ export class TesterService extends ServiceHelpers {
|
|||
return this.http.post<boolean>(`${this.url}radarr`, JSON.stringify(settings), {headers: this.headers});
|
||||
}
|
||||
|
||||
public lidarrTest(settings: ILidarrSettings): Observable<boolean> {
|
||||
return this.http.post<boolean>(`${this.url}lidarr`, JSON.stringify(settings), {headers: this.headers});
|
||||
}
|
||||
|
||||
public sonarrTest(settings: ISonarrSettings): Observable<boolean> {
|
||||
return this.http.post<boolean>(`${this.url}sonarr`, JSON.stringify(settings), {headers: this.headers});
|
||||
}
|
||||
|
|
|
@ -103,6 +103,13 @@
|
|||
<small *ngIf="form.get('metadataProfileId').hasError('required')" class="error-text">A Metadata profile is required</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="albumFolder" name="albumFolder" formControlName="albumFolder">
|
||||
<label for="albumFolder">Album Folder</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div>
|
||||
|
|
|
@ -124,8 +124,8 @@ export class LidarrComponent implements OnInit {
|
|||
this.notificationService.error("Please check your entered values");
|
||||
return;
|
||||
}
|
||||
const settings = <IRadarrSettings>form.value;
|
||||
this.testerService.radarrTest(settings).subscribe(x => {
|
||||
const settings = <ILidarrSettings>form.value;
|
||||
this.testerService.lidarrTest(settings).subscribe(x => {
|
||||
if (x === true) {
|
||||
this.notificationService.success("Successfully connected to Lidarr!");
|
||||
} else {
|
||||
|
|
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Ombi.Api.CouchPotato;
|
||||
using Ombi.Api.Emby;
|
||||
using Ombi.Api.Lidarr;
|
||||
using Ombi.Api.Plex;
|
||||
using Ombi.Api.Radarr;
|
||||
using Ombi.Api.SickRage;
|
||||
|
@ -38,7 +39,8 @@ namespace Ombi.Controllers.External
|
|||
public TesterController(INotificationService service, IDiscordNotification notification, IEmailNotification emailN,
|
||||
IPushbulletNotification pushbullet, ISlackNotification slack, IPushoverNotification po, IMattermostNotification mm,
|
||||
IPlexApi plex, IEmbyApi emby, IRadarrApi radarr, ISonarrApi sonarr, ILogger<TesterController> log, IEmailProvider provider,
|
||||
ICouchPotatoApi cpApi, ITelegramNotification telegram, ISickRageApi srApi, INewsletterJob newsletter, IMobileNotification mobileNotification)
|
||||
ICouchPotatoApi cpApi, ITelegramNotification telegram, ISickRageApi srApi, INewsletterJob newsletter, IMobileNotification mobileNotification,
|
||||
ILidarrApi lidarrApi)
|
||||
{
|
||||
Service = service;
|
||||
DiscordNotification = notification;
|
||||
|
@ -58,6 +60,7 @@ namespace Ombi.Controllers.External
|
|||
SickRageApi = srApi;
|
||||
Newsletter = newsletter;
|
||||
MobileNotification = mobileNotification;
|
||||
LidarrApi = lidarrApi;
|
||||
}
|
||||
|
||||
private INotificationService Service { get; }
|
||||
|
@ -78,6 +81,7 @@ namespace Ombi.Controllers.External
|
|||
private ISickRageApi SickRageApi { get; }
|
||||
private INewsletterJob Newsletter { get; }
|
||||
private IMobileNotification MobileNotification { get; }
|
||||
private ILidarrApi LidarrApi { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -407,5 +411,27 @@ namespace Ombi.Controllers.External
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost("lidarr")]
|
||||
public async Task<bool> LidarrTest([FromBody] LidarrSettings settings)
|
||||
{
|
||||
try
|
||||
{
|
||||
var status = await LidarrApi.Status(settings.ApiKey, settings.FullUri);
|
||||
if (status != null & status?.version.HasValue() ?? false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.LogError(LoggingEvents.Api, e, "Could not test Mobile Notifications");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue