Fixed: Added support for Sabnzbd 0.8 history category queryparam.

fixes #1077
This commit is contained in:
Taloth Saldono 2016-01-20 21:34:07 +01:00
parent 0d19f645e8
commit 5cfaed7b26
3 changed files with 9 additions and 4 deletions

View File

@ -144,7 +144,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
history = new SabnzbdHistory() { Items = new List<SabnzbdHistoryItem>() }; history = new SabnzbdHistory() { Items = new List<SabnzbdHistoryItem>() };
Mocker.GetMock<ISabnzbdProxy>() 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); .Returns(history);
} }

View File

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

View File

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