mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-03 05:25:10 +00:00
Fixed: Validation of new qbittorrent max-ratio action config
(cherry picked from commit d1c3ae17491726320c58561548a21d83dae7fe7d)
This commit is contained in:
parent
a15d0d1b0a
commit
294a50e0a3
3 changed files with 12 additions and 4 deletions
|
@ -102,13 +102,13 @@ protected void GivenHighPriority()
|
|||
Subject.Definition.Settings.As<QBittorrentSettings>().RecentTvPriority = (int)QBittorrentPriority.First;
|
||||
}
|
||||
|
||||
protected void GivenGlobalSeedLimits(float maxRatio, int maxSeedingTime = -1, bool removeOnMaxRatio = false)
|
||||
protected void GivenGlobalSeedLimits(float maxRatio, int maxSeedingTime = -1, QBittorrentMaxRatioAction maxRatioAction = QBittorrentMaxRatioAction.Pause)
|
||||
{
|
||||
Mocker.GetMock<IQBittorrentProxy>()
|
||||
.Setup(s => s.GetConfig(It.IsAny<QBittorrentSettings>()))
|
||||
.Returns(new QBittorrentPreferences
|
||||
{
|
||||
RemoveOnMaxRatio = removeOnMaxRatio,
|
||||
MaxRatioAction = maxRatioAction,
|
||||
MaxRatio = maxRatio,
|
||||
MaxRatioEnabled = maxRatio >= 0,
|
||||
MaxSeedingTime = maxSeedingTime,
|
||||
|
|
|
@ -349,7 +349,7 @@ private ValidationFailure TestConnection()
|
|||
|
||||
// Complain if qBittorrent is configured to remove torrents on max ratio
|
||||
var config = Proxy.GetConfig(Settings);
|
||||
if ((config.MaxRatioEnabled || config.MaxSeedingTimeEnabled) && config.RemoveOnMaxRatio)
|
||||
if ((config.MaxRatioEnabled || config.MaxSeedingTimeEnabled) && (config.MaxRatioAction == QBittorrentMaxRatioAction.Remove || config.MaxRatioAction == QBittorrentMaxRatioAction.DeleteFiles))
|
||||
{
|
||||
return new NzbDroneValidationFailure(string.Empty, "qBittorrent is configured to remove torrents when they reach their Share Ratio Limit")
|
||||
{
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
namespace NzbDrone.Core.Download.Clients.QBittorrent
|
||||
{
|
||||
public enum QBittorrentMaxRatioAction
|
||||
{
|
||||
Pause = 0,
|
||||
Remove = 1,
|
||||
EnableSuperSeeding = 2,
|
||||
DeleteFiles = 3
|
||||
}
|
||||
|
||||
// qbittorrent settings from the list returned by /query/preferences
|
||||
public class QBittorrentPreferences
|
||||
{
|
||||
|
@ -21,7 +29,7 @@ public class QBittorrentPreferences
|
|||
public long MaxSeedingTime { get; set; } // Get the global share time limit in minutes
|
||||
|
||||
[JsonProperty(PropertyName = "max_ratio_act")]
|
||||
public bool RemoveOnMaxRatio { get; set; } // Action performed when a torrent reaches the maximum share ratio. [false = pause, true = remove]
|
||||
public QBittorrentMaxRatioAction MaxRatioAction { get; set; } // Action performed when a torrent reaches the maximum share ratio.
|
||||
|
||||
[JsonProperty(PropertyName = "queueing_enabled")]
|
||||
public bool QueueingEnabled { get; set; } = true;
|
||||
|
|
Loading…
Reference in a new issue