mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-24 14:37:07 -04:00
New: Allow user to choose whether delay profile should apply to release of the highest enabled quality (#6218)
(cherry picked from commit d668e923af83ab7f1589d947fec9f40a3919e0b8) Co-authored-by: Taloth Saldono <Taloth@users.noreply.github.com>
This commit is contained in:
parent
df3253f55c
commit
af99c78352
8 changed files with 63 additions and 8 deletions
|
@ -40,6 +40,7 @@ function EditDelayProfileModalContent(props) {
|
|||
enableTorrent,
|
||||
usenetDelay,
|
||||
torrentDelay,
|
||||
bypassIfHighestQuality,
|
||||
tags
|
||||
} = item;
|
||||
|
||||
|
@ -110,6 +111,20 @@ function EditDelayProfileModalContent(props) {
|
|||
</FormGroup>
|
||||
}
|
||||
|
||||
{
|
||||
<FormGroup>
|
||||
<FormLabel>{translate('BypassDelayIfHighestQuality')}</FormLabel>
|
||||
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="bypassIfHighestQuality"
|
||||
{...bypassIfHighestQuality}
|
||||
helpText={translate('BypassDelayIfHighestQualityHelpText')}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
</FormGroup>
|
||||
}
|
||||
|
||||
{
|
||||
id === 1 ?
|
||||
<Alert>
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace NzbDrone.Api.Profiles.Delay
|
|||
public DownloadProtocol PreferredProtocol { get; set; }
|
||||
public int UsenetDelay { get; set; }
|
||||
public int TorrentDelay { get; set; }
|
||||
public bool BypassIfHighestQuality { get; set; }
|
||||
public int Order { get; set; }
|
||||
public HashSet<int> Tags { get; set; }
|
||||
}
|
||||
|
@ -35,6 +36,7 @@ namespace NzbDrone.Api.Profiles.Delay
|
|||
PreferredProtocol = model.PreferredProtocol,
|
||||
UsenetDelay = model.UsenetDelay,
|
||||
TorrentDelay = model.TorrentDelay,
|
||||
BypassIfHighestQuality = model.BypassIfHighestQuality,
|
||||
Order = model.Order,
|
||||
Tags = new HashSet<int>(model.Tags)
|
||||
};
|
||||
|
@ -56,6 +58,7 @@ namespace NzbDrone.Api.Profiles.Delay
|
|||
PreferredProtocol = resource.PreferredProtocol,
|
||||
UsenetDelay = resource.UsenetDelay,
|
||||
TorrentDelay = resource.TorrentDelay,
|
||||
BypassIfHighestQuality = resource.BypassIfHighestQuality,
|
||||
Order = resource.Order,
|
||||
Tags = new HashSet<int>(resource.Tags)
|
||||
};
|
||||
|
|
|
@ -104,10 +104,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_true_when_quality_is_last_allowed_in_profile()
|
||||
public void should_be_false_when_quality_is_last_allowed_in_profile_and_bypass_disabled()
|
||||
{
|
||||
_remoteMovie.ParsedMovieInfo.Quality = new QualityModel(Quality.Bluray720p);
|
||||
|
||||
_remoteMovie.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_true_when_quality_is_last_allowed_in_profile_and_bypass_enabled()
|
||||
{
|
||||
_delayProfile.BypassIfHighestQuality = true;
|
||||
|
||||
_remoteMovie.ParsedMovieInfo.Quality = new QualityModel(Quality.Bluray720p);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteMovie, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(194)]
|
||||
public class add_bypass_to_delay_profile : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("DelayProfiles").AddColumn("BypassIfHighestQuality").AsBoolean().WithDefaultValue(false);
|
||||
|
||||
// Set to true for existing Delay Profiles to keep behavior the same.
|
||||
Execute.Sql("UPDATE DelayProfiles SET BypassIfHighestQuality = 1;");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.CustomFormats;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
|
@ -78,13 +77,16 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
|||
}
|
||||
|
||||
// If quality meets or exceeds the best allowed quality in the profile accept it immediately
|
||||
var bestQualityInProfile = profile.LastAllowedQuality();
|
||||
var isBestInProfile = comparer.Compare(subject.ParsedMovieInfo.Quality.Quality, bestQualityInProfile) >= 0;
|
||||
|
||||
if (isBestInProfile && isPreferredProtocol)
|
||||
if (delayProfile.BypassIfHighestQuality)
|
||||
{
|
||||
_logger.Debug("Quality is highest in profile for preferred protocol, will not delay.");
|
||||
return Decision.Accept();
|
||||
var bestQualityInProfile = profile.LastAllowedQuality();
|
||||
var isBestInProfile = comparer.Compare(subject.ParsedMovieInfo.Quality.Quality, bestQualityInProfile) >= 0;
|
||||
|
||||
if (isBestInProfile && isPreferredProtocol)
|
||||
{
|
||||
_logger.Debug("Quality is highest in profile for preferred protocol, will not delay.");
|
||||
return Decision.Accept();
|
||||
}
|
||||
}
|
||||
|
||||
var oldest = _pendingReleaseService.OldestPendingRelease(subject.Movie.Id);
|
||||
|
|
|
@ -94,6 +94,8 @@
|
|||
"BranchUpdate": "Branch to use to update Radarr",
|
||||
"BranchUpdateMechanism": "Branch used by external update mechanism",
|
||||
"BuiltIn": "Built In",
|
||||
"BypassDelayIfHighestQuality": "Bypass if Highest Quality",
|
||||
"BypassDelayIfHighestQualityHelpText": "Bypass delay when release has the highest enabled quality in the quality profile",
|
||||
"BypassProxyForLocalAddresses": "Bypass Proxy for Local Addresses",
|
||||
"Calendar": "Calendar",
|
||||
"CalendarOptions": "Calendar Options",
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace NzbDrone.Core.Profiles.Delay
|
|||
public int UsenetDelay { get; set; }
|
||||
public int TorrentDelay { get; set; }
|
||||
public int Order { get; set; }
|
||||
public bool BypassIfHighestQuality { get; set; }
|
||||
public HashSet<int> Tags { get; set; }
|
||||
|
||||
public DelayProfile()
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace Radarr.Api.V3.Profiles.Delay
|
|||
public DownloadProtocol PreferredProtocol { get; set; }
|
||||
public int UsenetDelay { get; set; }
|
||||
public int TorrentDelay { get; set; }
|
||||
public bool BypassIfHighestQuality { get; set; }
|
||||
public int Order { get; set; }
|
||||
public HashSet<int> Tags { get; set; }
|
||||
}
|
||||
|
@ -35,6 +36,7 @@ namespace Radarr.Api.V3.Profiles.Delay
|
|||
PreferredProtocol = model.PreferredProtocol,
|
||||
UsenetDelay = model.UsenetDelay,
|
||||
TorrentDelay = model.TorrentDelay,
|
||||
BypassIfHighestQuality = model.BypassIfHighestQuality,
|
||||
Order = model.Order,
|
||||
Tags = new HashSet<int>(model.Tags)
|
||||
};
|
||||
|
@ -56,6 +58,7 @@ namespace Radarr.Api.V3.Profiles.Delay
|
|||
PreferredProtocol = resource.PreferredProtocol,
|
||||
UsenetDelay = resource.UsenetDelay,
|
||||
TorrentDelay = resource.TorrentDelay,
|
||||
BypassIfHighestQuality = resource.BypassIfHighestQuality,
|
||||
Order = resource.Order,
|
||||
Tags = new HashSet<int>(resource.Tags)
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue