When saving setting, kick off the sync

pull/3632/head
tidusjar 4 years ago
parent 98b65d43a4
commit 3d5e4383d9

@ -214,7 +214,7 @@ namespace Ombi.DependencyInjection
services.AddTransient<IPlexEpisodeSync, PlexEpisodeSync>(); services.AddTransient<IPlexEpisodeSync, PlexEpisodeSync>();
services.AddTransient<IPlexAvailabilityChecker, PlexAvailabilityChecker>(); services.AddTransient<IPlexAvailabilityChecker, PlexAvailabilityChecker>();
services.AddTransient<IRadarrSync, RadarrSync>(); services.AddTransient<IRadarrSync, RadarrSync>();
services.AddTransient<ISonarrSync, SonarrSync>(); services.AddTransient<ILidarrSync, SonarrSync>();
services.AddTransient<IOmbiAutomaticUpdater, OmbiAutomaticUpdater>(); services.AddTransient<IOmbiAutomaticUpdater, OmbiAutomaticUpdater>();
services.AddTransient<IPlexUserImporter, PlexUserImporter>(); services.AddTransient<IPlexUserImporter, PlexUserImporter>();
services.AddTransient<IEmbyUserImporter, EmbyUserImporter>(); services.AddTransient<IEmbyUserImporter, EmbyUserImporter>();

@ -89,6 +89,7 @@ namespace Ombi.Helpers
} }
} }
public static async Task TriggerJob(string jobName, string group, IDictionary<string, object> data) public static async Task TriggerJob(string jobName, string group, IDictionary<string, object> data)
{ {
await Scheduler.TriggerJob(new JobKey(jobName, group), new JobDataMap(data)); await Scheduler.TriggerJob(new JobKey(jobName, group), new JobDataMap(data));

@ -25,10 +25,12 @@ using Ombi.Settings.Settings.Models.External;
using Ombi.Settings.Settings.Models.Notifications; using Ombi.Settings.Settings.Models.Notifications;
using Ombi.Store.Entities; using Ombi.Store.Entities;
using Ombi.Store.Repository; using Ombi.Store.Repository;
using Ombi.Api.Github;
using Ombi.Core.Engine;
using Ombi.Extensions; using Ombi.Extensions;
using Quartz; using Quartz;
using Ombi.Schedule.Jobs;
using Ombi.Schedule.Jobs.Emby;
using Ombi.Schedule.Jobs.Sonarr;
using Ombi.Schedule.Jobs.Lidarr;
namespace Ombi.Controllers.V1 namespace Ombi.Controllers.V1
{ {
@ -186,6 +188,13 @@ namespace Ombi.Controllers.V1
plex.InstallId = Guid.NewGuid(); plex.InstallId = Guid.NewGuid();
} }
var result = await Save(plex); var result = await Save(plex);
if (result)
{
// Kick off the plex sync
await OmbiQuartz.TriggerJob(nameof(IPlexContentSync), "Plex");
}
return result; return result;
} }
@ -218,6 +227,10 @@ namespace Ombi.Controllers.V1
} }
} }
var result = await Save(emby); var result = await Save(emby);
if (result)
{
await OmbiQuartz.TriggerJob(nameof(IEmbyContentSync), "Emby");
}
return result; return result;
} }
@ -335,7 +348,12 @@ namespace Ombi.Controllers.V1
[HttpPost("sonarr")] [HttpPost("sonarr")]
public async Task<bool> SonarrSettings([FromBody]SonarrSettings settings) public async Task<bool> SonarrSettings([FromBody]SonarrSettings settings)
{ {
return await Save(settings); var result = await Save(settings);
if (result)
{
await OmbiQuartz.TriggerJob(nameof(ISonarrSync), "DVR");
}
return result;
} }
/// <summary> /// <summary>
@ -378,7 +396,12 @@ namespace Ombi.Controllers.V1
[HttpPost("lidarr")] [HttpPost("lidarr")]
public async Task<bool> LidarrSettings([FromBody]LidarrSettings settings) public async Task<bool> LidarrSettings([FromBody]LidarrSettings settings)
{ {
return await Save(settings); var lidarr = await Save(settings);
if (lidarr)
{
await OmbiQuartz.TriggerJob(nameof(ILidarrArtistSync), "DVR");
}
return lidarr;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save