mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 05:47:22 -04:00
Fixed: (Transmission) Set seed limits in client
This commit is contained in:
parent
48cd1d9f6b
commit
419cce53f7
9 changed files with 12 additions and 52 deletions
|
@ -26,51 +26,11 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
|||
_proxy = proxy;
|
||||
}
|
||||
|
||||
protected bool HasReachedSeedLimit(TransmissionTorrent torrent, double? ratio, Lazy<TransmissionConfig> config)
|
||||
{
|
||||
var isStopped = torrent.Status == TransmissionTorrentStatus.Stopped;
|
||||
var isSeeding = torrent.Status == TransmissionTorrentStatus.Seeding;
|
||||
|
||||
if (torrent.SeedRatioMode == 1)
|
||||
{
|
||||
if (isStopped && ratio.HasValue && ratio >= torrent.SeedRatioLimit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (torrent.SeedRatioMode == 0)
|
||||
{
|
||||
if (isStopped && config.Value.SeedRatioLimited && ratio >= config.Value.SeedRatioLimit)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Transmission doesn't support SeedTimeLimit, use/abuse seed idle limit, but only if it was set per-torrent.
|
||||
if (torrent.SeedIdleMode == 1)
|
||||
{
|
||||
if ((isStopped || isSeeding) && torrent.SecondsSeeding > torrent.SeedIdleLimit * 60)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (torrent.SeedIdleMode == 0)
|
||||
{
|
||||
// The global idle limit is a real idle limit, if it's configured then 'Stopped' is enough.
|
||||
if (isStopped && config.Value.IdleSeedingLimitEnabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override string AddFromMagnetLink(TorrentInfo release, string hash, string magnetLink)
|
||||
{
|
||||
_proxy.AddTorrentFromUrl(magnetLink, GetDownloadDirectory(), Settings);
|
||||
_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
|
||||
|
||||
//_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
|
||||
if (Settings.Priority == (int)TransmissionPriority.First)
|
||||
{
|
||||
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
||||
|
@ -82,8 +42,8 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
|||
protected override string AddFromTorrentFile(TorrentInfo release, string hash, string filename, byte[] fileContent)
|
||||
{
|
||||
_proxy.AddTorrentFromData(fileContent, GetDownloadDirectory(), Settings);
|
||||
_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
|
||||
|
||||
//_proxy.SetTorrentSeedingConfiguration(hash, release.SeedConfiguration, Settings);
|
||||
if (Settings.Priority == (int)TransmissionPriority.First)
|
||||
{
|
||||
_proxy.MoveTorrentToTopInQueue(hash, Settings);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
{
|
||||
public class TransmissionException : DownloadClientException
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
{
|
||||
public enum TransmissionPriority
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
@ -141,7 +141,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission
|
|||
|
||||
private TransmissionResponse GetSessionVariables(TransmissionSettings settings)
|
||||
{
|
||||
// Retrieve transmission information such as the default download directory, bandwith throttling and seed ratio.
|
||||
// Retrieve transmission information such as the default download directory, bandwidth throttling and seed ratio.
|
||||
return ProcessRequest("session-get", null, settings);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
{
|
||||
public class TransmissionTorrent
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
|||
public long TotalSize { get; set; }
|
||||
public long LeftUntilDone { get; set; }
|
||||
public bool IsFinished { get; set; }
|
||||
public int Eta { get; set; }
|
||||
public long Eta { get; set; }
|
||||
public TransmissionTorrentStatus Status { get; set; }
|
||||
public int SecondsDownloading { get; set; }
|
||||
public int SecondsSeeding { get; set; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
namespace NzbDrone.Core.Download.Clients.Transmission
|
||||
{
|
||||
public enum TransmissionTorrentStatus
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace NzbDrone.Core.Download.Clients.Vuze
|
|||
// - A multi-file torrent is downloaded in a job folder and 'outputPath' points to that directory directly.
|
||||
// - A single-file torrent is downloaded in the root folder and 'outputPath' poinst to that root folder.
|
||||
// We have to make sure the return value points to the job folder OR file.
|
||||
if (outputPath == default || outputPath.FileName == torrent.Name || torrent.FileCount > 1)
|
||||
if (outputPath.FileName == torrent.Name || torrent.FileCount > 1)
|
||||
{
|
||||
_logger.Trace("Vuze output directory: {0}", outputPath);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue