pull/1741/head
Jamie 7 years ago
parent f43c27ed96
commit 191c46d7aa

@ -144,11 +144,11 @@ namespace Ombi.DependencyInjection
{ {
services.AddTransient<IBackgroundJobClient, BackgroundJobClient>(); services.AddTransient<IBackgroundJobClient, BackgroundJobClient>();
services.AddTransient<IPlexContentCacher, PlexServerContentCacher>(); services.AddTransient<IPlexContentSync, PlexContentSync>();
services.AddTransient<IEmbyContentCacher, EmbyContentCacher>(); services.AddTransient<IEmbyContentSync, EmbyContentSync>();
services.AddTransient<IEmbyEpisodeCacher, EmbyEpisodeCacher>(); services.AddTransient<IEmbyEpisodeSync, EmbyEpisodeSync>();
services.AddTransient<IEmbyAvaliabilityChecker, EmbyAvaliabilityChecker>(); services.AddTransient<IEmbyAvaliabilityChecker, EmbyAvaliabilityChecker>();
services.AddTransient<IPlexEpisodeCacher, PlexEpisodeCacher>(); services.AddTransient<IPlexEpisodeSync, PlexEpisodeSync>();
services.AddTransient<IPlexAvailabilityChecker, PlexAvailabilityChecker>(); services.AddTransient<IPlexAvailabilityChecker, PlexAvailabilityChecker>();
services.AddTransient<IJobSetup, JobSetup>(); services.AddTransient<IJobSetup, JobSetup>();
services.AddTransient<IRadarrCacher, RadarrCacher>(); services.AddTransient<IRadarrCacher, RadarrCacher>();

@ -11,35 +11,35 @@ namespace Ombi.Schedule
{ {
public class JobSetup : IJobSetup public class JobSetup : IJobSetup
{ {
public JobSetup(IPlexContentCacher plexContentCacher, IRadarrCacher radarrCacher, public JobSetup(IPlexContentSync plexContentSync, IRadarrCacher radarrCacher,
IOmbiAutomaticUpdater updater, IEmbyContentCacher embyCacher, IPlexUserImporter userImporter, IOmbiAutomaticUpdater updater, IEmbyContentSync embySync, IPlexUserImporter userImporter,
IEmbyUserImporter embyUserImporter, ISonarrCacher cache, ICouchPotatoCacher cpCache) IEmbyUserImporter embyUserImporter, ISonarrCacher cache, ICouchPotatoCacher cpCache)
{ {
PlexContentCacher = plexContentCacher; PlexContentSync = plexContentSync;
RadarrCacher = radarrCacher; RadarrCacher = radarrCacher;
Updater = updater; Updater = updater;
EmbyContentCacher = embyCacher; EmbyContentSync = embySync;
PlexUserImporter = userImporter; PlexUserImporter = userImporter;
EmbyUserImporter = embyUserImporter; EmbyUserImporter = embyUserImporter;
SonarrCacher = cache; SonarrCacher = cache;
CpCache = cpCache; CpCache = cpCache;
} }
private IPlexContentCacher PlexContentCacher { get; } private IPlexContentSync PlexContentSync { get; }
private IRadarrCacher RadarrCacher { get; } private IRadarrCacher RadarrCacher { get; }
private IOmbiAutomaticUpdater Updater { get; } private IOmbiAutomaticUpdater Updater { get; }
private IPlexUserImporter PlexUserImporter { get; } private IPlexUserImporter PlexUserImporter { get; }
private IEmbyContentCacher EmbyContentCacher { get; } private IEmbyContentSync EmbyContentSync { get; }
private IEmbyUserImporter EmbyUserImporter { get; } private IEmbyUserImporter EmbyUserImporter { get; }
private ISonarrCacher SonarrCacher { get; } private ISonarrCacher SonarrCacher { get; }
private ICouchPotatoCacher CpCache { get; } private ICouchPotatoCacher CpCache { get; }
public void Setup() public void Setup()
{ {
RecurringJob.AddOrUpdate(() => EmbyContentCacher.Start(), Cron.Hourly(5)); RecurringJob.AddOrUpdate(() => EmbyContentSync.Start(), Cron.Hourly(5));
RecurringJob.AddOrUpdate(() => SonarrCacher.Start(), Cron.Hourly(10)); RecurringJob.AddOrUpdate(() => SonarrCacher.Start(), Cron.Hourly(10));
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly(15)); RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly(15));
RecurringJob.AddOrUpdate(() => PlexContentCacher.CacheContent(), Cron.Hourly(20)); RecurringJob.AddOrUpdate(() => PlexContentSync.CacheContent(), Cron.Hourly(20));
RecurringJob.AddOrUpdate(() => CpCache.Start(), Cron.Hourly(30)); RecurringJob.AddOrUpdate(() => CpCache.Start(), Cron.Hourly(30));
RecurringJob.AddOrUpdate(() => Updater.Update(null), Cron.HourInterval(6)); RecurringJob.AddOrUpdate(() => Updater.Update(null), Cron.HourInterval(6));

@ -16,23 +16,23 @@ using EmbyMediaType = Ombi.Store.Entities.EmbyMediaType;
namespace Ombi.Schedule.Jobs.Emby namespace Ombi.Schedule.Jobs.Emby
{ {
public class EmbyContentCacher : IEmbyContentCacher public class EmbyContentSync : IEmbyContentSync
{ {
public EmbyContentCacher(ISettingsService<EmbySettings> settings, IEmbyApi api, ILogger<EmbyContentCacher> logger, public EmbyContentSync(ISettingsService<EmbySettings> settings, IEmbyApi api, ILogger<EmbyContentSync> logger,
IEmbyContentRepository repo, IEmbyEpisodeCacher epCacher) IEmbyContentRepository repo, IEmbyEpisodeSync epSync)
{ {
_logger = logger; _logger = logger;
_settings = settings; _settings = settings;
_api = api; _api = api;
_repo = repo; _repo = repo;
_episodeCacher = epCacher; _episodeSync = epSync;
} }
private readonly ILogger<EmbyContentCacher> _logger; private readonly ILogger<EmbyContentSync> _logger;
private readonly ISettingsService<EmbySettings> _settings; private readonly ISettingsService<EmbySettings> _settings;
private readonly IEmbyApi _api; private readonly IEmbyApi _api;
private readonly IEmbyContentRepository _repo; private readonly IEmbyContentRepository _repo;
private readonly IEmbyEpisodeCacher _episodeCacher; private readonly IEmbyEpisodeSync _episodeSync;
public async Task Start() public async Task Start()
@ -45,7 +45,7 @@ namespace Ombi.Schedule.Jobs.Emby
await StartServerCache(server); await StartServerCache(server);
// Episodes // Episodes
BackgroundJob.Enqueue(() => _episodeCacher.Start()); BackgroundJob.Enqueue(() => _episodeSync.Start());
} }

@ -39,9 +39,9 @@ using Ombi.Store.Repository;
namespace Ombi.Schedule.Jobs.Emby namespace Ombi.Schedule.Jobs.Emby
{ {
public class EmbyEpisodeCacher : IEmbyEpisodeCacher public class EmbyEpisodeSync : IEmbyEpisodeSync
{ {
public EmbyEpisodeCacher(ISettingsService<EmbySettings> s, IEmbyApi api, ILogger<EmbyEpisodeCacher> l, IEmbyContentRepository repo, public EmbyEpisodeSync(ISettingsService<EmbySettings> s, IEmbyApi api, ILogger<EmbyEpisodeSync> l, IEmbyContentRepository repo,
IEmbyAvaliabilityChecker checker) IEmbyAvaliabilityChecker checker)
{ {
_api = api; _api = api;
@ -53,7 +53,7 @@ namespace Ombi.Schedule.Jobs.Emby
private readonly ISettingsService<EmbySettings> _settings; private readonly ISettingsService<EmbySettings> _settings;
private readonly IEmbyApi _api; private readonly IEmbyApi _api;
private readonly ILogger<EmbyEpisodeCacher> _logger; private readonly ILogger<EmbyEpisodeSync> _logger;
private readonly IEmbyContentRepository _repo; private readonly IEmbyContentRepository _repo;
private readonly IEmbyAvaliabilityChecker _avaliabilityChecker; private readonly IEmbyAvaliabilityChecker _avaliabilityChecker;

@ -2,7 +2,7 @@ using System.Threading.Tasks;
namespace Ombi.Schedule.Jobs.Emby namespace Ombi.Schedule.Jobs.Emby
{ {
public interface IEmbyContentCacher public interface IEmbyContentSync
{ {
Task Start(); Task Start();
} }

@ -2,7 +2,7 @@
namespace Ombi.Schedule.Jobs.Emby namespace Ombi.Schedule.Jobs.Emby
{ {
public interface IEmbyEpisodeCacher public interface IEmbyEpisodeSync
{ {
Task Start(); Task Start();
} }

@ -2,7 +2,7 @@
namespace Ombi.Schedule.Jobs namespace Ombi.Schedule.Jobs
{ {
public interface IPlexContentCacher public interface IPlexContentSync
{ {
Task CacheContent(); Task CacheContent();
} }

@ -2,7 +2,7 @@
namespace Ombi.Schedule.Jobs.Plex namespace Ombi.Schedule.Jobs.Plex
{ {
public interface IPlexEpisodeCacher public interface IPlexEpisodeSync
{ {
Task Start(); Task Start();
} }

@ -41,23 +41,23 @@ using Ombi.Store.Repository;
namespace Ombi.Schedule.Jobs.Plex namespace Ombi.Schedule.Jobs.Plex
{ {
public class PlexServerContentCacher : IPlexContentCacher public class PlexContentSync : IPlexContentSync
{ {
public PlexServerContentCacher(ISettingsService<PlexSettings> plex, IPlexApi plexApi, ILogger<PlexServerContentCacher> logger, IPlexContentRepository repo, public PlexContentSync(ISettingsService<PlexSettings> plex, IPlexApi plexApi, ILogger<PlexContentSync> logger, IPlexContentRepository repo,
IPlexEpisodeCacher epsiodeCacher) IPlexEpisodeSync epsiodeSync)
{ {
Plex = plex; Plex = plex;
PlexApi = plexApi; PlexApi = plexApi;
Logger = logger; Logger = logger;
Repo = repo; Repo = repo;
EpisodeCacher = epsiodeCacher; EpisodeSync = epsiodeSync;
} }
private ISettingsService<PlexSettings> Plex { get; } private ISettingsService<PlexSettings> Plex { get; }
private IPlexApi PlexApi { get; } private IPlexApi PlexApi { get; }
private ILogger<PlexServerContentCacher> Logger { get; } private ILogger<PlexContentSync> Logger { get; }
private IPlexContentRepository Repo { get; } private IPlexContentRepository Repo { get; }
private IPlexEpisodeCacher EpisodeCacher { get; } private IPlexEpisodeSync EpisodeSync { get; }
public async Task CacheContent() public async Task CacheContent()
{ {
@ -79,7 +79,7 @@ namespace Ombi.Schedule.Jobs.Plex
Logger.LogInformation("Starting EP Cacher"); Logger.LogInformation("Starting EP Cacher");
BackgroundJob.Enqueue(() => EpisodeCacher.Start()); BackgroundJob.Enqueue(() => EpisodeSync.Start());
} }
catch (Exception e) catch (Exception e)
{ {

@ -14,9 +14,9 @@ using Ombi.Store.Repository;
namespace Ombi.Schedule.Jobs.Plex namespace Ombi.Schedule.Jobs.Plex
{ {
public class PlexEpisodeCacher : IPlexEpisodeCacher public class PlexEpisodeSync : IPlexEpisodeSync
{ {
public PlexEpisodeCacher(ISettingsService<PlexSettings> s, ILogger<PlexEpisodeCacher> log, IPlexApi plexApi, public PlexEpisodeSync(ISettingsService<PlexSettings> s, ILogger<PlexEpisodeSync> log, IPlexApi plexApi,
IPlexContentRepository repo, IPlexAvailabilityChecker a) IPlexContentRepository repo, IPlexAvailabilityChecker a)
{ {
_settings = s; _settings = s;
@ -27,7 +27,7 @@ namespace Ombi.Schedule.Jobs.Plex
} }
private readonly ISettingsService<PlexSettings> _settings; private readonly ISettingsService<PlexSettings> _settings;
private readonly ILogger<PlexEpisodeCacher> _log; private readonly ILogger<PlexEpisodeSync> _log;
private readonly IPlexApi _api; private readonly IPlexApi _api;
private readonly IPlexContentRepository _repo; private readonly IPlexContentRepository _repo;
private readonly IPlexAvailabilityChecker _availabilityChecker; private readonly IPlexAvailabilityChecker _availabilityChecker;

@ -0,0 +1,7 @@
namespace Ombi.Settings.Settings.Models
{
public class JobSettings
{
}
}

@ -19,23 +19,23 @@ namespace Ombi.Controllers
public class JobController : Controller public class JobController : Controller
{ {
public JobController(IOmbiAutomaticUpdater updater, IPlexUserImporter userImporter, public JobController(IOmbiAutomaticUpdater updater, IPlexUserImporter userImporter,
IMemoryCache mem, IEmbyUserImporter embyImporter, IPlexContentCacher plexContentCacher, IMemoryCache mem, IEmbyUserImporter embyImporter, IPlexContentSync plexContentSync,
IEmbyContentCacher embyContentCacher) IEmbyContentSync embyContentSync)
{ {
_updater = updater; _updater = updater;
_plexUserImporter = userImporter; _plexUserImporter = userImporter;
_embyUserImporter = embyImporter; _embyUserImporter = embyImporter;
_memCache = mem; _memCache = mem;
_plexContentCacher = plexContentCacher; _plexContentSync = plexContentSync;
_embyContentCacher = embyContentCacher; _embyContentSync = embyContentSync;
} }
private readonly IOmbiAutomaticUpdater _updater; private readonly IOmbiAutomaticUpdater _updater;
private readonly IPlexUserImporter _plexUserImporter; private readonly IPlexUserImporter _plexUserImporter;
private readonly IEmbyUserImporter _embyUserImporter; private readonly IEmbyUserImporter _embyUserImporter;
private readonly IMemoryCache _memCache; private readonly IMemoryCache _memCache;
private readonly IPlexContentCacher _plexContentCacher; private readonly IPlexContentSync _plexContentSync;
private readonly IEmbyContentCacher _embyContentCacher; private readonly IEmbyContentSync _embyContentSync;
/// <summary> /// <summary>
/// Runs the update job /// Runs the update job
@ -116,7 +116,7 @@ namespace Ombi.Controllers
[HttpPost("plexcontentcacher")] [HttpPost("plexcontentcacher")]
public bool StartPlexContentCacher() public bool StartPlexContentCacher()
{ {
BackgroundJob.Enqueue(() => _plexContentCacher.CacheContent()); BackgroundJob.Enqueue(() => _plexContentSync.CacheContent());
return true; return true;
} }
@ -127,7 +127,7 @@ namespace Ombi.Controllers
[HttpPost("embycontentcacher")] [HttpPost("embycontentcacher")]
public bool StartEmbyContentCacher() public bool StartEmbyContentCacher()
{ {
BackgroundJob.Enqueue(() => _embyContentCacher.Start()); BackgroundJob.Enqueue(() => _embyContentSync.Start());
return true; return true;
} }
} }

Loading…
Cancel
Save