Skip to content

Commit

Permalink
fix(radarr-4k): 🐛 Fixed an issue when using Radarr 4k with user set q…
Browse files Browse the repository at this point in the history
…uality profiles. There are now user quality profiles for 4k profile #5025
  • Loading branch information
tidusjar committed Nov 18, 2023
1 parent d0744ce commit 62b9a1f
Show file tree
Hide file tree
Showing 14 changed files with 21,612 additions and 13,919 deletions.
36 changes: 27 additions & 9 deletions src/Ombi.Core/Senders/MovieSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task<SenderResult> Send(MovieRequests model, bool is4K)
}
if (radarrSettings.Enabled)
{
return await SendToRadarr(model, radarrSettings);
return await SendToRadarr(model, radarrSettings, is4K);
}

var dogSettings = await _dogNzbSettings.GetSettingsAsync();
Expand Down Expand Up @@ -133,7 +133,7 @@ private async Task<DogNzbMovieAddResult> SendToDogNzb(FullBaseRequest model, Dog
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);

Expand All @@ -142,17 +142,35 @@ private async Task<SenderResult> SendToRadarr(MovieRequests model, RadarrSetting
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;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/Ombi.Store/Entities/UserQualityProfiles.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Ombi.Helpers;

namespace Ombi.Store.Entities
{
Expand All @@ -15,6 +14,8 @@ public class UserQualityProfiles : Entity
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]
Expand Down
Loading

0 comments on commit 62b9a1f

Please sign in to comment.