|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Hangfire;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Internal;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
@ -19,12 +20,15 @@ namespace Ombi.Schedule.Jobs.Lidarr
|
|
|
|
|
{
|
|
|
|
|
public class LidarrAlbumSync : ILidarrAlbumSync
|
|
|
|
|
{
|
|
|
|
|
public LidarrAlbumSync(ISettingsService<LidarrSettings> lidarr, ILidarrApi lidarrApi, ILogger<LidarrAlbumSync> log, IOmbiContext ctx)
|
|
|
|
|
public LidarrAlbumSync(ISettingsService<LidarrSettings> lidarr, ILidarrApi lidarrApi, ILogger<LidarrAlbumSync> log, IOmbiContext ctx,
|
|
|
|
|
IBackgroundJobClient job, ILidarrAvailabilityChecker availability)
|
|
|
|
|
{
|
|
|
|
|
_lidarrSettings = lidarr;
|
|
|
|
|
_lidarrApi = lidarrApi;
|
|
|
|
|
_logger = log;
|
|
|
|
|
_ctx = ctx;
|
|
|
|
|
_job = job;
|
|
|
|
|
_availability = availability;
|
|
|
|
|
_lidarrSettings.ClearCache();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -32,6 +36,8 @@ namespace Ombi.Schedule.Jobs.Lidarr
|
|
|
|
|
private readonly ILidarrApi _lidarrApi;
|
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
|
private readonly IOmbiContext _ctx;
|
|
|
|
|
private readonly IBackgroundJobClient _job;
|
|
|
|
|
private readonly ILidarrAvailabilityChecker _availability;
|
|
|
|
|
|
|
|
|
|
public async Task CacheContent()
|
|
|
|
|
{
|
|
|
|
@ -74,6 +80,8 @@ namespace Ombi.Schedule.Jobs.Lidarr
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError(LoggingEvents.Cacher, ex, "Failed caching queued items from Lidarr Album");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_job.Enqueue(() => _availability.Start());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|