mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Added the ability to switch on and off the *arr availability scanner
This commit is contained in:
parent
b012736e27
commit
dd916e5753
8 changed files with 42 additions and 13 deletions
|
@ -7,10 +7,12 @@ using Microsoft.AspNetCore.SignalR;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Ombi.Core;
|
using Ombi.Core;
|
||||||
|
using Ombi.Core.Settings;
|
||||||
using Ombi.Helpers;
|
using Ombi.Helpers;
|
||||||
using Ombi.Hubs;
|
using Ombi.Hubs;
|
||||||
using Ombi.Notifications.Models;
|
using Ombi.Notifications.Models;
|
||||||
using Ombi.Schedule.Jobs.Plex.Models;
|
using Ombi.Schedule.Jobs.Plex.Models;
|
||||||
|
using Ombi.Settings.Settings.Models.External;
|
||||||
using Ombi.Store.Entities;
|
using Ombi.Store.Entities;
|
||||||
using Ombi.Store.Repository;
|
using Ombi.Store.Repository;
|
||||||
using Ombi.Store.Repository.Requests;
|
using Ombi.Store.Repository.Requests;
|
||||||
|
@ -20,13 +22,26 @@ namespace Ombi.Schedule.Jobs.Radarr
|
||||||
{
|
{
|
||||||
public class ArrAvailabilityChecker : IArrAvailabilityChecker
|
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(
|
public ArrAvailabilityChecker(
|
||||||
IExternalRepository<RadarrCache> radarrRepo,
|
IExternalRepository<RadarrCache> radarrRepo,
|
||||||
IExternalRepository<SonarrCache> sonarrRepo,
|
IExternalRepository<SonarrCache> sonarrRepo,
|
||||||
IExternalRepository<SonarrEpisodeCache> sonarrEpisodeRepo,
|
IExternalRepository<SonarrEpisodeCache> sonarrEpisodeRepo,
|
||||||
INotificationHelper notification, IHubContext<NotificationHub> hub,
|
INotificationHelper notification, IHubContext<NotificationHub> hub,
|
||||||
ITvRequestRepository tvRequest, IMovieRequestRepository movies,
|
ITvRequestRepository tvRequest, IMovieRequestRepository movies,
|
||||||
ILogger<ArrAvailabilityChecker> log)
|
ILogger<ArrAvailabilityChecker> log,
|
||||||
|
ISettingsService<RadarrSettings> radarrSettings,
|
||||||
|
ISettingsService<SonarrSettings> sonarrSettings)
|
||||||
{
|
{
|
||||||
_radarrRepo = radarrRepo;
|
_radarrRepo = radarrRepo;
|
||||||
_sonarrRepo = sonarrRepo;
|
_sonarrRepo = sonarrRepo;
|
||||||
|
@ -36,21 +51,23 @@ namespace Ombi.Schedule.Jobs.Radarr
|
||||||
_tvRequest = tvRequest;
|
_tvRequest = tvRequest;
|
||||||
_movies = movies;
|
_movies = movies;
|
||||||
_logger = log;
|
_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)
|
public async Task Execute(IJobExecutionContext job)
|
||||||
{
|
{
|
||||||
await ProcessMovies();
|
var radarrSettings = await _radarrSettings.GetSettingsAsync();
|
||||||
await ProcessTvShows();
|
var sonarrSettings = await _sonarrSettings.GetSettingsAsync();
|
||||||
|
|
||||||
|
if (radarrSettings.ScanForAvailability)
|
||||||
|
{
|
||||||
|
await ProcessMovies();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sonarrSettings.ScanForAvailability)
|
||||||
|
{
|
||||||
|
await ProcessTvShows();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ProcessMovies()
|
private async Task ProcessMovies()
|
||||||
|
|
|
@ -10,5 +10,6 @@ namespace Ombi.Settings.Settings.Models.External
|
||||||
public string DefaultRootPath { get; set; }
|
public string DefaultRootPath { get; set; }
|
||||||
public bool AddOnly { get; set; }
|
public bool AddOnly { get; set; }
|
||||||
public string MinimumAvailability { get; set; }
|
public string MinimumAvailability { get; set; }
|
||||||
|
public bool ScanForAvailability { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,5 +20,6 @@
|
||||||
public bool AddOnly { get; set; }
|
public bool AddOnly { get; set; }
|
||||||
public bool V3 { get; set; }
|
public bool V3 { get; set; }
|
||||||
public int LanguageProfile { get; set; }
|
public int LanguageProfile { get; set; }
|
||||||
|
public bool ScanForAvailability { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -85,6 +85,7 @@ export interface ISonarrSettings extends IExternalSettings {
|
||||||
addOnly: boolean;
|
addOnly: boolean;
|
||||||
v3: boolean;
|
v3: boolean;
|
||||||
languageProfile: number;
|
languageProfile: number;
|
||||||
|
scanForAvailability: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRadarrSettings extends IExternalSettings {
|
export interface IRadarrSettings extends IExternalSettings {
|
||||||
|
@ -95,6 +96,7 @@ export interface IRadarrSettings extends IExternalSettings {
|
||||||
fullRootPath: string;
|
fullRootPath: string;
|
||||||
addOnly: boolean;
|
addOnly: boolean;
|
||||||
minimumAvailability: string;
|
minimumAvailability: string;
|
||||||
|
scanForAvailability: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ILidarrSettings extends IExternalSettings {
|
export interface ILidarrSettings extends IExternalSettings {
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
<div class="md-form-field">
|
<div class="md-form-field">
|
||||||
<mat-slide-toggle [(ngModel)]="advanced" [ngModelOptions]="{standalone: true}">Advanced</mat-slide-toggle>
|
<mat-slide-toggle [(ngModel)]="advanced" [ngModelOptions]="{standalone: true}">Advanced</mat-slide-toggle>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="md-form-field">
|
||||||
|
<mat-slide-toggle formControlName="scanForAvailability">Scan for Availability</mat-slide-toggle>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -43,6 +43,7 @@ export class RadarrComponent implements OnInit {
|
||||||
port: [x.port, [Validators.required]],
|
port: [x.port, [Validators.required]],
|
||||||
addOnly: [x.addOnly],
|
addOnly: [x.addOnly],
|
||||||
minimumAvailability: [x.minimumAvailability, [Validators.required]],
|
minimumAvailability: [x.minimumAvailability, [Validators.required]],
|
||||||
|
scanForAvailability: [x.scanForAvailability]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (x.defaultQualityProfile) {
|
if (x.defaultQualityProfile) {
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
<div class="md-form-field">
|
<div class="md-form-field">
|
||||||
<mat-slide-toggle [(ngModel)]="advanced" [ngModelOptions]="{standalone: true}">Advanced</mat-slide-toggle>
|
<mat-slide-toggle [(ngModel)]="advanced" [ngModelOptions]="{standalone: true}">Advanced</mat-slide-toggle>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="md-form-field">
|
||||||
|
<mat-slide-toggle formControlName="scanForAvailability">Scan for Availability</mat-slide-toggle>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -73,6 +73,7 @@ export class SonarrComponent implements OnInit {
|
||||||
seasonFolders: [x.seasonFolders],
|
seasonFolders: [x.seasonFolders],
|
||||||
v3: [x.v3],
|
v3: [x.v3],
|
||||||
languageProfile: [x.languageProfile],
|
languageProfile: [x.languageProfile],
|
||||||
|
scanForAvailability: [x.scanForAvailability]
|
||||||
});
|
});
|
||||||
|
|
||||||
if (x.qualityProfile) {
|
if (x.qualityProfile) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue