mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-13 08:42: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<AlbumResponse>> GetAllAlbumsByArtistId(int artistId, string apiKey, string baseUrl);
|
||||||
Task<List<MetadataProfile>> GetMetadataProfile(string apiKey, string baseUrl);
|
Task<List<MetadataProfile>> GetMetadataProfile(string apiKey, string baseUrl);
|
||||||
Task<List<LanguageProfiles>> GetLanguageProfile(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);
|
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)
|
private void AddHeaders(Request request, string key)
|
||||||
{
|
{
|
||||||
request.AddHeader("X-Api-Key", 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,
|
IDiscordNotifcationSettings,
|
||||||
IEmailNotificationSettings,
|
IEmailNotificationSettings,
|
||||||
IEmbyServer,
|
IEmbyServer,
|
||||||
|
ILidarrSettings,
|
||||||
IMattermostNotifcationSettings,
|
IMattermostNotifcationSettings,
|
||||||
IMobileNotificationTestSettings,
|
IMobileNotificationTestSettings,
|
||||||
INewsletterNotificationSettings,
|
INewsletterNotificationSettings,
|
||||||
|
@ -66,6 +67,10 @@ export class TesterService 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 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> {
|
public sonarrTest(settings: ISonarrSettings): Observable<boolean> {
|
||||||
return this.http.post<boolean>(`${this.url}sonarr`, JSON.stringify(settings), {headers: this.headers});
|
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>
|
<small *ngIf="form.get('metadataProfileId').hasError('required')" class="error-text">A Metadata profile is required</small>
|
||||||
</div>
|
</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 class="form-group">
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -124,8 +124,8 @@ export class LidarrComponent implements OnInit {
|
||||||
this.notificationService.error("Please check your entered values");
|
this.notificationService.error("Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const settings = <IRadarrSettings>form.value;
|
const settings = <ILidarrSettings>form.value;
|
||||||
this.testerService.radarrTest(settings).subscribe(x => {
|
this.testerService.lidarrTest(settings).subscribe(x => {
|
||||||
if (x === true) {
|
if (x === true) {
|
||||||
this.notificationService.success("Successfully connected to Lidarr!");
|
this.notificationService.success("Successfully connected to Lidarr!");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Api.CouchPotato;
|
using Ombi.Api.CouchPotato;
|
||||||
using Ombi.Api.Emby;
|
using Ombi.Api.Emby;
|
||||||
|
using Ombi.Api.Lidarr;
|
||||||
using Ombi.Api.Plex;
|
using Ombi.Api.Plex;
|
||||||
using Ombi.Api.Radarr;
|
using Ombi.Api.Radarr;
|
||||||
using Ombi.Api.SickRage;
|
using Ombi.Api.SickRage;
|
||||||
|
@ -38,7 +39,8 @@ namespace Ombi.Controllers.External
|
||||||
public TesterController(INotificationService service, IDiscordNotification notification, IEmailNotification emailN,
|
public TesterController(INotificationService service, IDiscordNotification notification, IEmailNotification emailN,
|
||||||
IPushbulletNotification pushbullet, ISlackNotification slack, IPushoverNotification po, IMattermostNotification mm,
|
IPushbulletNotification pushbullet, ISlackNotification slack, IPushoverNotification po, IMattermostNotification mm,
|
||||||
IPlexApi plex, IEmbyApi emby, IRadarrApi radarr, ISonarrApi sonarr, ILogger<TesterController> log, IEmailProvider provider,
|
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;
|
Service = service;
|
||||||
DiscordNotification = notification;
|
DiscordNotification = notification;
|
||||||
|
@ -58,6 +60,7 @@ namespace Ombi.Controllers.External
|
||||||
SickRageApi = srApi;
|
SickRageApi = srApi;
|
||||||
Newsletter = newsletter;
|
Newsletter = newsletter;
|
||||||
MobileNotification = mobileNotification;
|
MobileNotification = mobileNotification;
|
||||||
|
LidarrApi = lidarrApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
private INotificationService Service { get; }
|
private INotificationService Service { get; }
|
||||||
|
@ -78,6 +81,7 @@ namespace Ombi.Controllers.External
|
||||||
private ISickRageApi SickRageApi { get; }
|
private ISickRageApi SickRageApi { get; }
|
||||||
private INewsletterJob Newsletter { get; }
|
private INewsletterJob Newsletter { get; }
|
||||||
private IMobileNotification MobileNotification { get; }
|
private IMobileNotification MobileNotification { get; }
|
||||||
|
private ILidarrApi LidarrApi { get; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -407,5 +411,27 @@ namespace Ombi.Controllers.External
|
||||||
return false;
|
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