Fixed GetQueue and GetHistory.

This commit is contained in:
Mark McDowall 2012-01-20 00:18:38 -08:00
parent e885fadc59
commit 7b14da9b17
4 changed files with 7 additions and 113 deletions

View File

@ -1,72 +1 @@
{
"total_size": "40.30 GB",
"month_size": "20.23 GB",
"week_size": "5.12 GB",
"cache_limit":"-1",
"paused":true,
"new_rel_url":"",
"restart_req":false,
"slots":[
{
"action_line":"",
"show_details":"True",
"script_log":"",
"meta":null,
"fail_message":"",
"loaded":false,
"id":605,
"size":"778.1 MB",
"category":"Apps",
"pp":"D",
"completeness":0,
"script":"",
"nzb_name":"Ubuntu.nzb",
"download_time":567,
"storage":"X:\\Apps\\Ubuntu",
"status":"Completed",
"script_line":"",
"completed":1236646078,
"nzo_id":"SABnzbd_nzo_ipet0h",
"downloaded":815878352,
"report":"000000",
"path":"Ubuntu",
"postproc_time":368,
"name":"Ubuntu",
"url":"https://newzbin.com/browse/post/000000/",
"bytes":815878352,
"url_info":"http://google.com",
"stage_log":[
{"name":"download","actions":["Downloaded in 9 minutes 27 seconds at an average of 1404kB/s"]},
{"name":"repair","actions":["[ubuntu] Repaired in 4 minutes 24 seconds","[ubuntu.sample] Quick Check OK"]},
{"name":"unpack","actions":["[ubuntu] Unpacked 1 file/folder in 36 seconds"]}
]
}],
"helpuri":"http://wiki.sabnzbd.org/",
"uptime":"12m",
"version":"trunk",
"diskspacetotal2":"503.32",
"color_scheme":"",
"darwin":false,
"nt":true,
"status":"Paused",
"last_warning":"",
"have_warnings":"0",
"cache_art":"0",
"finishaction":null,
"noofslots":516,
"cache_size":"0",
"new_release":"",
"pause_int":"0",
"mbleft":"785.89",
"diskspace2":"25.08",
"diskspace1":"25.08",
"diskspacetotal1":"503.32",
"timeleft":"0:00:00",
"mb":"785.89",
"eta":"unknown",
"nzb_quota":"",
"loadavg":"",
"kbpersec":"0.00",
"speedlimit":"0",
"webdir":"path\\to\\templates"
}
{"history":{"active_lang":"en","paused":false,"session":"5c770e3197e4fe763423ee7c392c25d1","restart_req":false,"power_options":true,"slots":[{"action_line":"","show_details":"True","script_log":"","meta":null,"fail_message":"","loaded":false,"id":9858,"size":"970 MB","category":"tv","pp":"D","retry":0,"completeness":0,"script":"None","nzb_name":"The.Mentalist.S04E12.720p.HDTV.x264-IMMERSE.nzb","download_time":524,"storage":"C:\\ServerPool\\ServerFolders\\Unsorted TV\\The Mentalist - 4x12 - My Bloody Valentine [HDTV]","status":"Completed","script_line":"","completed":1327033479,"nzo_id":"SABnzbd_nzo_0crgis","downloaded":1016942445,"report":"","path":"D:\\SABnzbd\\downloading\\The Mentalist - 4x12 - My Bloody Valentine [HDTV]","postproc_time":24,"name":"The Mentalist - 4x12 - My Bloody Valentine [HDTV]","url":"","bytes":1016942445,"url_info":"","stage_log":[{"name":"Download","actions":["Downloaded in 8 minutes 44 seconds at an average of 1.8 MB/s"]},{"name":"Repair","actions":["[the.mentalist.s04e12.720p.hdtv.x264-immerse] Quick Check OK"]},{"name":"Unpack","actions":["[the.mentalist.s04e12.720p.hdtv.x264-immerse] Unpacked 1 files/folders in 23 seconds"]}]}],"speed":"0 ","helpuri":"http://wiki.sabnzbd.org/","size":"0 B","uptime":"1d","total_size":"10.2 T","month_size":"445.7 G","week_size":"46.6 G","version":"0.6.9","new_rel_url":"http://sourceforge.net/projects/sabnzbdplus/files/sabnzbdplus/sabnzbd-0.6.14","diskspacetotal2":"9314.57","color_scheme":"gold","diskspacetotal1":"871.41","nt":true,"status":"Idle","last_warning":"2012-01-19 23:58:01,736\nWARNING:\nAPI Key incorrect, Use the api key from Config->General in your 3rd party program:","have_warnings":"3","cache_art":"0","sizeleft":"0 B","finishaction":null,"paused_all":false,"cache_size":"0 B","new_release":"0.6.14","pause_int":"0","mbleft":"0.00","diskspace1":"869.82","darwin":false,"timeleft":"0:00:00","mb":"0.00","noofslots":9724,"day_size":"0 ","eta":"unknown","nzb_quota":"","loadavg":"","cache_max":"-1","kbpersec":"0.00","speedlimit":"","webdir":"D:\\SABnzbd\\SABnzbd\\interfaces\\Plush\\templates","diskspace2":"1084.96"}}

