fix(radarr-4k): 🐛 Fixed an issue when using Radarr 4k with user set quality profiles. There are now user quality profiles for 4k profile #5025

pull/5040/head
tidusjar 1 year ago
parent d0744ce87b
commit 62b9a1f65f

@ -69,7 +69,7 @@ namespace Ombi.Core.Senders
}
if (radarrSettings.Enabled)
{
return await SendToRadarr(model, radarrSettings);
return await SendToRadarr(model, radarrSettings, is4K);
}
var dogSettings = await _dogNzbSettings.GetSettingsAsync();
@ -133,7 +133,7 @@ namespace Ombi.Core.Senders
return await _dogNzbApi.AddMovie(settings.ApiKey, id);
}
private async Task<SenderResult> SendToRadarr(MovieRequests model, RadarrSettings settings)
private async Task<SenderResult> SendToRadarr(MovieRequests model, RadarrSettings settings, bool is4k)
{
var qualityToUse = int.Parse(settings.DefaultQualityProfile);
@ -142,17 +142,35 @@ namespace Ombi.Core.Senders
var profiles = await _userProfiles.GetAll().FirstOrDefaultAsync(x => x.UserId == model.RequestedUserId);
if (profiles != null)
{
if (profiles.RadarrRootPath > 0)
if (is4k)
{
var tempPath = await RadarrRootPath(profiles.RadarrRootPath, settings);
if (tempPath.HasValue())
if (profiles.Radarr4KRootPath > 0)
{
rootFolderPath = tempPath;
var tempPath = await RadarrRootPath(profiles.Radarr4KRootPath, settings);
if (tempPath.HasValue())
{
rootFolderPath = tempPath;
}
}
}
if (profiles.RadarrQualityProfile > 0)
if (profiles.Radarr4KQualityProfile > 0)
{
qualityToUse = profiles.Radarr4KQualityProfile;
}
}
else
{
qualityToUse = profiles.RadarrQualityProfile;
if (profiles.RadarrRootPath > 0)
{
var tempPath = await RadarrRootPath(profiles.RadarrRootPath, settings);
if (tempPath.HasValue())
{
rootFolderPath = tempPath;
}
}
if (profiles.RadarrQualityProfile > 0)
{
qualityToUse = profiles.RadarrQualityProfile;
}
}
}

@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Ombi.Helpers;
namespace Ombi.Store.Entities
{
@ -15,6 +14,8 @@ namespace Ombi.Store.Entities
public int SonarrQualityProfile { get; set; }
public int RadarrRootPath { get; set; }
public int RadarrQualityProfile { get; set; }
public int Radarr4KRootPath { get; set; }
public int Radarr4KQualityProfile { get; set; }
[ForeignKey(nameof(UserId))]
[JsonIgnore]

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Ombi.Store.Migrations.OmbiMySql
{
public partial class Radarr4kUserQualityProfile : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Radarr4KQualityProfile",
table: "UserQualityProfiles",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Radarr4KRootPath",
table: "UserQualityProfiles",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Radarr4KQualityProfile",
table: "UserQualityProfiles");
migrationBuilder.DropColumn(
name: "Radarr4KRootPath",
table: "UserQualityProfiles");
}
}
}

@ -923,6 +923,12 @@ namespace Ombi.Store.Migrations.OmbiMySql
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<int>("Radarr4KQualityProfile")
.HasColumnType("int");
b.Property<int>("Radarr4KRootPath")
.HasColumnType("int");
b.Property<int>("RadarrQualityProfile")
.HasColumnType("int");

@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Ombi.Store.Migrations.OmbiSqlite
{
public partial class Radarr4kUserQualityProfile : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Radarr4KQualityProfile",
table: "UserQualityProfiles",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "Radarr4KRootPath",
table: "UserQualityProfiles",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Radarr4KQualityProfile",
table: "UserQualityProfiles");
migrationBuilder.DropColumn(
name: "Radarr4KRootPath",
table: "UserQualityProfiles");
}
}
}

