diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs index cfdebdcce..0c81a1d47 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs @@ -19,6 +19,7 @@ public class TransmissionFixture : DownloadClientFixtureBase protected TransmissionTorrent _downloading; protected TransmissionTorrent _failed; protected TransmissionTorrent _completed; + protected TransmissionTorrent _magnet; protected Dictionary _transmissionConfigItems; [SetUp] @@ -80,6 +81,17 @@ public void Setup() DownloadDir = "somepath" }; + _magnet = new TransmissionTorrent + { + HashString = "HASH", + IsFinished = false, + Status = TransmissionTorrentStatus.Downloading, + Name = _title, + TotalSize = 0, + LeftUntilDone = 100, + DownloadDir = "somepath" + }; + Mocker.GetMock() .Setup(s => s.GetHashFromTorrentFile(It.IsAny())) .Returns("CBC2F069FE8BB2F544EAE707D75BCD3DE9DCF951"); @@ -171,6 +183,14 @@ protected void PrepareClientToReturnCompletedItem() }); } + protected void PrepareClientToReturnMagnetItem() + { + GivenTorrents(new List + { + _magnet + }); + } + [Test] public void queued_item_should_have_required_properties() { @@ -203,6 +223,13 @@ public void completed_download_should_have_required_properties() VerifyCompleted(item); } + [Test] + public void magnet_download_should_not_return_the_item() + { + PrepareClientToReturnMagnetItem(); + Subject.GetItems().Count().Should().Be(0); + } + [Test] public void Download_should_return_unique_id() { diff --git a/src/NzbDrone.Core/Download/Clients/Transmission/Transmission.cs b/src/NzbDrone.Core/Download/Clients/Transmission/Transmission.cs index 4c37bbbbf..75f39787b 100644 --- a/src/NzbDrone.Core/Download/Clients/Transmission/Transmission.cs +++ b/src/NzbDrone.Core/Download/Clients/Transmission/Transmission.cs @@ -99,6 +99,10 @@ 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 = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(torrent.DownloadDir)); if (Settings.TvCategory.IsNotNullOrWhiteSpace())