From 4afe4fc9fceefcebead1f2783ddc85340cbaaacb Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Tue, 22 May 2018 15:12:10 +0100 Subject: [PATCH] Added a default set of root folders and qualities for Anime in Sonarr --- src/Ombi.Core/Senders/TvSender.cs | 26 ++++++++++++++----- .../Models/External/SonarrSettings.cs | 4 +++ .../ClientApp/app/interfaces/ISettings.ts | 2 ++ .../app/settings/sonarr/sonarr.component.html | 17 ++++++++++++ .../app/settings/sonarr/sonarr.component.ts | 6 +++++ 5 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs index cdf834fa5..9ebe3c328 100644 --- a/src/Ombi.Core/Senders/TvSender.cs +++ b/src/Ombi.Core/Senders/TvSender.cs @@ -118,17 +118,31 @@ namespace Ombi.Core.Senders return null; } - int.TryParse(s.QualityProfile, out var qualityToUse); + int qualityToUse; + string rootFolderPath; + + if (model.SeriesType == SeriesType.Anime) + { + // Get the root path from the rootfolder selected. + // For some reason, if we haven't got one use the first root folder in Sonarr + // TODO make this overrideable via the UI + rootFolderPath = await GetSonarrRootPath(model.ParentRequest.RootFolder ?? int.Parse(s.RootPathAnime), s); + int.TryParse(s.QualityProfileAnime, out qualityToUse); + } + else + { + int.TryParse(s.QualityProfile, out qualityToUse); + } if (model.ParentRequest.QualityOverride.HasValue) { + // Get the root path from the rootfolder selected. + // For some reason, if we haven't got one use the first root folder in Sonarr + // TODO make this overrideable via the UI + rootFolderPath = await GetSonarrRootPath(model.ParentRequest.RootFolder ?? int.Parse(s.RootPath), s); qualityToUse = model.ParentRequest.QualityOverride.Value; } - - // Get the root path from the rootfolder selected. - // For some reason, if we haven't got one use the first root folder in Sonarr - // TODO make this overrideable via the UI - var rootFolderPath = await GetSonarrRootPath(model.ParentRequest.RootFolder ?? int.Parse(s.RootPath), s); + try { // Does the series actually exist? diff --git a/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs b/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs index 789b8f384..0c7e17900 100644 --- a/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs +++ b/src/Ombi.Settings/Settings/Models/External/SonarrSettings.cs @@ -13,6 +13,10 @@ /// The root path. /// public string RootPath { get; set; } + + + public string QualityProfileAnime { get; set; } + public string RootPathAnime { get; set; } public bool AddOnly { get; set; } } } \ No newline at end of file diff --git a/src/Ombi/ClientApp/app/interfaces/ISettings.ts b/src/Ombi/ClientApp/app/interfaces/ISettings.ts index 8e7fdbe1c..dc1825c83 100644 --- a/src/Ombi/ClientApp/app/interfaces/ISettings.ts +++ b/src/Ombi/ClientApp/app/interfaces/ISettings.ts @@ -65,8 +65,10 @@ export interface ISonarrSettings extends IExternalSettings { apiKey: string; enabled: boolean; qualityProfile: string; + qualityProfileAnime: string; seasonFolders: boolean; rootPath: string; + rootPathAnime: string; fullRootPath: string; addOnly: boolean; } diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html index e041ab0d0..6a419feab 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.html @@ -68,6 +68,14 @@ A Default Quality Profile is required +
+ +
+ +
+
@@ -85,6 +93,15 @@ A Default Root Path is required
+
+ +
+ +
+ +
diff --git a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts index bb69760ef..03fadb2b7 100644 --- a/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts +++ b/src/Ombi/ClientApp/app/settings/sonarr/sonarr.component.ts @@ -15,7 +15,9 @@ import { SettingsService } from "../../services"; export class SonarrComponent implements OnInit { public qualities: ISonarrProfile[]; + public qualitiesAnime: ISonarrProfile[]; public rootFolders: ISonarrRootFolder[]; + public rootFoldersAnime: ISonarrRootFolder[]; public selectedRootFolder: ISonarrRootFolder; public selectedQuality: ISonarrProfile; public profilesRunning: boolean; @@ -37,6 +39,8 @@ export class SonarrComponent implements OnInit { apiKey: [x.apiKey, [Validators.required]], qualityProfile: [x.qualityProfile, [Validators.required]], rootPath: [x.rootPath, [Validators.required]], + qualityProfileAnime: [x.qualityProfileAnime], + rootPathAnime: [x.rootPathAnime], ssl: [x.ssl], subDir: [x.subDir], ip: [x.ip, [Validators.required]], @@ -64,6 +68,7 @@ export class SonarrComponent implements OnInit { .subscribe(x => { this.qualities = x; this.qualities.unshift({ name: "Please Select", id: -1 }); + this.qualitiesAnime = x; this.profilesRunning = false; this.notificationService.success("Successfully retrieved the Quality Profiles"); @@ -76,6 +81,7 @@ export class SonarrComponent implements OnInit { .subscribe(x => { this.rootFolders = x; this.rootFolders.unshift({ path: "Please Select", id: -1 }); + this.rootFoldersAnime = x; this.rootFoldersRunning = false; this.notificationService.success("Successfully retrieved the Root Folders");