mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
fix(sonarr): 🐛 Cleaned up and removed Sonarr v3 option, sonarr v3 is now the default. This allows us to get ready for the upcoming Sonarr v4 (#4764)
This commit is contained in:
parent
0f12b01325
commit
2cddec7590
14 changed files with 38 additions and 61 deletions
|
@ -5,8 +5,6 @@ namespace Ombi.Api.Sonarr.Models
|
||||||
public class SonarrProfile
|
public class SonarrProfile
|
||||||
{
|
{
|
||||||
public string name { get; set; }
|
public string name { get; set; }
|
||||||
public Cutoff cutoff { get; set; }
|
|
||||||
public List<Item> items { get; set; }
|
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -157,7 +157,6 @@ namespace Ombi.Core.Senders
|
||||||
}
|
}
|
||||||
|
|
||||||
int qualityToUse;
|
int qualityToUse;
|
||||||
var sonarrV3 = s.V3;
|
|
||||||
var languageProfileId = s.LanguageProfile;
|
var languageProfileId = s.LanguageProfile;
|
||||||
string rootFolderPath;
|
string rootFolderPath;
|
||||||
string seriesType;
|
string seriesType;
|
||||||
|
@ -265,13 +264,11 @@ namespace Ombi.Core.Senders
|
||||||
ignoreEpisodesWithFiles = false, // There shouldn't be any episodes with files, this is a new season
|
ignoreEpisodesWithFiles = false, // There shouldn't be any episodes with files, this is a new season
|
||||||
ignoreEpisodesWithoutFiles = false, // We want all missing
|
ignoreEpisodesWithoutFiles = false, // We want all missing
|
||||||
searchForMissingEpisodes = false // we want dont want to search yet. We want to make sure everything is unmonitored/monitored correctly.
|
searchForMissingEpisodes = false // we want dont want to search yet. We want to make sure everything is unmonitored/monitored correctly.
|
||||||
}
|
},
|
||||||
|
languageProfileId = languageProfileId
|
||||||
};
|
};
|
||||||
|
|
||||||
if (sonarrV3)
|
|
||||||
{
|
|
||||||
newSeries.languageProfileId = languageProfileId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Montitor the correct seasons,
|
// Montitor the correct seasons,
|
||||||
// If we have that season in the model then it's monitored!
|
// If we have that season in the model then it's monitored!
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Ombi.Helpers
|
||||||
}
|
}
|
||||||
public class MediaCacheService : CacheService, IMediaCacheService
|
public class MediaCacheService : CacheService, IMediaCacheService
|
||||||
{
|
{
|
||||||
private const string CacheKey = "MediaCacheServiceKeys";
|
private const string _cacheKey = "MediaCacheServiceKeys";
|
||||||
|
|
||||||
public MediaCacheService(IMemoryCache memoryCache) : base(memoryCache)
|
public MediaCacheService(IMemoryCache memoryCache) : base(memoryCache)
|
||||||
{
|
{
|
||||||
|
@ -43,19 +43,19 @@ namespace Ombi.Helpers
|
||||||
|
|
||||||
private void UpdateLocalCache(string cacheKey)
|
private void UpdateLocalCache(string cacheKey)
|
||||||
{
|
{
|
||||||
var mediaServiceCache = _memoryCache.Get<List<string>>(CacheKey);
|
var mediaServiceCache = _memoryCache.Get<List<string>>(_cacheKey);
|
||||||
if (mediaServiceCache == null)
|
if (mediaServiceCache == null)
|
||||||
{
|
{
|
||||||
mediaServiceCache = new List<string>();
|
mediaServiceCache = new List<string>();
|
||||||
}
|
}
|
||||||
mediaServiceCache.Add(cacheKey);
|
mediaServiceCache.Add(cacheKey);
|
||||||
_memoryCache.Remove(CacheKey);
|
_memoryCache.Remove(_cacheKey);
|
||||||
_memoryCache.Set(CacheKey, mediaServiceCache);
|
_memoryCache.Set(_cacheKey, mediaServiceCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Purge()
|
public Task Purge()
|
||||||
{
|
{
|
||||||
var keys = _memoryCache.Get<List<string>>(CacheKey);
|
var keys = _memoryCache.Get<List<string>>(_cacheKey);
|
||||||
if (keys == null)
|
if (keys == null)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|
|
@ -124,7 +124,6 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
{
|
{
|
||||||
await NotifyClient("Plex Sync - Checking if any requests are now available");
|
await NotifyClient("Plex Sync - Checking if any requests are now available");
|
||||||
Logger.LogInformation("Kicking off Plex Availability Checker");
|
Logger.LogInformation("Kicking off Plex Availability Checker");
|
||||||
await _mediaCacheService.Purge();
|
|
||||||
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
||||||
}
|
}
|
||||||
var processedCont = processedContent?.Content?.Count() ?? 0;
|
var processedCont = processedContent?.Content?.Count() ?? 0;
|
||||||
|
@ -133,6 +132,7 @@ namespace Ombi.Schedule.Jobs.Plex
|
||||||
|
|
||||||
await NotifyClient(recentlyAddedSearch ? $"Plex Recently Added Sync Finished, We processed {processedCont}, and {processedEp} Episodes" : "Plex Content Sync Finished");
|
await NotifyClient(recentlyAddedSearch ? $"Plex Recently Added Sync Finished, We processed {processedCont}, and {processedEp} Episodes" : "Plex Content Sync Finished");
|
||||||
|
|
||||||
|
await _mediaCacheService.Purge();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<ProcessedContent> StartTheCache(PlexSettings plexSettings, bool recentlyAddedSearch)
|
private async Task<ProcessedContent> StartTheCache(PlexSettings plexSettings, bool recentlyAddedSearch)
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Ombi.Schedule.Jobs.Sonarr
|
||||||
{
|
{
|
||||||
public class SonarrSync : ISonarrSync
|
public class SonarrSync : ISonarrSync
|
||||||
{
|
{
|
||||||
public SonarrSync(ISettingsService<SonarrSettings> s, ISonarrApi api, ILogger<SonarrSync> l, ExternalContext ctx,
|
public SonarrSync(ISettingsService<SonarrSettings> s, ISonarrV3Api api, ILogger<SonarrSync> l, ExternalContext ctx,
|
||||||
IMovieDbApi movieDbApi)
|
IMovieDbApi movieDbApi)
|
||||||
{
|
{
|
||||||
_settings = s;
|
_settings = s;
|
||||||
|
@ -35,7 +35,7 @@ namespace Ombi.Schedule.Jobs.Sonarr
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ISettingsService<SonarrSettings> _settings;
|
private readonly ISettingsService<SonarrSettings> _settings;
|
||||||
private readonly ISonarrApi _api;
|
private readonly ISonarrV3Api _api;
|
||||||
private readonly ILogger<SonarrSync> _log;
|
private readonly ILogger<SonarrSync> _log;
|
||||||
private readonly ExternalContext _ctx;
|
private readonly ExternalContext _ctx;
|
||||||
private readonly IMovieDbApi _movieDbApi;
|
private readonly IMovieDbApi _movieDbApi;
|
||||||
|
@ -74,8 +74,6 @@ namespace Ombi.Schedule.Jobs.Sonarr
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var existingSeries = await _ctx.SonarrCache.Select(x => x.TvDbId).ToListAsync();
|
|
||||||
|
|
||||||
var sonarrCacheToSave = new HashSet<SonarrCache>();
|
var sonarrCacheToSave = new HashSet<SonarrCache>();
|
||||||
foreach (var id in ids)
|
foreach (var id in ids)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
public string QualityProfileAnime { get; set; }
|
public string QualityProfileAnime { get; set; }
|
||||||
public string RootPathAnime { get; set; }
|
public string RootPathAnime { get; set; }
|
||||||
public bool AddOnly { get; set; }
|
public bool AddOnly { get; set; }
|
||||||
public bool V3 { get; set; }
|
|
||||||
public int LanguageProfile { get; set; }
|
public int LanguageProfile { get; set; }
|
||||||
public int LanguageProfileAnime { get; set; }
|
public int LanguageProfileAnime { get; set; }
|
||||||
public bool ScanForAvailability { get; set; }
|
public bool ScanForAvailability { get; set; }
|
||||||
|
|
3
src/Ombi/.vscode/settings.json
vendored
3
src/Ombi/.vscode/settings.json
vendored
|
@ -22,7 +22,8 @@
|
||||||
"emby",
|
"emby",
|
||||||
"availability-rules",
|
"availability-rules",
|
||||||
"details",
|
"details",
|
||||||
"requests"
|
"requests",
|
||||||
|
"sonarr"
|
||||||
],
|
],
|
||||||
"rpc.enabled": true
|
"rpc.enabled": true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
<p-carousel #carousel [value]="requests$ | async" [numVisible]="3" [numScroll]="1" [responsiveOptions]="responsiveOptions" [page]="0">
|
<div *ngIf="requests$ | async as requests">
|
||||||
|
<div *ngIf="requests.length > 0">
|
||||||
|
<p-carousel #carousel [value]="requests" [numVisible]="3" [numScroll]="1"
|
||||||
|
[responsiveOptions]="responsiveOptions" [page]="0">
|
||||||
<ng-template let-result pTemplate="item">
|
<ng-template let-result pTemplate="item">
|
||||||
<ombi-detailed-card [request]="result" [isAdmin]="isAdmin" (onClick)="navigate(result)" (onApprove)="approve(result)"></ombi-detailed-card>
|
<ombi-detailed-card [request]="result" [isAdmin]="isAdmin" (onClick)="navigate(result)"
|
||||||
|
(onApprove)="approve(result)"></ombi-detailed-card>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-carousel>
|
</p-carousel>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -142,7 +142,6 @@ export interface ISonarrSettings extends IExternalSettings {
|
||||||
rootPathAnime: string;
|
rootPathAnime: string;
|
||||||
fullRootPath: string;
|
fullRootPath: string;
|
||||||
addOnly: boolean;
|
addOnly: boolean;
|
||||||
v3: boolean;
|
|
||||||
languageProfile: number;
|
languageProfile: number;
|
||||||
languageProfileAnime: number;
|
languageProfileAnime: number;
|
||||||
scanForAvailability: boolean;
|
scanForAvailability: boolean;
|
||||||
|
|
|
@ -45,7 +45,6 @@ export class TvAdvancedOptionsComponent implements OnInit {
|
||||||
this.setRootFolderOverrides();
|
this.setRootFolderOverrides();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (settings.v3) {
|
|
||||||
this.sonarrService
|
this.sonarrService
|
||||||
.getV3LanguageProfiles(settings)
|
.getV3LanguageProfiles(settings)
|
||||||
.subscribe((profiles: ILanguageProfiles[]) => {
|
.subscribe((profiles: ILanguageProfiles[]) => {
|
||||||
|
@ -53,7 +52,6 @@ export class TvAdvancedOptionsComponent implements OnInit {
|
||||||
this.data.languages = profiles;
|
this.data.languages = profiles;
|
||||||
this.setLanguageOverride();
|
this.setLanguageOverride();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,6 @@
|
||||||
<div class="md-form-field">
|
<div class="md-form-field">
|
||||||
<mat-slide-toggle formControlName="enabled" id="enable">Enable</mat-slide-toggle>
|
<mat-slide-toggle formControlName="enabled" id="enable">Enable</mat-slide-toggle>
|
||||||
</div>
|
</div>
|
||||||
<div class="md-form-field">
|
|
||||||
<mat-slide-toggle formControlName="v3">V3</mat-slide-toggle>
|
|
||||||
</div>
|
|
||||||
<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>
|
||||||
|
@ -120,7 +117,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-12" *ngIf="form.controls.v3.value">
|
<div class="form-group col-md-12">
|
||||||
<label for="select" class="control-label">Language Profiles
|
<label for="select" class="control-label">Language Profiles
|
||||||
<i *ngIf="form.get('languageProfile').hasError('required')" class="fas fa-exclamation-circle error-text" pTooltip="A Language Profile is required"></i>
|
<i *ngIf="form.get('languageProfile').hasError('required')" class="fas fa-exclamation-circle error-text" pTooltip="A Language Profile is required"></i>
|
||||||
</label>
|
</label>
|
||||||
|
|
|
@ -72,8 +72,7 @@ export class SonarrComponent implements OnInit {
|
||||||
port: [x.port, [Validators.required]],
|
port: [x.port, [Validators.required]],
|
||||||
addOnly: [x.addOnly],
|
addOnly: [x.addOnly],
|
||||||
seasonFolders: [x.seasonFolders],
|
seasonFolders: [x.seasonFolders],
|
||||||
v3: [x.v3],
|
languageProfile: [x.languageProfile, [Validators.required, validateProfile]],
|
||||||
languageProfile: [x.languageProfile],
|
|
||||||
languageProfileAnime: [x.languageProfileAnime],
|
languageProfileAnime: [x.languageProfileAnime],
|
||||||
scanForAvailability: [x.scanForAvailability],
|
scanForAvailability: [x.scanForAvailability],
|
||||||
});
|
});
|
||||||
|
@ -87,17 +86,6 @@ export class SonarrComponent implements OnInit {
|
||||||
if (x.languageProfile) {
|
if (x.languageProfile) {
|
||||||
this.getLanguageProfiles(this.form);
|
this.getLanguageProfiles(this.form);
|
||||||
}
|
}
|
||||||
if (x.v3) {
|
|
||||||
this.form.controls.languageProfile.setValidators([Validators.required]);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.form.controls.v3.valueChanges.subscribe((val: boolean) => {
|
|
||||||
if (val) {
|
|
||||||
this.form.controls.languageProfile.setValidators([Validators.required, validateProfile]);
|
|
||||||
} else {
|
|
||||||
this.form.controls.languageProfile.clearValidators();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.formErrors ={
|
this.formErrors ={
|
||||||
apiKey: {},
|
apiKey: {},
|
||||||
|
@ -113,6 +101,7 @@ export class SonarrComponent implements OnInit {
|
||||||
this.languageProfiles = [];
|
this.languageProfiles = [];
|
||||||
this.rootFolders.push({ path: "Please Select", id: -1 });
|
this.rootFolders.push({ path: "Please Select", id: -1 });
|
||||||
this.qualities.push({ name: "Please Select", id: -1 });
|
this.qualities.push({ name: "Please Select", id: -1 });
|
||||||
|
this.languageProfiles.push({ name: "Please Select", id: -1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
public getProfiles(form: UntypedFormGroup) {
|
public getProfiles(form: UntypedFormGroup) {
|
||||||
|
@ -150,9 +139,6 @@ export class SonarrComponent implements OnInit {
|
||||||
this.langRunning = false;
|
this.langRunning = false;
|
||||||
this.notificationService.success("Successfully retrieved the Language Profiles");
|
this.notificationService.success("Successfully retrieved the Language Profiles");
|
||||||
});
|
});
|
||||||
if (this.form.controls.v3.value) {
|
|
||||||
this.form.controls.languageProfile.setValidators([Validators.required]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public test(form: UntypedFormGroup) {
|
public test(form: UntypedFormGroup) {
|
||||||
|
@ -187,7 +173,7 @@ export class SonarrComponent implements OnInit {
|
||||||
this.notificationService.error("Please check your entered values");
|
this.notificationService.error("Please check your entered values");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (form.controls.v3.value && form.controls.languageProfile) {
|
if (form.controls.languageProfile) {
|
||||||
if (form.controls.languageProfile.value === "Please Select") {
|
if (form.controls.languageProfile.value === "Please Select") {
|
||||||
this.notificationService.error("Please check your entered values");
|
this.notificationService.error("Please check your entered values");
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,11 +66,9 @@ export class AdminRequestDialogComponent implements OnInit {
|
||||||
this.sonarrEnabled = await this.sonarrService.isEnabled();
|
this.sonarrEnabled = await this.sonarrService.isEnabled();
|
||||||
if (this.sonarrEnabled) {
|
if (this.sonarrEnabled) {
|
||||||
this.settingsService.getSonarr().subscribe((settings: ISonarrSettings) => {
|
this.settingsService.getSonarr().subscribe((settings: ISonarrSettings) => {
|
||||||
if (settings.v3) {
|
|
||||||
this.sonarrService.getV3LanguageProfiles(settings).subscribe((profiles: ILanguageProfiles[]) => {
|
this.sonarrService.getV3LanguageProfiles(settings).subscribe((profiles: ILanguageProfiles[]) => {
|
||||||
this.sonarrLanguageProfiles = profiles;
|
this.sonarrLanguageProfiles = profiles;
|
||||||
})
|
})
|
||||||
}
|
|
||||||
});
|
});
|
||||||
this.sonarrService.getQualityProfilesWithoutSettings().subscribe(c => {
|
this.sonarrService.getQualityProfilesWithoutSettings().subscribe(c => {
|
||||||
this.sonarrProfiles = c;
|
this.sonarrProfiles = c;
|
||||||
|
|
|
@ -34,9 +34,9 @@ namespace Ombi.Controllers.V1.External
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("Profiles")]
|
[HttpPost("Profiles")]
|
||||||
[PowerUser]
|
[PowerUser]
|
||||||
public async Task<IEnumerable<SonarrProfile>> GetProfiles([FromBody] SonarrSettings settings)
|
public Task<IEnumerable<SonarrProfile>> GetProfiles([FromBody] SonarrSettings settings)
|
||||||
{
|
{
|
||||||
return await SonarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
|
return SonarrV3Api.GetProfiles(settings.ApiKey, settings.FullUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -46,9 +46,9 @@ namespace Ombi.Controllers.V1.External
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("RootFolders")]
|
[HttpPost("RootFolders")]
|
||||||
[PowerUser]
|
[PowerUser]
|
||||||
public async Task<IEnumerable<SonarrRootFolder>> GetRootFolders([FromBody] SonarrSettings settings)
|
public Task<IEnumerable<SonarrRootFolder>> GetRootFolders([FromBody] SonarrSettings settings)
|
||||||
{
|
{
|
||||||
return await SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
|
return SonarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -62,7 +62,7 @@ namespace Ombi.Controllers.V1.External
|
||||||
var settings = await SonarrSettings.GetSettingsAsync();
|
var settings = await SonarrSettings.GetSettingsAsync();
|
||||||
if (settings.Enabled)
|
if (settings.Enabled)
|
||||||
{
|
{
|
||||||
return await SonarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
|
return await SonarrV3Api.GetProfiles(settings.ApiKey, settings.FullUri);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace Ombi.Controllers.V1.External
|
||||||
var settings = await SonarrSettings.GetSettingsAsync();
|
var settings = await SonarrSettings.GetSettingsAsync();
|
||||||
if (settings.Enabled)
|
if (settings.Enabled)
|
||||||
{
|
{
|
||||||
return await SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
|
return await SonarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -110,7 +110,7 @@ namespace Ombi.Controllers.V1.External
|
||||||
[PowerUser]
|
[PowerUser]
|
||||||
public async Task<IEnumerable<Tag>> GetTags([FromBody] SonarrSettings settings)
|
public async Task<IEnumerable<Tag>> GetTags([FromBody] SonarrSettings settings)
|
||||||
{
|
{
|
||||||
return await SonarrApi.GetTags(settings.ApiKey, settings.FullUri);
|
return await SonarrV3Api.GetTags(settings.ApiKey, settings.FullUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ namespace Ombi.Controllers.V1.External
|
||||||
var settings = await SonarrSettings.GetSettingsAsync();
|
var settings = await SonarrSettings.GetSettingsAsync();
|
||||||
if (settings.Enabled)
|
if (settings.Enabled)
|
||||||
{
|
{
|
||||||
return await SonarrApi.GetTags(settings.ApiKey, settings.FullUri);
|
return await SonarrV3Api.GetTags(settings.ApiKey, settings.FullUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue