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

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

@ -11,35 +11,35 @@ namespace Ombi.Schedule
{
public class JobSetup : IJobSetup
{
public JobSetup(IPlexContentCacher plexContentCacher, IRadarrCacher radarrCacher,
IOmbiAutomaticUpdater updater, IEmbyContentCacher embyCacher, IPlexUserImporter userImporter,
public JobSetup(IPlexContentSync plexContentSync, IRadarrCacher radarrCacher,
IOmbiAutomaticUpdater updater, IEmbyContentSync embySync, IPlexUserImporter userImporter,
IEmbyUserImporter embyUserImporter, ISonarrCacher cache, ICouchPotatoCacher cpCache)
{
PlexContentCacher = plexContentCacher;
PlexContentSync = plexContentSync;
RadarrCacher = radarrCacher;
Updater = updater;
EmbyContentCacher = embyCacher;
EmbyContentSync = embySync;
PlexUserImporter = userImporter;
EmbyUserImporter = embyUserImporter;
SonarrCacher = cache;
CpCache = cpCache;
}
private IPlexContentCacher PlexContentCacher { get; }
private IPlexContentSync PlexContentSync { get; }
private IRadarrCacher RadarrCacher { get; }
private IOmbiAutomaticUpdater Updater { get; }
private IPlexUserImporter PlexUserImporter { get; }
private IEmbyContentCacher EmbyContentCacher { get; }
private IEmbyContentSync EmbyContentSync { get; }
private IEmbyUserImporter EmbyUserImporter { get; }
private ISonarrCacher SonarrCacher { get; }
private ICouchPotatoCacher CpCache { get; }
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(() => 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(() => Updater.Update(null), Cron.HourInterval(6));

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

@ -39,9 +39,9 @@ using Ombi.Store.Repository;
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)
{
_api = api;
@ -53,7 +53,7 @@ namespace Ombi.Schedule.Jobs.Emby
private readonly ISettingsService<EmbySettings> _settings;
private readonly IEmbyApi _api;
private readonly ILogger<EmbyEpisodeCacher> _logger;
private readonly ILogger<EmbyEpisodeSync> _logger;
private readonly IEmbyContentRepository _repo;
private readonly IEmbyAvaliabilityChecker _avaliabilityChecker;

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

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

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

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

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

@ -14,9 +14,9 @@ using Ombi.Store.Repository;
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)
{
_settings = s;
@ -27,7 +27,7 @@ namespace Ombi.Schedule.Jobs.Plex
}
private readonly ISettingsService<PlexSettings> _settings;
private readonly ILogger<PlexEpisodeCacher> _log;
private readonly ILogger<PlexEpisodeSync> _log;
private readonly IPlexApi _api;
private readonly IPlexContentRepository _repo;
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 JobController(IOmbiAutomaticUpdater updater, IPlexUserImporter userImporter,
IMemoryCache mem, IEmbyUserImporter embyImporter, IPlexContentCacher plexContentCacher,
IEmbyContentCacher embyContentCacher)
IMemoryCache mem, IEmbyUserImporter embyImporter, IPlexContentSync plexContentSync,
IEmbyContentSync embyContentSync)
{
_updater = updater;
_plexUserImporter = userImporter;
_embyUserImporter = embyImporter;
_memCache = mem;
_plexContentCacher = plexContentCacher;
_embyContentCacher = embyContentCacher;
_plexContentSync = plexContentSync;
_embyContentSync = embyContentSync;
}
private readonly IOmbiAutomaticUpdater _updater;
private readonly IPlexUserImporter _plexUserImporter;
private readonly IEmbyUserImporter _embyUserImporter;
private readonly IMemoryCache _memCache;
private readonly IPlexContentCacher _plexContentCacher;
private readonly IEmbyContentCacher _embyContentCacher;
private readonly IPlexContentSync _plexContentSync;
private readonly IEmbyContentSync _embyContentSync;
/// <summary>
/// Runs the update job
@ -116,7 +116,7 @@ namespace Ombi.Controllers
[HttpPost("plexcontentcacher")]
public bool StartPlexContentCacher()
{
BackgroundJob.Enqueue(() => _plexContentCacher.CacheContent());
BackgroundJob.Enqueue(() => _plexContentSync.CacheContent());
return true;
}
@ -127,7 +127,7 @@ namespace Ombi.Controllers
[HttpPost("embycontentcacher")]
public bool StartEmbyContentCacher()
{
BackgroundJob.Enqueue(() => _embyContentCacher.Start());
BackgroundJob.Enqueue(() => _embyContentSync.Start());
return true;
}
}

Loading…
Cancel
Save