Added a default set of root folders and qualities for Anime in Sonarr

pull/2267/head
Jamie Rees 6 years ago
parent 7d76bb8550
commit 4afe4fc9fc

@ -118,17 +118,31 @@ namespace Ombi.Core.Senders
return null; 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) 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; 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 try
{ {
// Does the series actually exist? // Does the series actually exist?

@ -13,6 +13,10 @@
/// The root path. /// The root path.
/// </value> /// </value>
public string RootPath { get; set; } public string RootPath { get; set; }
public string QualityProfileAnime { get; set; }
public string RootPathAnime { get; set; }
public bool AddOnly { get; set; } public bool AddOnly { get; set; }
} }
} }

@ -65,8 +65,10 @@ export interface ISonarrSettings extends IExternalSettings {
apiKey: string; apiKey: string;
enabled: boolean; enabled: boolean;
qualityProfile: string; qualityProfile: string;
qualityProfileAnime: string;
seasonFolders: boolean; seasonFolders: boolean;
rootPath: string; rootPath: string;
rootPathAnime: string;
fullRootPath: string; fullRootPath: string;
addOnly: boolean; addOnly: boolean;
} }

@ -68,6 +68,14 @@
<small *ngIf="form.get('qualityProfile').hasError('required')" class="error-text">A Default Quality Profile is required</small> <small *ngIf="form.get('qualityProfile').hasError('required')" class="error-text">A Default Quality Profile is required</small>
</div> </div>
<div class="form-group">
<label for="select" class="control-label">Quality Profiles (Anime)</label>
<div id="qualityProfileAnime">
<select class="form-control form-control-custom" id="qualityProfileAnime" formControlName="qualityProfileAnime">
<option *ngFor="let quality of qualities" value="{{quality.id}}" >{{quality.name}}</option>
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<div> <div>
@ -85,6 +93,15 @@
<small *ngIf="form.get('rootPath').hasError('required')" class="error-text">A Default Root Path is required</small> <small *ngIf="form.get('rootPath').hasError('required')" class="error-text">A Default Root Path is required</small>
</div> </div>
<div class="form-group">
<label for="rootFoldersAnime" class="control-label">Default Root Folders (Anime)</label>
<div id="rootFoldersAnime">
<select class="form-control form-control-custom" formControlName="rootPathAnime">
<option *ngFor="let folder of rootFoldersAnime" value="{{folder.id}}">{{folder.path}}</option>
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">

@ -15,7 +15,9 @@ import { SettingsService } from "../../services";
export class SonarrComponent implements OnInit { export class SonarrComponent implements OnInit {
public qualities: ISonarrProfile[]; public qualities: ISonarrProfile[];
public qualitiesAnime: ISonarrProfile[];
public rootFolders: ISonarrRootFolder[]; public rootFolders: ISonarrRootFolder[];
public rootFoldersAnime: ISonarrRootFolder[];
public selectedRootFolder: ISonarrRootFolder; public selectedRootFolder: ISonarrRootFolder;
public selectedQuality: ISonarrProfile; public selectedQuality: ISonarrProfile;
public profilesRunning: boolean; public profilesRunning: boolean;
@ -37,6 +39,8 @@ export class SonarrComponent implements OnInit {
apiKey: [x.apiKey, [Validators.required]], apiKey: [x.apiKey, [Validators.required]],
qualityProfile: [x.qualityProfile, [Validators.required]], qualityProfile: [x.qualityProfile, [Validators.required]],
rootPath: [x.rootPath, [Validators.required]], rootPath: [x.rootPath, [Validators.required]],
qualityProfileAnime: [x.qualityProfileAnime],
rootPathAnime: [x.rootPathAnime],
ssl: [x.ssl], ssl: [x.ssl],
subDir: [x.subDir], subDir: [x.subDir],
ip: [x.ip, [Validators.required]], ip: [x.ip, [Validators.required]],
@ -64,6 +68,7 @@ export class SonarrComponent implements OnInit {
.subscribe(x => { .subscribe(x => {
this.qualities = x; this.qualities = x;
this.qualities.unshift({ name: "Please Select", id: -1 }); this.qualities.unshift({ name: "Please Select", id: -1 });
this.qualitiesAnime = x;
this.profilesRunning = false; this.profilesRunning = false;
this.notificationService.success("Successfully retrieved the Quality Profiles"); this.notificationService.success("Successfully retrieved the Quality Profiles");
@ -76,6 +81,7 @@ export class SonarrComponent implements OnInit {
.subscribe(x => { .subscribe(x => {
this.rootFolders = x; this.rootFolders = x;
this.rootFolders.unshift({ path: "Please Select", id: -1 }); this.rootFolders.unshift({ path: "Please Select", id: -1 });
this.rootFoldersAnime = x;
this.rootFoldersRunning = false; this.rootFoldersRunning = false;
this.notificationService.success("Successfully retrieved the Root Folders"); this.notificationService.success("Successfully retrieved the Root Folders");

Loading…
Cancel
Save