Skip to content

Commit

Permalink
New: Log additional information when processing completed torrents fr…
Browse files Browse the repository at this point in the history
…om rTorrent

(cherry picked from commit c7d39579b45adbe1b9da3baff587b2d7b7c9724b)

Closes #2482
  • Loading branch information
markus101 authored and mynameisbogdan committed May 12, 2023
1 parent 0411102 commit c43e9eb
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs
Expand Up @@ -179,11 +179,28 @@ public override IEnumerable<DownloadClientItem> GetItems()
// Grab cached seedConfig
var seedConfig = _downloadSeedConfigProvider.GetSeedConfiguration(torrent.Hash);

// Check if torrent is finished and if it exceeds cached seedConfig
item.CanMoveFiles = item.CanBeRemoved =
torrent.IsFinished && seedConfig != null &&
((torrent.Ratio / 1000.0) >= seedConfig.Ratio ||
(DateTimeOffset.Now - DateTimeOffset.FromUnixTimeSeconds(torrent.FinishedTime)) >= seedConfig.SeedTime);
if (torrent.IsFinished && seedConfig != null)
{
var canRemove = false;

if (torrent.Ratio / 1000.0 >= seedConfig.Ratio)
{
_logger.Trace($"{item} has met seed ratio goal of {seedConfig.Ratio}");
canRemove = true;
}
else if (DateTimeOffset.Now - DateTimeOffset.FromUnixTimeSeconds(torrent.FinishedTime) >= seedConfig.SeedTime)
{
_logger.Trace($"{item} has met seed time goal of {seedConfig.SeedTime} minutes");
canRemove = true;
}
else
{
_logger.Trace($"{item} seeding goals have not yet been reached");
}

// Check if torrent is finished and if it exceeds cached seedConfig
item.CanMoveFiles = item.CanBeRemoved = canRemove;
}

items.Add(item);
}
Expand Down

0 comments on commit c43e9eb

Please sign in to comment.