Skip to content

Commit 1d0de51

Browse files
carlos-sarmientomynameisbogdan
authored andcommittedMar 28, 2024·
Fixed: qBittorrent not correctly handling retention during testing
(cherry picked from commit 588372fd950fc85f5e9a4275fbcb423b247ed0ee)
1 parent a8648fd commit 1d0de51

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
 

‎src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs

+8-4
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,20 @@ public override DownloadClientInfo GetStatus()
386386
}
387387
}
388388

389-
var minimumRetention = 60 * 24 * 14;
390-
391389
return new DownloadClientInfo
392390
{
393391
IsLocalhost = Settings.Host == "127.0.0.1" || Settings.Host == "localhost",
394392
OutputRootFolders = new List<OsPath> { _remotePathMappingService.RemapRemoteToLocal(Settings.Host, destDir) },
395-
RemovesCompletedDownloads = (config.MaxRatioEnabled || (config.MaxSeedingTimeEnabled && config.MaxSeedingTime < minimumRetention)) && (config.MaxRatioAction == QBittorrentMaxRatioAction.Remove || config.MaxRatioAction == QBittorrentMaxRatioAction.DeleteFiles)
393+
RemovesCompletedDownloads = RemovesCompletedDownloads(config)
396394
};
397395
}
398396

397+
private bool RemovesCompletedDownloads(QBittorrentPreferences config)
398+
{
399+
var minimumRetention = 60 * 24 * 14; // 14 days in minutes
400+
return (config.MaxRatioEnabled || (config.MaxSeedingTimeEnabled && config.MaxSeedingTime < minimumRetention)) && (config.MaxRatioAction == QBittorrentMaxRatioAction.Remove || config.MaxRatioAction == QBittorrentMaxRatioAction.DeleteFiles);
401+
}
402+
399403
protected override void Test(List<ValidationFailure> failures)
400404
{
401405
failures.AddIfNotNull(TestConnection());
@@ -445,7 +449,7 @@ private ValidationFailure TestConnection()
445449

446450
// Complain if qBittorrent is configured to remove torrents on max ratio
447451
var config = Proxy.GetConfig(Settings);
448-
if ((config.MaxRatioEnabled || config.MaxSeedingTimeEnabled) && (config.MaxRatioAction == QBittorrentMaxRatioAction.Remove || config.MaxRatioAction == QBittorrentMaxRatioAction.DeleteFiles))
452+
if (RemovesCompletedDownloads(config))
449453
{
450454
return new NzbDroneValidationFailure(string.Empty, "qBittorrent is configured to remove torrents when they reach their Share Ratio Limit")
451455
{

0 commit comments

Comments
 (0)
Please sign in to comment.