From 8e1016572bf3156f30bc153665a7c9e9f4bc2d38 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 30 Jul 2024 21:26:24 -0700 Subject: [PATCH] New: Return downloading magnets from Transmission (cherry picked from commit 11a9dcb3890eaf99602900f37e64007f2fbf9b8e) --- .../TransmissionTests/TransmissionFixture.cs | 7 +++++-- .../DownloadClientTests/VuzeTests/VuzeFixture.cs | 7 +++++-- .../Download/Clients/Transmission/TransmissionBase.cs | 10 ++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs index b216da6f2..faa7daa1b 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs @@ -49,10 +49,13 @@ public void completed_download_should_have_required_properties() } [Test] - public void magnet_download_should_not_return_the_item() + public void magnet_download_should_be_returned_as_queued() { PrepareClientToReturnMagnetItem(); - Subject.GetItems().Count().Should().Be(0); + + var item = Subject.GetItems().Single(); + + item.Status.Should().Be(DownloadItemStatus.Queued); } [Test] diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs index d17ccb344..f2c87b85d 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using FluentAssertions; @@ -60,7 +60,10 @@ public void completed_download_should_have_required_properties() public void magnet_download_should_not_return_the_item() { PrepareClientToReturnMagnetItem(); - Subject.GetItems().Count().Should().Be(0); + + var item = Subject.GetItems().Single(); + + item.Status.Should().Be(DownloadItemStatus.Queued); } [Test] diff --git a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs index fc8f75686..61a342506 100644 --- a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs +++ b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs @@ -43,12 +43,6 @@ public override IEnumerable GetItems() 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); if (Settings.MovieDirectory.IsNotNullOrWhiteSpace()) @@ -99,6 +93,10 @@ public override IEnumerable GetItems() item.Status = DownloadItemStatus.Warning; item.Message = torrent.ErrorString; } + else if (torrent.TotalSize == 0) + { + item.Status = DownloadItemStatus.Queued; + } else if (torrent.LeftUntilDone == 0 && (torrent.Status == TransmissionTorrentStatus.Stopped || torrent.Status == TransmissionTorrentStatus.Seeding || torrent.Status == TransmissionTorrentStatus.SeedingWait))