Merge branch 'dev' of https://github.com/tidusjar/Ombi into dev

This commit is contained in:
tidusjar 2017-02-01 20:38:35 +00:00
commit f60eec4d4a
18 changed files with 238 additions and 69 deletions

View file

@ -66,8 +66,10 @@ namespace Ombi.UI.Modules
ICacheProvider cache,
IAnalytics an,
IPlexNotificationEngine engine,
IEmbyNotificationEngine embyEngine,
ISecurityExtensions security,
ISettingsService<CustomizationSettings> customSettings) : base("requests", prSettings, security)
ISettingsService<CustomizationSettings> customSettings,
ISettingsService<EmbySettings> embyS) : base("requests", prSettings, security)
{
Service = service;
PrSettings = prSettings;
@ -81,8 +83,10 @@ namespace Ombi.UI.Modules
CpApi = cpApi;
Cache = cache;
Analytics = an;
NotificationEngine = engine;
PlexNotificationEngine = engine;
EmbyNotificationEngine = embyEngine;
CustomizationSettings = customSettings;
EmbySettings = embyS;
Get["/", true] = async (x, ct) => await LoadRequests();
Get["/movies", true] = async (x, ct) => await GetMovies();
@ -111,11 +115,13 @@ namespace Ombi.UI.Modules
private ISettingsService<SickRageSettings> SickRageSettings { get; }
private ISettingsService<CouchPotatoSettings> CpSettings { get; }
private ISettingsService<CustomizationSettings> CustomizationSettings { get; }
private ISettingsService<EmbySettings> EmbySettings { get; }
private ISonarrApi SonarrApi { get; }
private ISickRageApi SickRageApi { get; }
private ICouchPotatoApi CpApi { get; }
private ICacheProvider Cache { get; }
private INotificationEngine NotificationEngine { get; }
private INotificationEngine PlexNotificationEngine { get; }
private INotificationEngine EmbyNotificationEngine { get; }
private async Task<Negotiator> LoadRequests()
{
@ -438,7 +444,21 @@ namespace Ombi.UI.Modules
originalRequest.Available = available;
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
? 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" });

View file

@ -153,6 +153,7 @@ namespace Ombi.UI.Modules
var firstServer = servers.Server.FirstOrDefault(x => x.AccessToken == form.PlexAuthToken);
Session[SessionKeys.UserWizardMachineId] = firstServer?.MachineIdentifier;
form.MachineIdentifier = firstServer?.MachineIdentifier;
}
catch (Exception e)
{