Fixed: (UTorrent) Set seed limits in client

pull/1722/head
Bogdan 1 year ago
parent da75519524
commit 65adf30f59

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Net; using System.Net;
using FluentValidation.Results; using FluentValidation.Results;
using NLog; using NLog;
using NzbDrone.Common.Cache;
using NzbDrone.Common.Disk; using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
@ -16,10 +15,8 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
public class UTorrent : TorrentClientBase<UTorrentSettings> public class UTorrent : TorrentClientBase<UTorrentSettings>
{ {
private readonly IUTorrentProxy _proxy; private readonly IUTorrentProxy _proxy;
private readonly ICached<UTorrentTorrentCache> _torrentCache;
public UTorrent(IUTorrentProxy proxy, public UTorrent(IUTorrentProxy proxy,
ICacheManager cacheManager,
ITorrentFileInfoReader torrentFileInfoReader, ITorrentFileInfoReader torrentFileInfoReader,
IHttpClient httpClient, IHttpClient httpClient,
IConfigService configService, IConfigService configService,
@ -28,17 +25,16 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
: base(torrentFileInfoReader, httpClient, configService, diskProvider, logger) : base(torrentFileInfoReader, httpClient, configService, diskProvider, logger)
{ {
_proxy = proxy; _proxy = proxy;
_torrentCache = cacheManager.GetCache<UTorrentTorrentCache>(GetType(), "differentialTorrents");
} }
protected override string AddFromMagnetLink(TorrentInfo release, string hash, string magnetLink) protected override string AddFromMagnetLink(TorrentInfo release, string hash, string magnetLink)
{ {
_proxy.AddTorrentFromUrl(magnetLink, Settings); _proxy.AddTorrentFromUrl(magnetLink, Settings);
_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
//_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
var category = GetCategoryForRelease(release) ?? Settings.Category; var category = GetCategoryForRelease(release) ?? Settings.Category;
if (GetCategoryForRelease(release).IsNotNullOrWhiteSpace())
if (category.IsNotNullOrWhiteSpace())
{ {
_proxy.SetTorrentLabel(hash, category, Settings); _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) protected override string AddFromTorrentFile(TorrentInfo release, string hash, string filename, byte[] fileContent)
{ {
_proxy.AddTorrentFromFile(filename, fileContent, Settings); _proxy.AddTorrentFromFile(filename, fileContent, Settings);
_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
//_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
var category = GetCategoryForRelease(release) ?? Settings.Category; var category = GetCategoryForRelease(release) ?? Settings.Category;
if (category.IsNotNullOrWhiteSpace()) if (category.IsNotNullOrWhiteSpace())
{ {
_proxy.SetTorrentLabel(hash, category, Settings); _proxy.SetTorrentLabel(hash, category, Settings);
@ -125,9 +122,9 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
_logger.Error(ex, "Failed to test uTorrent"); _logger.Error(ex, "Failed to test uTorrent");
return new NzbDroneValidationFailure("Host", "Unable to connect to uTorrent") return new NzbDroneValidationFailure("Host", "Unable to connect to uTorrent")
{ {
DetailedDescription = ex.Message DetailedDescription = ex.Message
}; };
} }
return null; return null;

@ -39,7 +39,7 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
public object Unknown28 { get; set; } public object Unknown28 { get; set; }
} }
internal class UTorrentTorrentJsonConverter : JsonConverter public class UTorrentTorrentJsonConverter : JsonConverter
{ {
public override bool CanConvert(Type objectType) public override bool CanConvert(Type objectType)
{ {

Loading…
Cancel
Save