@ -921,6 +921,12 @@ namespace Ombi.Store.Migrations.OmbiSqlite
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Radarr4KQualityProfile")
.HasColumnType("INTEGER");
b.Property<int>("Radarr4KRootPath")
.HasColumnType("INTEGER");
b.Property<int>("RadarrQualityProfile")
.HasColumnType("INTEGER");

@ -50,6 +50,8 @@ export interface IUserQualityProfiles {
sonarrQualityProfile: number;
radarrRootPath: number;
radarrQualityProfile: number;
radarr4KRootPath: number;
radarr4KQualityProfile: number;
}
export interface ICreateWizardUser {

@ -141,6 +141,24 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="radarr4KQualities">
<mat-label>Radarr 4K Quality Profiles</mat-label>
<mat-select [(ngModel)]="user.userQualityProfiles.radarr4KQualityProfile">
<mat-option *ngFor="let folder of radarr4KQualities" [value]="folder.id">
{{folder.name}}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field *ngIf="radarr4KRootFolders">
<mat-label>Radarr 4K Root Folder</mat-label>
<mat-select [(ngModel)]="user.userQualityProfiles.radarr4KRootPath">
<mat-option *ngFor="let folder of radarr4KRootFolders" [value]="folder.id">
{{folder.path}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="col-md-2 col-sm-12">

@ -24,6 +24,8 @@ export class UserManagementUserComponent implements OnInit {
public sonarrRootFolders: ISonarrRootFolder[];
public radarrQualities: IRadarrProfile[];
public radarrRootFolders: IRadarrRootFolder[];
public radarr4KQualities: IRadarrProfile[];
public radarr4KRootFolders: IRadarrRootFolder[];
public NotificationAgent = INotificationAgent;
public edit: boolean;
@ -93,6 +95,17 @@ export class UserManagementUserComponent implements OnInit {
this.radarrRootFolders.unshift({id: 0, path: "None"});
});
if (is4KEnabled) {
this.radarrService.getRootFolders4kFromSettings().subscribe(x => {
this.radarr4KRootFolders = x;
this.radarr4KRootFolders.unshift({id: 0, path: "None"});
});
this.radarrService.getQualityProfiles4kFromSettings().subscribe(x => {
this.radarr4KQualities = x;
this.radarr4KQualities.unshift({id: 0, name: "None"});
});
}
this.identityService.getUserAccessToken(this.userId).subscribe(x => this.accessToken = x);
if(!this.edit) {
@ -118,6 +131,8 @@ export class UserManagementUserComponent implements OnInit {
userQualityProfiles: {
radarrQualityProfile: 0,
radarrRootPath: 0,
radarr4KQualityProfile: 0,
radarr4KRootPath: 0,
sonarrQualityProfile: 0,
sonarrQualityProfileAnime: 0,
sonarrRootPath: 0,

File diff suppressed because it is too large Load Diff

@ -691,6 +691,8 @@ namespace Ombi.Controllers.V1
currentQualityProfiles.SonarrQualityProfileAnime = ui.UserQualityProfiles.SonarrQualityProfileAnime;
currentQualityProfiles.SonarrRootPath = ui.UserQualityProfiles.SonarrRootPath;
currentQualityProfiles.SonarrRootPathAnime = ui.UserQualityProfiles.SonarrRootPathAnime;
currentQualityProfiles.Radarr4KRootPath = ui.UserQualityProfiles.Radarr4KRootPath;
currentQualityProfiles.Radarr4KQualityProfile = ui.UserQualityProfiles.Radarr4KQualityProfile;
if (add)
{
await _userQualityProfiles.Add(currentQualityProfiles);

@ -51,6 +51,14 @@
<None Remove="wwwroot\dist\**" />
</ItemGroup>
<ItemGroup>
<Content Remove="database.json" />
</ItemGroup>
<ItemGroup>
<None Include="database.json" />
</ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

Loading…
Cancel
Save