diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs index 76f2f42bc..60fbcb565 100644 --- a/src/Ombi.DependencyInjection/IocExtensions.cs +++ b/src/Ombi.DependencyInjection/IocExtensions.cs @@ -214,7 +214,7 @@ namespace Ombi.DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/src/Ombi.Helpers/OmbiQuartz.cs b/src/Ombi.Helpers/OmbiQuartz.cs index e876296d5..9a4cf87da 100644 --- a/src/Ombi.Helpers/OmbiQuartz.cs +++ b/src/Ombi.Helpers/OmbiQuartz.cs @@ -89,6 +89,7 @@ namespace Ombi.Helpers } } + public static async Task TriggerJob(string jobName, string group, IDictionary data) { await Scheduler.TriggerJob(new JobKey(jobName, group), new JobDataMap(data)); diff --git a/src/Ombi/Controllers/V1/SettingsController.cs b/src/Ombi/Controllers/V1/SettingsController.cs index 5ad7edc7c..067183382 100644 --- a/src/Ombi/Controllers/V1/SettingsController.cs +++ b/src/Ombi/Controllers/V1/SettingsController.cs @@ -25,10 +25,12 @@ using Ombi.Settings.Settings.Models.External; using Ombi.Settings.Settings.Models.Notifications; using Ombi.Store.Entities; using Ombi.Store.Repository; -using Ombi.Api.Github; -using Ombi.Core.Engine; using Ombi.Extensions; 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 { @@ -186,6 +188,13 @@ namespace Ombi.Controllers.V1 plex.InstallId = Guid.NewGuid(); } var result = await Save(plex); + + if (result) + { + // Kick off the plex sync + await OmbiQuartz.TriggerJob(nameof(IPlexContentSync), "Plex"); + } + return result; } @@ -218,6 +227,10 @@ namespace Ombi.Controllers.V1 } } var result = await Save(emby); + if (result) + { + await OmbiQuartz.TriggerJob(nameof(IEmbyContentSync), "Emby"); + } return result; } @@ -335,7 +348,12 @@ namespace Ombi.Controllers.V1 [HttpPost("sonarr")] public async Task SonarrSettings([FromBody]SonarrSettings settings) { - return await Save(settings); + var result = await Save(settings); + if (result) + { + await OmbiQuartz.TriggerJob(nameof(ISonarrSync), "DVR"); + } + return result; } /// @@ -378,7 +396,12 @@ namespace Ombi.Controllers.V1 [HttpPost("lidarr")] public async Task LidarrSettings([FromBody]LidarrSettings settings) { - return await Save(settings); + var lidarr = await Save(settings); + if (lidarr) + { + await OmbiQuartz.TriggerJob(nameof(ILidarrArtistSync), "DVR"); + } + return lidarr; } /// @@ -972,7 +995,7 @@ namespace Ombi.Controllers.V1 var model = Mapper.Map(settings); // Lookup to see if we have any templates saved - if(model.WhatsAppSettings == null) + if (model.WhatsAppSettings == null) { model.WhatsAppSettings = new WhatsAppSettingsViewModel(); } @@ -1148,7 +1171,7 @@ namespace Ombi.Controllers.V1 templates = templates.Where(x => x.NotificationType != NotificationType.WelcomeEmail); } - var tem = templates.ToList(); + var tem = templates.ToList(); return tem.OrderBy(x => x.NotificationType.ToString()).ToList(); }