mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -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 string name { get; set; }
|
||||
public Cutoff cutoff { get; set; }
|
||||
public List<Item> items { get; set; }
|
||||
public int id { get; set; }
|
||||
}
|
||||
}
|
|
@ -157,7 +157,6 @@ namespace Ombi.Core.Senders
|
|||
}
|
||||
|
||||
int qualityToUse;
|
||||
var sonarrV3 = s.V3;
|
||||
var languageProfileId = s.LanguageProfile;
|
||||
string rootFolderPath;
|
||||
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
|
||||
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.
|
||||
}
|
||||
};
|
||||
},
|
||||
languageProfileId = languageProfileId
|
||||
};
|
||||
|
||||
if (sonarrV3)
|
||||
{
|
||||
newSeries.languageProfileId = languageProfileId;
|
||||
}
|
||||
|
||||
|
||||
// Montitor the correct seasons,
|
||||
// If we have that season in the model then it's monitored!
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Ombi.Helpers
|
|||
}
|
||||
public class MediaCacheService : CacheService, IMediaCacheService
|
||||
{
|
||||
private const string CacheKey = "MediaCacheServiceKeys";
|
||||
private const string _cacheKey = "MediaCacheServiceKeys";
|
||||
|
||||
public MediaCacheService(IMemoryCache memoryCache) : base(memoryCache)
|
||||
{
|
||||
|
@ -43,19 +43,19 @@ namespace Ombi.Helpers
|
|||
|
||||
private void UpdateLocalCache(string cacheKey)
|
||||
{
|
||||
var mediaServiceCache = _memoryCache.Get<List<string>>(CacheKey);
|
||||
var mediaServiceCache = _memoryCache.Get<List<string>>(_cacheKey);
|
||||
if (mediaServiceCache == null)
|
||||
{
|
||||
mediaServiceCache = new List<string>();
|
||||
}
|
||||
mediaServiceCache.Add(cacheKey);
|
||||
_memoryCache.Remove(CacheKey);
|
||||
_memoryCache.Set(CacheKey, mediaServiceCache);
|
||||
_memoryCache.Remove(_cacheKey);
|
||||
_memoryCache.Set(_cacheKey, mediaServiceCache);
|
||||
}
|
||||
|
||||
public Task Purge()
|
||||
{
|
||||
var keys = _memoryCache.Get<List<string>>(CacheKey);
|
||||
var keys = _memoryCache.Get<List<string>>(_cacheKey);
|
||||
if (keys == null)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
|
|
|
@ -124,7 +124,6 @@ namespace Ombi.Schedule.Jobs.Plex
|
|||
{
|
||||
await NotifyClient("Plex Sync - Checking if any requests are now available");
|
||||
Logger.LogInformation("Kicking off Plex Availability Checker");
|
||||
await _mediaCacheService.Purge();
|
||||
await OmbiQuartz.TriggerJob(nameof(IPlexAvailabilityChecker), "Plex");
|
||||
}
|
||||
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 _mediaCacheService.Purge();
|
||||
}
|
||||
|
||||
private async Task<ProcessedContent> StartTheCache(PlexSettings plexSettings, bool recentlyAddedSearch)
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Ombi.Schedule.Jobs.Sonarr
|
|||
{
|
||||
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)
|
||||
{
|
||||
_settings = s;
|
||||
|
@ -35,7 +35,7 @@ namespace Ombi.Schedule.Jobs.Sonarr
|
|||
}
|
||||
|
||||
private readonly ISettingsService<SonarrSettings> _settings;
|
||||
private readonly ISonarrApi _api;
|
||||
private readonly ISonarrV3Api _api;
|
||||
private readonly ILogger<SonarrSync> _log;
|
||||
private readonly ExternalContext _ctx;
|
||||
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>();
|
||||
foreach (var id in ids)
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
public string QualityProfileAnime { get; set; }
|
||||
public string RootPathAnime { get; set; }
|
||||
public bool AddOnly { get; set; }
|
||||
public bool V3 { get; set; }
|
||||
public int LanguageProfile { get; set; }
|
||||
public int LanguageProfileAnime { 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",
|
||||
"availability-rules",
|
||||
"details",
|
||||
"requests"
|
||||
"requests",
|
||||
"sonarr"
|
||||
],
|
||||
"rpc.enabled": true
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<p-carousel #carousel [value]="requests$ | async" [numVisible]="3" [numScroll]="1" [responsiveOptions]="responsiveOptions" [page]="0">
|
||||
<ng-template let-result pTemplate="item">
|
||||
<ombi-detailed-card [request]="result" [isAdmin]="isAdmin" (onClick)="navigate(result)" (onApprove)="approve(result)"></ombi-detailed-card>
|
||||
</ng-template>
|
||||
</p-carousel>
|
||||
<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">
|
||||
<ombi-detailed-card [request]="result" [isAdmin]="isAdmin" (onClick)="navigate(result)"
|
||||
(onApprove)="approve(result)"></ombi-detailed-card>
|
||||
</ng-template>
|
||||
</p-carousel>
|
||||
</div>
|
||||
</div>
|
|
@ -142,7 +142,6 @@ export interface ISonarrSettings extends IExternalSettings {
|
|||
rootPathAnime: string;
|
||||
fullRootPath: string;
|
||||
addOnly: boolean;
|
||||
v3: boolean;
|
||||
languageProfile: number;
|
||||
languageProfileAnime: number;
|
||||
scanForAvailability: boolean;
|
||||
|
|
|
@ -45,7 +45,6 @@ export class TvAdvancedOptionsComponent implements OnInit {
|
|||
this.setRootFolderOverrides();
|
||||
});
|
||||
|
||||
if (settings.v3) {
|
||||
this.sonarrService
|
||||
.getV3LanguageProfiles(settings)
|
||||
.subscribe((profiles: ILanguageProfiles[]) => {
|
||||
|
@ -53,7 +52,6 @@ export class TvAdvancedOptionsComponent implements OnInit {
|
|||
this.data.languages = profiles;
|
||||
this.setLanguageOverride();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
<div class="md-form-field">
|
||||
<mat-slide-toggle formControlName="enabled" id="enable">Enable</mat-slide-toggle>
|
||||
</div>
|
||||
<div class="md-form-field">
|
||||
<mat-slide-toggle formControlName="v3">V3</mat-slide-toggle>
|
||||
</div>
|
||||
<div class="md-form-field">
|
||||
<mat-slide-toggle [(ngModel)]="advanced" [ngModelOptions]="{standalone: true}">Advanced</mat-slide-toggle>
|
||||
</div>
|
||||
|
@ -120,8 +117,8 @@
|
|||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-12" *ngIf="form.controls.v3.value">
|
||||
<label for="select" class="control-label">Language Profiles
|
||||
<div class="form-group col-md-12">
|
||||
<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>
|
||||
</label>
|
||||
<div id="langaugeProfile">
|
||||
|
|
|
@ -72,8 +72,7 @@ export class SonarrComponent implements OnInit {
|
|||
port: [x.port, [Validators.required]],
|
||||
addOnly: [x.addOnly],
|
||||
seasonFolders: [x.seasonFolders],
|
||||
v3: [x.v3],
|
||||
languageProfile: [x.languageProfile],
|
||||
languageProfile: [x.languageProfile, [Validators.required, validateProfile]],
|
||||
languageProfileAnime: [x.languageProfileAnime],
|
||||
scanForAvailability: [x.scanForAvailability],
|
||||
});
|
||||
|
@ -87,17 +86,6 @@ export class SonarrComponent implements OnInit {
|
|||
if (x.languageProfile) {
|
||||
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 ={
|
||||
apiKey: {},
|
||||
|
@ -113,6 +101,7 @@ export class SonarrComponent implements OnInit {
|
|||
this.languageProfiles = [];
|
||||
this.rootFolders.push({ path: "Please Select", id: -1 });
|
||||
this.qualities.push({ name: "Please Select", id: -1 });
|
||||
this.languageProfiles.push({ name: "Please Select", id: -1 });
|
||||
}
|
||||
|
||||
public getProfiles(form: UntypedFormGroup) {
|
||||
|
@ -150,9 +139,6 @@ export class SonarrComponent implements OnInit {
|
|||
this.langRunning = false;
|
||||
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) {
|
||||
|
@ -187,7 +173,7 @@ export class SonarrComponent implements OnInit {
|
|||
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") {
|
||||
this.notificationService.error("Please check your entered values");
|
||||
}
|
||||
|
|
|
@ -66,11 +66,9 @@ export class AdminRequestDialogComponent implements OnInit {
|
|||
this.sonarrEnabled = await this.sonarrService.isEnabled();
|
||||
if (this.sonarrEnabled) {
|
||||
this.settingsService.getSonarr().subscribe((settings: ISonarrSettings) => {
|
||||
if (settings.v3) {
|
||||
this.sonarrService.getV3LanguageProfiles(settings).subscribe((profiles: ILanguageProfiles[]) => {
|
||||
this.sonarrLanguageProfiles = profiles;
|
||||
})
|
||||
}
|
||||
});
|
||||
this.sonarrService.getQualityProfilesWithoutSettings().subscribe(c => {
|
||||
this.sonarrProfiles = c;
|
||||
|
|
|
@ -34,9 +34,9 @@ namespace Ombi.Controllers.V1.External
|
|||
/// <returns></returns>
|
||||
[HttpPost("Profiles")]
|
||||
[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>
|
||||
|
@ -46,9 +46,9 @@ namespace Ombi.Controllers.V1.External
|
|||
/// <returns></returns>
|
||||
[HttpPost("RootFolders")]
|
||||
[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>
|
||||
|
@ -62,7 +62,7 @@ namespace Ombi.Controllers.V1.External
|
|||
var settings = await SonarrSettings.GetSettingsAsync();
|
||||
if (settings.Enabled)
|
||||
{
|
||||
return await SonarrApi.GetProfiles(settings.ApiKey, settings.FullUri);
|
||||
return await SonarrV3Api.GetProfiles(settings.ApiKey, settings.FullUri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace Ombi.Controllers.V1.External
|
|||
var settings = await SonarrSettings.GetSettingsAsync();
|
||||
if (settings.Enabled)
|
||||
{
|
||||
return await SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri);
|
||||
return await SonarrV3Api.GetRootFolders(settings.ApiKey, settings.FullUri);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -110,7 +110,7 @@ namespace Ombi.Controllers.V1.External
|
|||
[PowerUser]
|
||||
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();
|
||||
if (settings.Enabled)
|
||||
{
|
||||
return await SonarrApi.GetTags(settings.ApiKey, settings.FullUri);
|
||||
return await SonarrV3Api.GetTags(settings.ApiKey, settings.FullUri);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue