Fixed: Added support for Sabnzbd 0.8 history category queryparam.

fixes #1077
pull/1079/head
Taloth Saldono 9 years ago
parent 0d19f645e8
commit 5cfaed7b26

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

@ -103,7 +103,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
try
{
sabHistory = _proxy.GetHistory(0, _configService.DownloadClientHistoryLimit, Settings);
sabHistory = _proxy.GetHistory(0, _configService.DownloadClientHistoryLimit, Settings.TvCategory, Settings);
}
catch (DownloadClientException ex)
{

@ -17,7 +17,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
SabnzbdVersionResponse GetVersion(SabnzbdSettings settings);
SabnzbdConfig GetConfig(SabnzbdSettings settings);
SabnzbdQueue GetQueue(int start, int limit, SabnzbdSettings settings);
SabnzbdHistory GetHistory(int start, int limit, SabnzbdSettings settings);
SabnzbdHistory GetHistory(int start, int limit, string category, SabnzbdSettings settings);
string RetryDownload(string id, SabnzbdSettings settings);
}
@ -102,11 +102,16 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
return Json.Deserialize<SabnzbdQueue>(JObject.Parse(response).SelectToken("queue").ToString());
}
public SabnzbdHistory GetHistory(int start, int limit, SabnzbdSettings settings)
public SabnzbdHistory GetHistory(int start, int limit, string category, SabnzbdSettings settings)
{
var request = new RestRequest();
var action = string.Format("mode=history&start={0}&limit={1}", start, limit);
if (category.IsNotNullOrWhiteSpace())
{
action += "&category=" + category;
}
var response = ProcessRequest(request, action, settings);
return Json.Deserialize<SabnzbdHistory>(JObject.Parse(response).SelectToken("history").ToString());
}

Loading…
Cancel
Save