From 65adf30f5983cb52a42475db202fcb84f1cd6e9a Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 5 Jun 2023 17:36:20 +0300 Subject: [PATCH] Fixed: (UTorrent) Set seed limits in client --- .../Download/Clients/uTorrent/UTorrent.cs | 19 ++++++++----------- .../Clients/uTorrent/UTorrentTorrent.cs | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs index 6ab0635c5..2f4206ffb 100644 --- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Net; using FluentValidation.Results; using NLog; -using NzbDrone.Common.Cache; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; @@ -16,10 +15,8 @@ namespace NzbDrone.Core.Download.Clients.UTorrent public class UTorrent : TorrentClientBase { private readonly IUTorrentProxy _proxy; - private readonly ICached _torrentCache; public UTorrent(IUTorrentProxy proxy, - ICacheManager cacheManager, ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, @@ -28,17 +25,16 @@ namespace NzbDrone.Core.Download.Clients.UTorrent : base(torrentFileInfoReader, httpClient, configService, diskProvider, logger) { _proxy = proxy; - - _torrentCache = cacheManager.GetCache(GetType(), "differentialTorrents"); } protected override string AddFromMagnetLink(TorrentInfo release, string hash, string magnetLink) { _proxy.AddTorrentFromUrl(magnetLink, Settings); + _proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings); - //_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings); var category = GetCategoryForRelease(release) ?? Settings.Category; - if (GetCategoryForRelease(release).IsNotNullOrWhiteSpace()) + + if (category.IsNotNullOrWhiteSpace()) { _proxy.SetTorrentLabel(hash, category, Settings); } @@ -56,9 +52,10 @@ namespace NzbDrone.Core.Download.Clients.UTorrent protected override string AddFromTorrentFile(TorrentInfo release, string hash, string filename, byte[] fileContent) { _proxy.AddTorrentFromFile(filename, fileContent, Settings); + _proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings); - //_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings); var category = GetCategoryForRelease(release) ?? Settings.Category; + if (category.IsNotNullOrWhiteSpace()) { _proxy.SetTorrentLabel(hash, category, Settings); @@ -125,9 +122,9 @@ namespace NzbDrone.Core.Download.Clients.UTorrent _logger.Error(ex, "Failed to test uTorrent"); return new NzbDroneValidationFailure("Host", "Unable to connect to uTorrent") - { - DetailedDescription = ex.Message - }; + { + DetailedDescription = ex.Message + }; } return null; diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentTorrent.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentTorrent.cs index 027b138e0..35fec74de 100644 --- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentTorrent.cs @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent public object Unknown28 { get; set; } } - internal class UTorrentTorrentJsonConverter : JsonConverter + public class UTorrentTorrentJsonConverter : JsonConverter { public override bool CanConvert(Type objectType) {