mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -07:00
Added the option to set a CP quality #38
This commit is contained in:
parent
4136116555
commit
e34170f55a
9 changed files with 166 additions and 9 deletions
|
@ -59,6 +59,7 @@ namespace PlexRequests.UI.Modules
|
|||
private IPlexApi PlexApi { get; }
|
||||
private ISonarrApi SonarrApi { get; }
|
||||
private PushbulletApi PushbulletApi { get; }
|
||||
private ICouchPotatoApi CpApi { get; }
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
public AdminModule(ISettingsService<PlexRequestSettings> rpService,
|
||||
|
@ -70,7 +71,8 @@ namespace PlexRequests.UI.Modules
|
|||
ISettingsService<EmailNotificationSettings> email,
|
||||
IPlexApi plexApi,
|
||||
ISettingsService<PushbulletNotificationSettings> pbSettings,
|
||||
PushbulletApi pbApi) : base("admin")
|
||||
PushbulletApi pbApi,
|
||||
ICouchPotatoApi cpApi) : base("admin")
|
||||
{
|
||||
RpService = rpService;
|
||||
CpService = cpService;
|
||||
|
@ -82,6 +84,7 @@ namespace PlexRequests.UI.Modules
|
|||
PlexApi = plexApi;
|
||||
PushbulletService = pbSettings;
|
||||
PushbulletApi = pbApi;
|
||||
CpApi = cpApi;
|
||||
|
||||
#if !DEBUG
|
||||
this.RequiresAuthentication();
|
||||
|
@ -107,6 +110,7 @@ namespace PlexRequests.UI.Modules
|
|||
Post["/sonarr"] = _ => SaveSonarr();
|
||||
|
||||
Post["/sonarrprofiles"] = _ => GetSonarrQualityProfiles();
|
||||
Post["/cpprofiles"] = _ => GetCpProfiles();
|
||||
|
||||
Get["/emailnotification"] = _ => EmailNotifications();
|
||||
Post["/emailnotification"] = _ => SaveEmailNotifications();
|
||||
|
@ -354,5 +358,13 @@ namespace PlexRequests.UI.Modules
|
|||
? new JsonResponseModel { Result = true, Message = "Successfully Updated the Settings for Pushbullet Notifications!" }
|
||||
: new JsonResponseModel { Result = false, Message = "Could not update the settings, take a look at the logs." });
|
||||
}
|
||||
|
||||
private Response GetCpProfiles()
|
||||
{
|
||||
var settings = this.Bind<CouchPotatoSettings>();
|
||||
var profiles = CpApi.GetProfiles(settings.FullUri, settings.ApiKey);
|
||||
|
||||
return Response.AsJson(profiles);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -127,7 +127,7 @@ namespace PlexRequests.UI.Modules
|
|||
var cpSettings = CpService.GetSettings();
|
||||
var cp = new CouchPotatoApi();
|
||||
Log.Info("Adding movie to CP : {0}", request.Title);
|
||||
var result = cp.AddMovie(request.ImdbId, cpSettings.ApiKey, request.Title, cpSettings.FullUri);
|
||||
var result = cp.AddMovie(request.ImdbId, cpSettings.ApiKey, request.Title, cpSettings.FullUri, cpSettings.ProfileId);
|
||||
Log.Trace("Adding movie to CP result {0}", result);
|
||||
if (result)
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ namespace PlexRequests.UI.Modules
|
|||
private bool SendMovie(CouchPotatoSettings settings, RequestedModel r, ICouchPotatoApi cp)
|
||||
{
|
||||
Log.Info("Adding movie to CP : {0}", r.Title);
|
||||
var result = cp.AddMovie(r.ImdbId, settings.ApiKey, r.Title, settings.FullUri);
|
||||
var result = cp.AddMovie(r.ImdbId, settings.ApiKey, r.Title, settings.FullUri, settings.ProfileId);
|
||||
Log.Trace("Adding movie to CP result {0}", result);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace PlexRequests.UI.Modules
|
|||
if (!settings.RequireApproval)
|
||||
{
|
||||
Log.Info("Adding movie to CP (No approval required)");
|
||||
var result = CouchPotatoApi.AddMovie(model.ImdbId, cpSettings.ApiKey, model.Title, cpSettings.FullUri);
|
||||
var result = CouchPotatoApi.AddMovie(model.ImdbId, cpSettings.ApiKey, model.Title, cpSettings.FullUri,cpSettings.ProfileId);
|
||||
Log.Debug("Adding movie to CP result {0}", result);
|
||||
if (result)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue