!wip sickrage tester

pull/1741/head
Jamie 7 years ago
parent fa0d68fc16
commit b84f1aa2b6

@ -15,6 +15,7 @@ import {
IPushbulletNotificationSettings,
IPushoverNotificationSettings,
IRadarrSettings,
ISickRageSettings,
ISlackNotificationSettings,
ISonarrSettings,
ITelegramNotifcationSettings,
@ -48,22 +49,32 @@ export class TesterService extends ServiceAuthHelpers {
public emailTest(settings: IEmailNotificationSettings): Observable<boolean> {
return this.http.post(`${this.url}email`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
}
public plexTest(settings: IPlexServer): Observable<boolean> {
return this.http.post(`${this.url}plex`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
}
public embyTest(settings: IEmbyServer): Observable<boolean> {
return this.http.post(`${this.url}emby`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
}
public radarrTest(settings: IRadarrSettings): Observable<boolean> {
return this.http.post(`${this.url}radarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
}
public sonarrTest(settings: ISonarrSettings): Observable<boolean> {
return this.http.post(`${this.url}sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
}
}
public couchPotatoTest(settings: ICouchPotatoSettings): Observable<boolean> {
return this.http.post(`${this.url}couchpotato`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
}
}
public telegramTest(settings: ITelegramNotifcationSettings): Observable<boolean> {
return this.http.post(`${this.url}telegram`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
}
public sickrageTest(settings: ISickRageSettings): Observable<boolean> {
return this.http.post(`${this.url}sickrage`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
}
}

@ -3,9 +3,8 @@ import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { ISonarrProfile, ISonarrRootFolder } from "../../interfaces";
// import { ISickRageSettings } from "../../interfaces";
// import { SonarrService } from "../../services";
// import { TesterService } from "../../services";
import { ISickRageSettings } from "../../interfaces";
import { TesterService } from "../../services";
import { NotificationService } from "../../services";
import { SettingsService } from "../../services";
@ -25,6 +24,7 @@ export class SickRageComponent implements OnInit {
constructor(private settingsService: SettingsService,
private notificationService: NotificationService,
private testerService: TesterService,
private fb: FormBuilder) { }
public ngOnInit() {
@ -49,14 +49,14 @@ export class SickRageComponent implements OnInit {
this.notificationService.error("Please check your entered values");
return;
}
// const settings = <ISickRageSettings>form.value;
// this.testerService.sonarrTest(settings).subscribe(x => {
// if (x) {
// this.notificationService.success("Successfully connected to SickRage!");
// } else {
// this.notificationService.error("We could not connect to SickRage!");
// }
// });
const settings = <ISickRageSettings>form.value;
this.testerService.sickrageTest(settings).subscribe(x => {
if (x) {
this.notificationService.success("Successfully connected to SickRage!");
} else {
this.notificationService.error("We could not connect to SickRage!");
}
});
}
public onSubmit(form: FormGroup) {

@ -8,6 +8,7 @@ using Ombi.Api.CouchPotato;
using Ombi.Api.Emby;
using Ombi.Api.Plex;
using Ombi.Api.Radarr;
using Ombi.Api.SickRage;
using Ombi.Api.Sonarr;
using Ombi.Api.Telegram;
using Ombi.Attributes;
@ -34,24 +35,10 @@ namespace Ombi.Controllers.External
/// <summary>
/// Initializes a new instance of the <see cref="TesterController" /> class.
/// </summary>
/// <param name="service">The service.</param>
/// <param name="notification">The notification.</param>
/// <param name="emailN">The notification.</param>
/// <param name="pushbullet">The pushbullet.</param>
/// <param name="slack">The slack.</param>
/// <param name="plex">The plex.</param>
/// <param name="emby">The emby.</param>
/// <param name="radarr">The radarr.</param>
/// <param name="sonarr">The sonarr.</param>
/// <param name="po">The pushover.</param>
/// <param name="mm">The mattermost.</param>
/// <param name="log">The logger.</param>
/// <param name="provider">The email provider</param>
/// <param name="cpApi">The couch potato API</param>
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)
ICouchPotatoApi cpApi, ITelegramNotification telegram, ISickRageApi srApi)
{
Service = service;
DiscordNotification = notification;
@ -68,6 +55,7 @@ namespace Ombi.Controllers.External
EmailProvider = provider;
CouchPotatoApi = cpApi;
TelegramNotification = telegram;
SickRageApi = srApi;
}
private INotificationService Service { get; }
@ -85,6 +73,7 @@ namespace Ombi.Controllers.External
private ILogger<TesterController> Log { get; }
private IEmailProvider EmailProvider { get; }
private ITelegramNotification TelegramNotification { get; }
private ISickRageApi SickRageApi { get; }
/// <summary>
@ -297,7 +286,7 @@ namespace Ombi.Controllers.External
}
/// <summary>
/// Sends a test message to Slack using the provided settings
/// Sends a test message to Telegram using the provided settings
/// </summary>
/// <param name="settings">The settings.</param>
/// <returns></returns>
@ -310,5 +299,17 @@ namespace Ombi.Controllers.External
return true;
}
/// <summary>
/// Sends a test message to Slack using the provided settings
/// </summary>
/// <param name="settings">The settings.</param>
/// <returns></returns>
[HttpPost("sickrage")]
public async Task<bool> SickRage([FromBody] SickRageSettings settings)
{
settings.Enabled = true;
var result = await SickRageApi.Ping(settings.ApiKey, settings.FullUri);
return result?.data?.pid != null;
}
}
}
Loading…
Cancel
Save