|
|
@ -66,8 +66,10 @@ namespace Ombi.UI.Modules
|
|
|
|
ICacheProvider cache,
|
|
|
|
ICacheProvider cache,
|
|
|
|
IAnalytics an,
|
|
|
|
IAnalytics an,
|
|
|
|
IPlexNotificationEngine engine,
|
|
|
|
IPlexNotificationEngine engine,
|
|
|
|
|
|
|
|
IEmbyNotificationEngine embyEngine,
|
|
|
|
ISecurityExtensions security,
|
|
|
|
ISecurityExtensions security,
|
|
|
|
ISettingsService<CustomizationSettings> customSettings) : base("requests", prSettings, security)
|
|
|
|
ISettingsService<CustomizationSettings> customSettings,
|
|
|
|
|
|
|
|
ISettingsService<EmbySettings> embyS) : base("requests", prSettings, security)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Service = service;
|
|
|
|
Service = service;
|
|
|
|
PrSettings = prSettings;
|
|
|
|
PrSettings = prSettings;
|
|
|
@ -81,8 +83,10 @@ namespace Ombi.UI.Modules
|
|
|
|
CpApi = cpApi;
|
|
|
|
CpApi = cpApi;
|
|
|
|
Cache = cache;
|
|
|
|
Cache = cache;
|
|
|
|
Analytics = an;
|
|
|
|
Analytics = an;
|
|
|
|
NotificationEngine = engine;
|
|
|
|
PlexNotificationEngine = engine;
|
|
|
|
|
|
|
|
EmbyNotificationEngine = embyEngine;
|
|
|
|
CustomizationSettings = customSettings;
|
|
|
|
CustomizationSettings = customSettings;
|
|
|
|
|
|
|
|
EmbySettings = embyS;
|
|
|
|
|
|
|
|
|
|
|
|
Get["/", true] = async (x, ct) => await LoadRequests();
|
|
|
|
Get["/", true] = async (x, ct) => await LoadRequests();
|
|
|
|
Get["/movies", true] = async (x, ct) => await GetMovies();
|
|
|
|
Get["/movies", true] = async (x, ct) => await GetMovies();
|
|
|
@ -111,11 +115,13 @@ namespace Ombi.UI.Modules
|
|
|
|
private ISettingsService<SickRageSettings> SickRageSettings { get; }
|
|
|
|
private ISettingsService<SickRageSettings> SickRageSettings { get; }
|
|
|
|
private ISettingsService<CouchPotatoSettings> CpSettings { get; }
|
|
|
|
private ISettingsService<CouchPotatoSettings> CpSettings { get; }
|
|
|
|
private ISettingsService<CustomizationSettings> CustomizationSettings { get; }
|
|
|
|
private ISettingsService<CustomizationSettings> CustomizationSettings { get; }
|
|
|
|
|
|
|
|
private ISettingsService<EmbySettings> EmbySettings { get; }
|
|
|
|
private ISonarrApi SonarrApi { get; }
|
|
|
|
private ISonarrApi SonarrApi { get; }
|
|
|
|
private ISickRageApi SickRageApi { get; }
|
|
|
|
private ISickRageApi SickRageApi { get; }
|
|
|
|
private ICouchPotatoApi CpApi { get; }
|
|
|
|
private ICouchPotatoApi CpApi { get; }
|
|
|
|
private ICacheProvider Cache { get; }
|
|
|
|
private ICacheProvider Cache { get; }
|
|
|
|
private INotificationEngine NotificationEngine { get; }
|
|
|
|
private INotificationEngine PlexNotificationEngine { get; }
|
|
|
|
|
|
|
|
private INotificationEngine EmbyNotificationEngine { get; }
|
|
|
|
|
|
|
|
|
|
|
|
private async Task<Negotiator> LoadRequests()
|
|
|
|
private async Task<Negotiator> LoadRequests()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -438,7 +444,21 @@ namespace Ombi.UI.Modules
|
|
|
|
originalRequest.Available = available;
|
|
|
|
originalRequest.Available = available;
|
|
|
|
|
|
|
|
|
|
|
|
var result = await Service.UpdateRequestAsync(originalRequest);
|
|
|
|
var result = await Service.UpdateRequestAsync(originalRequest);
|
|
|
|
await NotificationEngine.NotifyUsers(originalRequest, available ? NotificationType.RequestAvailable : NotificationType.RequestDeclined);
|
|
|
|
|
|
|
|
|
|
|
|
var plexSettings = await PlexSettings.GetSettingsAsync();
|
|
|
|
|
|
|
|
if (plexSettings.Enable)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await
|
|
|
|
|
|
|
|
PlexNotificationEngine.NotifyUsers(originalRequest,
|
|
|
|
|
|
|
|
available ? NotificationType.RequestAvailable : NotificationType.RequestDeclined);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var embySettings = await EmbySettings.GetSettingsAsync();
|
|
|
|
|
|
|
|
if (embySettings.Enable)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await EmbyNotificationEngine.NotifyUsers(originalRequest,
|
|
|
|
|
|
|
|
available ? NotificationType.RequestAvailable : NotificationType.RequestDeclined);
|
|
|
|
|
|
|
|
}
|
|
|
|
return Response.AsJson(result
|
|
|
|
return Response.AsJson(result
|
|
|
|
? new { Result = true, Available = available, Message = string.Empty }
|
|
|
|
? new { Result = true, Available = available, Message = string.Empty }
|
|
|
|
: new { Result = false, Available = false, Message = "Could not update the availability, please try again or check the logs" });
|
|
|
|
: new { Result = false, Available = false, Message = "Could not update the availability, please try again or check the logs" });
|
|
|
|