mirror of
https://github.com/Radarr/Radarr.git
synced 2025-04-25 06:57:08 -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,
|
enableTorrent,
|
||||||
usenetDelay,
|
usenetDelay,
|
||||||
torrentDelay,
|
torrentDelay,
|
||||||
|
bypassIfHighestQuality,
|
||||||
tags
|
tags
|
||||||
} = item;
|
} = item;
|
||||||
|
|
||||||
|
@ -110,6 +111,20 @@ function EditDelayProfileModalContent(props) {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
<FormGroup>
|
||||||
|
<FormLabel>{translate('BypassDelayIfHighestQuality')}</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.CHECK}
|
||||||
|
name="bypassIfHighestQuality"
|
||||||
|
{...bypassIfHighestQuality}
|
||||||
|
helpText={translate('BypassDelayIfHighestQualityHelpText')}
|
||||||
|
onChange={onInputChange}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
id === 1 ?
|
id === 1 ?
|
||||||
<Alert>
|
<Alert>
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace NzbDrone.Api.Profiles.Delay
|
||||||
public DownloadProtocol PreferredProtocol { get; set; }
|
public DownloadProtocol PreferredProtocol { get; set; }
|
||||||
public int UsenetDelay { get; set; }
|
public int UsenetDelay { get; set; }
|
||||||
public int TorrentDelay { get; set; }
|
public int TorrentDelay { get; set; }
|
||||||
|
public bool BypassIfHighestQuality { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
public HashSet<int> Tags { get; set; }
|
public HashSet<int> Tags { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -35,6 +36,7 @@ namespace NzbDrone.Api.Profiles.Delay
|
||||||
PreferredProtocol = model.PreferredProtocol,
|
PreferredProtocol = model.PreferredProtocol,
|
||||||
UsenetDelay = model.UsenetDelay,
|
UsenetDelay = model.UsenetDelay,
|
||||||
TorrentDelay = model.TorrentDelay,
|
TorrentDelay = model.TorrentDelay,
|
||||||
|
BypassIfHighestQuality = model.BypassIfHighestQuality,
|
||||||
Order = model.Order,
|
Order = model.Order,
|
||||||
Tags = new HashSet<int>(model.Tags)
|
Tags = new HashSet<int>(model.Tags)
|
||||||
};
|
};
|
||||||
|
@ -56,6 +58,7 @@ namespace NzbDrone.Api.Profiles.Delay
|
||||||
PreferredProtocol = resource.PreferredProtocol,
|
PreferredProtocol = resource.PreferredProtocol,
|
||||||
UsenetDelay = resource.UsenetDelay,
|
UsenetDelay = resource.UsenetDelay,
|
||||||
TorrentDelay = resource.TorrentDelay,
|
TorrentDelay = resource.TorrentDelay,
|
||||||
|
BypassIfHighestQuality = resource.BypassIfHighestQuality,
|
||||||
Order = resource.Order,
|
Order = resource.Order,
|
||||||
Tags = new HashSet<int>(resource.Tags)
|
Tags = new HashSet<int>(resource.Tags)
|
||||||
};
|
};
|
||||||
|
|
|
@ -104,10 +104,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[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.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();
|
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 NLog;
|
||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.Download.Pending;
|
using NzbDrone.Core.Download.Pending;
|
||||||
|
@ -78,6 +77,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||||
}
|
}
|
||||||
|
|
||||||
// If quality meets or exceeds the best allowed quality in the profile accept it immediately
|
// If quality meets or exceeds the best allowed quality in the profile accept it immediately
|
||||||
|
if (delayProfile.BypassIfHighestQuality)
|
||||||
|
{
|
||||||
var bestQualityInProfile = profile.LastAllowedQuality();
|
var bestQualityInProfile = profile.LastAllowedQuality();
|
||||||
var isBestInProfile = comparer.Compare(subject.ParsedMovieInfo.Quality.Quality, bestQualityInProfile) >= 0;
|
var isBestInProfile = comparer.Compare(subject.ParsedMovieInfo.Quality.Quality, bestQualityInProfile) >= 0;
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync
|
||||||
_logger.Debug("Quality is highest in profile for preferred protocol, will not delay.");
|
_logger.Debug("Quality is highest in profile for preferred protocol, will not delay.");
|
||||||
return Decision.Accept();
|
return Decision.Accept();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var oldest = _pendingReleaseService.OldestPendingRelease(subject.Movie.Id);
|
var oldest = _pendingReleaseService.OldestPendingRelease(subject.Movie.Id);
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,8 @@
|
||||||
"BranchUpdate": "Branch to use to update Radarr",
|
"BranchUpdate": "Branch to use to update Radarr",
|
||||||
"BranchUpdateMechanism": "Branch used by external update mechanism",
|
"BranchUpdateMechanism": "Branch used by external update mechanism",
|
||||||
"BuiltIn": "Built In",
|
"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",
|
"BypassProxyForLocalAddresses": "Bypass Proxy for Local Addresses",
|
||||||
"Calendar": "Calendar",
|
"Calendar": "Calendar",
|
||||||
"CalendarOptions": "Calendar Options",
|
"CalendarOptions": "Calendar Options",
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace NzbDrone.Core.Profiles.Delay
|
||||||
public int UsenetDelay { get; set; }
|
public int UsenetDelay { get; set; }
|
||||||
public int TorrentDelay { get; set; }
|
public int TorrentDelay { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
|
public bool BypassIfHighestQuality { get; set; }
|
||||||
public HashSet<int> Tags { get; set; }
|
public HashSet<int> Tags { get; set; }
|
||||||
|
|
||||||
public DelayProfile()
|
public DelayProfile()
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Radarr.Api.V3.Profiles.Delay
|
||||||
public DownloadProtocol PreferredProtocol { get; set; }
|
public DownloadProtocol PreferredProtocol { get; set; }
|
||||||
public int UsenetDelay { get; set; }
|
public int UsenetDelay { get; set; }
|
||||||
public int TorrentDelay { get; set; }
|
public int TorrentDelay { get; set; }
|
||||||
|
public bool BypassIfHighestQuality { get; set; }
|
||||||
public int Order { get; set; }
|
public int Order { get; set; }
|
||||||
public HashSet<int> Tags { get; set; }
|
public HashSet<int> Tags { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -35,6 +36,7 @@ namespace Radarr.Api.V3.Profiles.Delay
|
||||||
PreferredProtocol = model.PreferredProtocol,
|
PreferredProtocol = model.PreferredProtocol,
|
||||||
UsenetDelay = model.UsenetDelay,
|
UsenetDelay = model.UsenetDelay,
|
||||||
TorrentDelay = model.TorrentDelay,
|
TorrentDelay = model.TorrentDelay,
|
||||||
|
BypassIfHighestQuality = model.BypassIfHighestQuality,
|
||||||
Order = model.Order,
|
Order = model.Order,
|
||||||
Tags = new HashSet<int>(model.Tags)
|
Tags = new HashSet<int>(model.Tags)
|
||||||
};
|
};
|
||||||
|
@ -56,6 +58,7 @@ namespace Radarr.Api.V3.Profiles.Delay
|
||||||
PreferredProtocol = resource.PreferredProtocol,
|
PreferredProtocol = resource.PreferredProtocol,
|
||||||
UsenetDelay = resource.UsenetDelay,
|
UsenetDelay = resource.UsenetDelay,
|
||||||
TorrentDelay = resource.TorrentDelay,
|
TorrentDelay = resource.TorrentDelay,
|
||||||
|
BypassIfHighestQuality = resource.BypassIfHighestQuality,
|
||||||
Order = resource.Order,
|
Order = resource.Order,
|
||||||
Tags = new HashSet<int>(resource.Tags)
|
Tags = new HashSet<int>(resource.Tags)
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue