New: Filter SABnzbd queue by category

This commit is contained in:
Mark McDowall 2023-05-26 17:13:58 -07:00
parent 59f2e5b65d
commit 49fd9c4462
3 changed files with 12 additions and 7 deletions

View File

@ -175,7 +175,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
}
Mocker.GetMock<ISabnzbdProxy>()
.Setup(s => s.GetHistory(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<string>(), It.IsAny<SabnzbdSettings>()))
.Setup(s => s.GetHistory(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<SabnzbdSettings>()))
.Returns(history);
}

View File

@ -105,7 +105,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
private IEnumerable<DownloadClientItem> GetHistory()
{
var sabHistory = _proxy.GetHistory(0, _configService.DownloadClientHistoryLimit, Settings.TvCategory, Settings);
var sabHistory = _proxy.GetHistory(0, _configService.DownloadClientHistoryLimit, Settings);
var historyItems = new List<DownloadClientItem>();

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
SabnzbdConfig GetConfig(SabnzbdSettings settings);
SabnzbdFullStatus GetFullStatus(SabnzbdSettings settings);
SabnzbdQueue GetQueue(int start, int limit, SabnzbdSettings settings);
SabnzbdHistory GetHistory(int start, int limit, string category, SabnzbdSettings settings);
SabnzbdHistory GetHistory(int start, int limit, SabnzbdSettings settings);
string RetryDownload(string id, SabnzbdSettings settings);
}
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
{
var request = BuildRequest("addfile", settings).Post();
request.AddQueryParam("cat", category);
request.AddQueryParam("cat", settings.TvCategory);
request.AddQueryParam("priority", priority);
request.AddFormUpload("name", filename, nzbData, "application/x-nzb");
@ -111,20 +111,25 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
request.AddQueryParam("start", start);
request.AddQueryParam("limit", limit);
if (settings.TvCategory.IsNotNullOrWhiteSpace())
{
request.AddQueryParam("category", settings.TvCategory);
}
var response = ProcessRequest(request, settings);
return Json.Deserialize<SabnzbdQueue>(JObject.Parse(response).SelectToken("queue").ToString());
}
public SabnzbdHistory GetHistory(int start, int limit, string category, SabnzbdSettings settings)
public SabnzbdHistory GetHistory(int start, int limit, SabnzbdSettings settings)
{
var request = BuildRequest("history", settings);
request.AddQueryParam("start", start);
request.AddQueryParam("limit", limit);
if (category.IsNotNullOrWhiteSpace())
if (settings.TvCategory.IsNotNullOrWhiteSpace())
{
request.AddQueryParam("category", category);
request.AddQueryParam("category", settings.TvCategory);
}
var response = ProcessRequest(request, settings);