Added the ability to switch on and off the *arr availability scanner

pull/3745/head
tidusjar 4 years ago
parent b012736e27
commit dd916e5753

@ -7,10 +7,12 @@ using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using Ombi.Core;
using Ombi.Core.Settings;
using Ombi.Helpers;
using Ombi.Hubs;
using Ombi.Notifications.Models;
using Ombi.Schedule.Jobs.Plex.Models;
using Ombi.Settings.Settings.Models.External;
using Ombi.Store.Entities;
using Ombi.Store.Repository;
using Ombi.Store.Repository.Requests;
@ -20,13 +22,26 @@ namespace Ombi.Schedule.Jobs.Radarr
{
public class ArrAvailabilityChecker : IArrAvailabilityChecker
{
private readonly IExternalRepository<RadarrCache> _radarrRepo;
private readonly IExternalRepository<SonarrCache> _sonarrRepo;
private readonly ILogger<ArrAvailabilityChecker> _logger;
private readonly ISettingsService<RadarrSettings> _radarrSettings;
private readonly ISettingsService<SonarrSettings> _sonarrSettings;
private readonly IExternalRepository<SonarrEpisodeCache> _sonarrEpisodeRepo;
private readonly INotificationHelper _notification;
private readonly IHubContext<NotificationHub> _hub;
private readonly ITvRequestRepository _tvRequest;
private readonly IMovieRequestRepository _movies;
public ArrAvailabilityChecker(
IExternalRepository<RadarrCache> radarrRepo,
IExternalRepository<SonarrCache> sonarrRepo,
IExternalRepository<SonarrEpisodeCache> sonarrEpisodeRepo,
INotificationHelper notification, IHubContext<NotificationHub> hub,
ITvRequestRepository tvRequest, IMovieRequestRepository movies,
ILogger<ArrAvailabilityChecker> log)
ILogger<ArrAvailabilityChecker> log,
ISettingsService<RadarrSettings> radarrSettings,
ISettingsService<SonarrSettings> sonarrSettings)
{
_radarrRepo = radarrRepo;
_sonarrRepo = sonarrRepo;
@ -36,21 +51,23 @@ namespace Ombi.Schedule.Jobs.Radarr
_tvRequest = tvRequest;
_movies = movies;
_logger = log;
_radarrSettings = radarrSettings;
_sonarrSettings = sonarrSettings;
}
private readonly IExternalRepository<RadarrCache> _radarrRepo;
private readonly IExternalRepository<SonarrCache> _sonarrRepo;
private readonly ILogger<ArrAvailabilityChecker> _logger;
private readonly IExternalRepository<SonarrEpisodeCache> _sonarrEpisodeRepo;
private readonly INotificationHelper _notification;
private readonly IHubContext<NotificationHub> _hub;
private readonly ITvRequestRepository _tvRequest;
private readonly IMovieRequestRepository _movies;
public async Task Execute(IJobExecutionContext job)
{
await ProcessMovies();
await ProcessTvShows();
var radarrSettings = await _radarrSettings.GetSettingsAsync();
var sonarrSettings = await _sonarrSettings.GetSettingsAsync();
if (radarrSettings.ScanForAvailability)
{
await ProcessMovies();
}
if (sonarrSettings.ScanForAvailability)
{
await ProcessTvShows();
}
}
private async Task ProcessMovies()

@ -10,5 +10,6 @@ namespace Ombi.Settings.Settings.Models.External
public string DefaultRootPath { get; set; }
public bool AddOnly { get; set; }
public string MinimumAvailability { get; set; }
public bool ScanForAvailability { get; set; }
}
}

@ -20,5 +20,6 @@
public bool AddOnly { get; set; }
public bool V3 { get; set; }
public int LanguageProfile { get; set; }
public bool ScanForAvailability { get; set; }
}
}

@ -85,6 +85,7 @@ export interface ISonarrSettings extends IExternalSettings {
addOnly: boolean;
v3: boolean;
languageProfile: number;
scanForAvailability: boolean;
}
export interface IRadarrSettings extends IExternalSettings {
@ -95,6 +96,7 @@ export interface IRadarrSettings extends IExternalSettings {
fullRootPath: string;
addOnly: boolean;
minimumAvailability: string;
scanForAvailability: boolean;
}
export interface ILidarrSettings extends IExternalSettings {

@ -12,6 +12,9 @@
<div class="md-form-field">
<mat-slide-toggle [(ngModel)]="advanced" [ngModelOptions]="{standalone: true}">Advanced</mat-slide-toggle>
</div>
<div class="md-form-field">
<mat-slide-toggle formControlName="scanForAvailability">Scan for Availability</mat-slide-toggle>
</div>
</div>
</div>
</div>

@ -43,6 +43,7 @@ export class RadarrComponent implements OnInit {
port: [x.port, [Validators.required]],
addOnly: [x.addOnly],
minimumAvailability: [x.minimumAvailability, [Validators.required]],
scanForAvailability: [x.scanForAvailability]
});
if (x.defaultQualityProfile) {

@ -17,6 +17,9 @@
<div class="md-form-field">
<mat-slide-toggle [(ngModel)]="advanced" [ngModelOptions]="{standalone: true}">Advanced</mat-slide-toggle>
</div>
<div class="md-form-field">
<mat-slide-toggle formControlName="scanForAvailability">Scan for Availability</mat-slide-toggle>
</div>
</div>
</div>
</div>

@ -73,6 +73,7 @@ export class SonarrComponent implements OnInit {
seasonFolders: [x.seasonFolders],
v3: [x.v3],
languageProfile: [x.languageProfile],
scanForAvailability: [x.scanForAvailability]
});
if (x.qualityProfile) {

Loading…
Cancel
Save