View File

@ -1,38 +1 @@
{
"total_size": "40.30 GB",
"month_size": "20.23 GB",
"week_size": "5.12 GB",
"cache_limit":"-1",
"paused":true,
"new_rel_url":"",
"restart_req":false,
"slots":[ ],
"helpuri":"http://wiki.sabnzbd.org/",
"uptime":"12m",
"version":"trunk",
"diskspacetotal2":"503.32",
"color_scheme":"",
"darwin":false,
"nt":true,
"status":"Paused",
"last_warning":"",
"have_warnings":"0",
"cache_art":"0",
"finishaction":null,
"noofslots":516,
"cache_size":"0",
"new_release":"",
"pause_int":"0",
"mbleft":"785.89",
"diskspace2":"25.08",
"diskspace1":"25.08",
"diskspacetotal1":"503.32",
"timeleft":"0:00:00",
"mb":"785.89",
"eta":"unknown",
"nzb_quota":"",
"loadavg":"",
"kbpersec":"0.00",
"speedlimit":"0",
"webdir":"path\\to\\templates"
}
{"history":{"active_lang":"en","paused":false,"session":"5c770e3197e4fe763423ee7c392c25d1","restart_req":false,"power_options":true,"slots":[ ],"speed":"0 ","helpuri":"http://wiki.sabnzbd.org/","size":"0 B","uptime":"1d","total_size":"10.2 T","month_size":"445.7 G","week_size":"46.6 G","version":"0.6.9","new_rel_url":"http://sourceforge.net/projects/sabnzbdplus/files/sabnzbdplus/sabnzbd-0.6.14","diskspacetotal2":"9314.57","color_scheme":"gold","diskspacetotal1":"871.41","nt":true,"status":"Idle","last_warning":"2012-01-19 23:58:01,736\nWARNING:\nAPI Key incorrect, Use the api key from Config->General in your 3rd party program:","have_warnings":"3","cache_art":"0","sizeleft":"0 B","finishaction":null,"paused_all":false,"cache_size":"0 B","new_release":"0.6.14","pause_int":"0","mbleft":"0.00","diskspace1":"869.82","darwin":false,"timeleft":"0:00:00","mb":"0.00","noofslots":9724,"day_size":"0 ","eta":"unknown","nzb_quota":"","loadavg":"","cache_max":"-1","kbpersec":"0.00","speedlimit":"","webdir":"D:\\SABnzbd\\SABnzbd\\interfaces\\Plush\\templates","diskspace2":"1084.96"}}

View File

@ -266,7 +266,7 @@ namespace NzbDrone.Core.Test.ProviderTests
var result = Mocker.Resolve<SabProvider>().GetQueue();
//Assert
result.Should().HaveCount(3);
result.Should().HaveCount(2);
}
[Test]

View File

@ -5,6 +5,7 @@ using System.Text.RegularExpressions;
using System.Web;
using System.Xml.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Ninject;
using NLog;
using NzbDrone.Core.Model;
@ -90,7 +91,7 @@ namespace NzbDrone.Core.Providers
CheckForError(response);
var items = JsonConvert.DeserializeObject<SabQueue>(response).Items;
var items = JsonConvert.DeserializeObject<SabQueue>(JObject.Parse(response).SelectToken("queue").ToString()).Items;
return items ?? new List<SabQueueItem>();
}
@ -102,7 +103,8 @@ namespace NzbDrone.Core.Providers
CheckForError(response);
return JsonConvert.DeserializeObject<SabHistory>(response).Items;
var items = JsonConvert.DeserializeObject<SabHistory>(JObject.Parse(response).SelectToken("history").ToString()).Items;
return items ?? new List<SabHistoryItem>();
}
public virtual String GetSabTitle(EpisodeParseResult parseResult)