From ca00b8a3c7a44517dfad8454a290efbda1dc5812 Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 9 Sep 2020 21:18:38 -0400 Subject: [PATCH] New: Handle missingFiles status from qBit Fixes #442 (cherry picked from commit 9a2cee3104b1e8d32f2df68d3ca75967aba41868) --- .../QBittorrentTests/QBittorrentFixture.cs | 21 +++++++++++++++++++ .../Clients/QBittorrent/QBittorrent.cs | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs index c031b8bbf..283166e90 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs @@ -417,6 +417,27 @@ public void api_261_should_use_content_path() result.OutputPath.FullPath.Should().Be(torrent.ContentPath); } + [Test] + public void missingFiles_item_should_have_required_properties() + { + var torrent = new QBittorrentTorrent + { + Hash = "HASH", + Name = _title, + Size = 1000, + Progress = 0.7, + Eta = 8640000, + State = "missingFiles", + Label = "", + SavePath = "" + }; + GivenTorrents(new List { torrent }); + + var item = Subject.GetItems().Single(); + VerifyWarning(item); + item.RemainingTime.Should().NotHaveValue(); + } + [Test] public void Download_should_return_unique_id() { diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs index 51025b79d..da84df258 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs @@ -178,6 +178,11 @@ public override IEnumerable GetItems() item.Message = "The download is stalled with no connections"; break; + case "missingFiles": // torrent is being downloaded, but no connection were made + item.Status = DownloadItemStatus.Warning; + item.Message = "The download is missing files"; + break; + case "metaDL": // torrent magnet is being downloaded if (config.DhtEnabled) {