1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 01:42:35 +01:00

New: Return downloading magnets from Transmission

(cherry picked from commit 11a9dcb3890eaf99602900f37e64007f2fbf9b8e)
This commit is contained in:
Mark McDowall 2024-07-30 21:26:24 -07:00 committed by Bogdan
parent caabb032f3
commit 8e1016572b
3 changed files with 14 additions and 10 deletions

View File

@ -49,10 +49,13 @@ public void completed_download_should_have_required_properties()
} }
[Test] [Test]
public void magnet_download_should_not_return_the_item() public void magnet_download_should_be_returned_as_queued()
{ {
PrepareClientToReturnMagnetItem(); PrepareClientToReturnMagnetItem();
Subject.GetItems().Count().Should().Be(0);
var item = Subject.GetItems().Single();
item.Status.Should().Be(DownloadItemStatus.Queued);
} }
[Test] [Test]

View File

@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using FluentAssertions; using FluentAssertions;
@ -60,7 +60,10 @@ public void completed_download_should_have_required_properties()
public void magnet_download_should_not_return_the_item() public void magnet_download_should_not_return_the_item()
{ {
PrepareClientToReturnMagnetItem(); PrepareClientToReturnMagnetItem();
Subject.GetItems().Count().Should().Be(0);
var item = Subject.GetItems().Single();
item.Status.Should().Be(DownloadItemStatus.Queued);
} }
[Test] [Test]

View File

@ -43,12 +43,6 @@ public override IEnumerable<DownloadClientItem> GetItems()
foreach (var torrent in torrents) foreach (var torrent in torrents)
{ {
// If totalsize == 0 the torrent is a magnet downloading metadata
if (torrent.TotalSize == 0)
{
continue;
}
var outputPath = new OsPath(torrent.DownloadDir); var outputPath = new OsPath(torrent.DownloadDir);
if (Settings.MovieDirectory.IsNotNullOrWhiteSpace()) if (Settings.MovieDirectory.IsNotNullOrWhiteSpace())
@ -99,6 +93,10 @@ public override IEnumerable<DownloadClientItem> GetItems()
item.Status = DownloadItemStatus.Warning; item.Status = DownloadItemStatus.Warning;
item.Message = torrent.ErrorString; item.Message = torrent.ErrorString;
} }
else if (torrent.TotalSize == 0)
{
item.Status = DownloadItemStatus.Queued;
}
else if (torrent.LeftUntilDone == 0 && (torrent.Status == TransmissionTorrentStatus.Stopped || else if (torrent.LeftUntilDone == 0 && (torrent.Status == TransmissionTorrentStatus.Stopped ||
torrent.Status == TransmissionTorrentStatus.Seeding || torrent.Status == TransmissionTorrentStatus.Seeding ||
torrent.Status == TransmissionTorrentStatus.SeedingWait)) torrent.Status == TransmissionTorrentStatus.SeedingWait))