Page 1 of 1

API needs updating?

Posted: May 24th, 2010, 11:16 am
by jonneymendoza
Hi. im currently working on an interesting app but having issues parsing the history returned in json.

the problem is that the SAB serve returns me something like this:

{"history":{"active_lang":"us-en","paused":false,"session":"hghgfhfghfghf","restart_req":false,"power_options":true,o:[{"action_line":"","show_details":"True","script_log":"","meta":null,"fail_message":"","loaded":false,"id":31,"size":"3.06 GB","category":"tv","pp":"D","completeness":0,"script":"None","nzb_name":"xxxxx.nzb","download_time":2364,"storage":"D:\\TV\\xxxxxxCTU","status":"Completed","script_line":"","completed":1274683974,"nzo_id":"SABnzbd_nzo_kh5lls","downloaded":3288881892,"report":"","path":"\\xxxxCTU","postproc_time":76,"name":"xxxxxxCTU","url":"","bytes":3288881892,"url_info":"","stage_log":[{"name":"Download","actions":["Downloaded in 39 minutes 24 seconds at an average of 1.33 MB/s"]},{"name":"Repair","actions":["[ctu-x264-xxxxxu] Quick Check OK","[ctu-x264-xxxx] Quick Check OK"]},{"name":"Unpack","actions":["[cxxxxxxxu] Unpacked 1 files/folders in 1 min 15 seconds"]}]},,"downloaded":8875468581,"report":"","path":"\\xxxxx","postproc_time":312,"name":"xxxxxxxxLEVERAGE","url":"","bytes":8875468581,"url_info":"","stage_log":[{"name":"Download","actions":["Downloaded in 1 hour 19 minutes 56 seconds at an average of 1.76 MB/s"]},{"name":"Repair","actions":["[xxxxxe] Quick Check OK","[xxxx] Quick Check OK"]},{"name":"Unpack","actions":["[xxxxxxxxxxxxxxxxx] Unpacked 1 files/folders in 5 mins 7 seconds"]}]}],"speed":"0 ","helpuri":"http://wiki.sabnzbd.org/","size":"0B"," ... e":"139.82 GB","month_size":"119.12 GB","week_size":"3.06 GB","version":"0.5.2RC1","new_rel_url":"http://sourceforge.net/projects/sabnzbd ... 2":"606.76"}}

instead of :

{
    "total_size": 40.30 GB,      **Since 0.5.2
    "month_size": 20.23 GB,      **Since 0.5.2
    "week_size": 5.12 GB,        **Since 0.5.2
    "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"]}
        ]
    }],

notice how teh word history is the first name you see on my output but not visible in the api docs.

im basicaly trying to get the "slot" Json array but it cant seem to find that array dispite it being there ie "slots" : [..........

[] = json arrays, {} = jsonObjects

Re: API needs updating?

Posted: May 24th, 2010, 12:29 pm
by markus101
I'm getting the same out put when I use json as the output type, running 0.6.x from the trunk, but I'm not aware of any changes to the output since 0.5.2.

-Markus

Re: API needs updating?

Posted: May 24th, 2010, 1:32 pm
by jonneymendoza
which output? {"history": ???

or  the following below without the {history keyword noted?

{
    "total_size": 40.30 GB,      **Since 0.5.2
    "month_size": 20.23 GB,      **Since 0.5.2
    "week_size": 5.12 GB,        **Since 0.5.2
    "cache_limit":"-1",
    "paused":true,
    "new_rel_url":"",
    "restart_req":false,
    "slots":[

Re: API needs updating?

Posted: May 24th, 2010, 1:48 pm
by markus101
Sorry, the same as you are actually getting. It looks the the stuff they added in 0.5.2 is actually below the history output.

-Markus