Skip to content

Commit 1fc2866

Browse files
committed
Fixed: Include all download items if no category is specified in rtorrent.
closes Sonarr#3002
1 parent eb2e7b9 commit 1fc2866

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxyV1.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,12 @@ public QBittorrentPreferences GetConfig(QBittorrentSettings settings)
8787

8888
public List<QBittorrentTorrent> GetTorrents(QBittorrentSettings settings)
8989
{
90-
var request = BuildRequest(settings).Resource("/query/torrents")
91-
.AddQueryParam("label", settings.TvCategory)
92-
.AddQueryParam("category", settings.TvCategory);
90+
var request = BuildRequest(settings).Resource("/query/torrents");
91+
if (settings.TvCategory.IsNotNullOrWhiteSpace())
92+
{
93+
request.AddQueryParam("label", settings.TvCategory);
94+
request.AddQueryParam("category", settings.TvCategory);
95+
}
9396
var response = ProcessRequest<List<QBittorrentTorrent>>(request, settings);
9497

9598
return response;

src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrentProxyV2.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ public QBittorrentPreferences GetConfig(QBittorrentSettings settings)
8686

8787
public List<QBittorrentTorrent> GetTorrents(QBittorrentSettings settings)
8888
{
89-
var request = BuildRequest(settings).Resource("/api/v2/torrents/info")
90-
.AddQueryParam("category", settings.TvCategory);
89+
var request = BuildRequest(settings).Resource("/api/v2/torrents/info");
90+
if (settings.TvCategory.IsNotNullOrWhiteSpace())
91+
{
92+
request.AddQueryParam("category", settings.TvCategory);
93+
}
9194
var response = ProcessRequest<List<QBittorrentTorrent>>(request, settings);
9295

9396
return response;

src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ public override IEnumerable<DownloadClientItem> GetItems()
8989
foreach (RTorrentTorrent torrent in torrents)
9090
{
9191
// Don't concern ourselves with categories other than specified
92-
if (torrent.Category != Settings.TvCategory) continue;
92+
if (Settings.TvCategory.IsNotNullOrWhiteSpace() && torrent.Category != Settings.TvCategory) continue;
9393

9494
if (torrent.Path.StartsWith("."))
9595
{
96-
throw new DownloadClientException("Download paths paths must be absolute. Please specify variable \"directory\" in rTorrent.");
96+
throw new DownloadClientException("Download paths must be absolute. Please specify variable \"directory\" in rTorrent.");
9797
}
9898

9999
var item = new DownloadClientItem();

0 commit comments

Comments
 (0)