mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-07 13:41:13 -07:00
Added the api and settings page for Sickrage. Just need to do the tester and hook it up #40
This commit is contained in:
parent
1ebf80d1d1
commit
803b12da0f
12 changed files with 399 additions and 5 deletions
|
@ -54,6 +54,7 @@ namespace PlexRequests.UI.Modules
|
|||
private ISettingsService<AuthenticationSettings> AuthService { get; }
|
||||
private ISettingsService<PlexSettings> PlexService { get; }
|
||||
private ISettingsService<SonarrSettings> SonarrService { get; }
|
||||
private ISettingsService<SickRageSettings> SickRageService { get; }
|
||||
private ISettingsService<EmailNotificationSettings> EmailService { get; }
|
||||
private ISettingsService<PushbulletNotificationSettings> PushbulletService { get; }
|
||||
private IPlexApi PlexApi { get; }
|
||||
|
@ -67,6 +68,7 @@ namespace PlexRequests.UI.Modules
|
|||
ISettingsService<AuthenticationSettings> auth,
|
||||
ISettingsService<PlexSettings> plex,
|
||||
ISettingsService<SonarrSettings> sonarr,
|
||||
ISettingsService<SickRageSettings> sickrage,
|
||||
ISonarrApi sonarrApi,
|
||||
ISettingsService<EmailNotificationSettings> email,
|
||||
IPlexApi plexApi,
|
||||
|
@ -85,6 +87,7 @@ namespace PlexRequests.UI.Modules
|
|||
PushbulletService = pbSettings;
|
||||
PushbulletApi = pbApi;
|
||||
CpApi = cpApi;
|
||||
SickRageService = sickrage;
|
||||
|
||||
#if !DEBUG
|
||||
this.RequiresAuthentication();
|
||||
|
@ -109,6 +112,9 @@ namespace PlexRequests.UI.Modules
|
|||
Get["/sonarr"] = _ => Sonarr();
|
||||
Post["/sonarr"] = _ => SaveSonarr();
|
||||
|
||||
Get["/sickrage"] = _ => Sickrage();
|
||||
Post["/sickrage"] = _ => SaveSickrage();
|
||||
|
||||
Post["/sonarrprofiles"] = _ => GetSonarrQualityProfiles();
|
||||
Post["/cpprofiles"] = _ => GetCpProfiles();
|
||||
|
||||
|
@ -283,7 +289,11 @@ namespace PlexRequests.UI.Modules
|
|||
{
|
||||
return Response.AsJson(valid.SendJsonError());
|
||||
}
|
||||
|
||||
var sickRageEnabled = SickRageService.GetSettings().Enabled;
|
||||
if (sickRageEnabled)
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "SickRage is enabled, we cannot enable Sonarr and SickRage" });
|
||||
}
|
||||
var result = SonarrService.SaveSettings(sonarrSettings);
|
||||
|
||||
return Response.AsJson(result
|
||||
|
@ -291,6 +301,35 @@ namespace PlexRequests.UI.Modules
|
|||
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
|
||||
}
|
||||
|
||||
private Negotiator Sickrage()
|
||||
{
|
||||
var settings = SickRageService.GetSettings();
|
||||
|
||||
return View["Sickrage", settings];
|
||||
}
|
||||
|
||||
private Response SaveSickrage()
|
||||
{
|
||||
var sickRageSettings = this.Bind<SickRageSettings>();
|
||||
|
||||
var valid = this.Validate(sickRageSettings);
|
||||
if (!valid.IsValid)
|
||||
{
|
||||
return Response.AsJson(valid.SendJsonError());
|
||||
}
|
||||
|
||||
var sonarrEnabled = SonarrService.GetSettings().Enabled;
|
||||
if (sonarrEnabled)
|
||||
{
|
||||
return Response.AsJson(new JsonResponseModel { Result = false, Message = "Sonarr is enabled, we cannot enable Sonarr and SickRage" });
|
||||
}
|
||||
var result = SickRageService.SaveSettings(sickRageSettings);
|
||||
|
||||
return Response.AsJson(result
|
||||
? new JsonResponseModel { Result = true, Message = "Successfully Updated the Settings for SickRage!" }
|
||||
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
|
||||
}
|
||||
|
||||
private Response GetSonarrQualityProfiles()
|
||||
{
|
||||
var settings = this.Bind<SonarrSettings>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue