mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
!wip sickrage tester
This commit is contained in:
parent
fa0d68fc16
commit
b84f1aa2b6
3 changed files with 41 additions and 29 deletions
|
@ -15,6 +15,7 @@ import {
|
||||||
IPushbulletNotificationSettings,
|
IPushbulletNotificationSettings,
|
||||||
IPushoverNotificationSettings,
|
IPushoverNotificationSettings,
|
||||||
IRadarrSettings,
|
IRadarrSettings,
|
||||||
|
ISickRageSettings,
|
||||||
ISlackNotificationSettings,
|
ISlackNotificationSettings,
|
||||||
ISonarrSettings,
|
ISonarrSettings,
|
||||||
ITelegramNotifcationSettings,
|
ITelegramNotifcationSettings,
|
||||||
|
@ -48,22 +49,32 @@ export class TesterService extends ServiceAuthHelpers {
|
||||||
public emailTest(settings: IEmailNotificationSettings): Observable<boolean> {
|
public emailTest(settings: IEmailNotificationSettings): Observable<boolean> {
|
||||||
return this.http.post(`${this.url}email`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}email`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public plexTest(settings: IPlexServer): Observable<boolean> {
|
public plexTest(settings: IPlexServer): Observable<boolean> {
|
||||||
return this.http.post(`${this.url}plex`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}plex`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public embyTest(settings: IEmbyServer): Observable<boolean> {
|
public embyTest(settings: IEmbyServer): Observable<boolean> {
|
||||||
return this.http.post(`${this.url}emby`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}emby`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public radarrTest(settings: IRadarrSettings): Observable<boolean> {
|
public radarrTest(settings: IRadarrSettings): Observable<boolean> {
|
||||||
return this.http.post(`${this.url}radarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}radarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public sonarrTest(settings: ISonarrSettings): Observable<boolean> {
|
public sonarrTest(settings: ISonarrSettings): Observable<boolean> {
|
||||||
return this.http.post(`${this.url}sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}sonarr`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public couchPotatoTest(settings: ICouchPotatoSettings): Observable<boolean> {
|
public couchPotatoTest(settings: ICouchPotatoSettings): Observable<boolean> {
|
||||||
return this.http.post(`${this.url}couchpotato`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
return this.http.post(`${this.url}couchpotato`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public telegramTest(settings: ITelegramNotifcationSettings): Observable<boolean> {
|
public telegramTest(settings: ITelegramNotifcationSettings): Observable<boolean> {
|
||||||
return this.http.post(`${this.url}telegram`, JSON.stringify(settings), { headers: this.headers }).map(this.extractData);
|
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 { ISonarrProfile, ISonarrRootFolder } from "../../interfaces";
|
||||||
|
|
||||||
// import { ISickRageSettings } from "../../interfaces";
|
import { ISickRageSettings } from "../../interfaces";
|
||||||
// import { SonarrService } from "../../services";
|
import { TesterService } from "../../services";
|
||||||
// import { TesterService } from "../../services";
|
|
||||||
import { NotificationService } from "../../services";
|
import { NotificationService } from "../../services";
|
||||||
import { SettingsService } from "../../services";
|
import { SettingsService } from "../../services";
|
||||||
|
|
||||||
|
@ -25,6 +24,7 @@ export class SickRageComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private settingsService: SettingsService,
|
constructor(private settingsService: SettingsService,
|
||||||
private notificationService: NotificationService,
|
private notificationService: NotificationService,
|
||||||
|
private testerService: TesterService,
|
||||||
private fb: FormBuilder) { }
|
private fb: FormBuilder) { }
|
||||||
|
|
||||||
public ngOnInit() {
|
public ngOnInit() {
|
||||||
|
@ -49,14 +49,14 @@ export class SickRageComponent implements OnInit {
|
||||||
this.notificationService.error("Please check your entered values");
|
this.notificationService.error("Please check your entered values");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// const settings = <ISickRageSettings>form.value;
|
const settings = <ISickRageSettings>form.value;
|
||||||
// this.testerService.sonarrTest(settings).subscribe(x => {
|
this.testerService.sickrageTest(settings).subscribe(x => {
|
||||||
// if (x) {
|
if (x) {
|
||||||
// this.notificationService.success("Successfully connected to SickRage!");
|
this.notificationService.success("Successfully connected to SickRage!");
|
||||||
// } else {
|
} else {
|
||||||
// this.notificationService.error("We could not connect to SickRage!");
|
this.notificationService.error("We could not connect to SickRage!");
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public onSubmit(form: FormGroup) {
|
public onSubmit(form: FormGroup) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ using Ombi.Api.CouchPotato;
|
||||||
using Ombi.Api.Emby;
|
using Ombi.Api.Emby;
|
||||||
using Ombi.Api.Plex;
|
using Ombi.Api.Plex;
|
||||||
using Ombi.Api.Radarr;
|
using Ombi.Api.Radarr;
|
||||||
|
using Ombi.Api.SickRage;
|
||||||
using Ombi.Api.Sonarr;
|
using Ombi.Api.Sonarr;
|
||||||
using Ombi.Api.Telegram;
|
using Ombi.Api.Telegram;
|
||||||
using Ombi.Attributes;
|
using Ombi.Attributes;
|
||||||
|
@ -34,24 +35,10 @@ namespace Ombi.Controllers.External
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="TesterController" /> class.
|
/// Initializes a new instance of the <see cref="TesterController" /> class.
|
||||||
/// </summary>
|
/// </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,
|
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)
|
ICouchPotatoApi cpApi, ITelegramNotification telegram, ISickRageApi srApi)
|
||||||
{
|
{
|
||||||
Service = service;
|
Service = service;
|
||||||
DiscordNotification = notification;
|
DiscordNotification = notification;
|
||||||
|
@ -68,6 +55,7 @@ namespace Ombi.Controllers.External
|
||||||
EmailProvider = provider;
|
EmailProvider = provider;
|
||||||
CouchPotatoApi = cpApi;
|
CouchPotatoApi = cpApi;
|
||||||
TelegramNotification = telegram;
|
TelegramNotification = telegram;
|
||||||
|
SickRageApi = srApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
private INotificationService Service { get; }
|
private INotificationService Service { get; }
|
||||||
|
@ -85,6 +73,7 @@ namespace Ombi.Controllers.External
|
||||||
private ILogger<TesterController> Log { get; }
|
private ILogger<TesterController> Log { get; }
|
||||||
private IEmailProvider EmailProvider { get; }
|
private IEmailProvider EmailProvider { get; }
|
||||||
private ITelegramNotification TelegramNotification { get; }
|
private ITelegramNotification TelegramNotification { get; }
|
||||||
|
private ISickRageApi SickRageApi { get; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -297,7 +286,7 @@ namespace Ombi.Controllers.External
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a test message to Slack using the provided settings
|
/// Sends a test message to Telegram using the provided settings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="settings">The settings.</param>
|
/// <param name="settings">The settings.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -310,5 +299,17 @@ namespace Ombi.Controllers.External
|
||||||
return true;
|
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…
Add table
Add a link
Reference in a new issue