problem with api: qstatus
Posted: May 21st, 2009, 5:43 pm
Hi,
I'm writing a third-party application that will manage my downloads (see: http://wiki.github.com/emilb/TvSeriesNZ ... -and-setup )
As a part of this app I now want to add a check sequence that verifies that the configuration regarding SABnzbd is correct. My plan is to show the result from the qstatus query via the API. As usual I try the command with wget and I'm not getting parseable results. See examples below.
JSON:
wget -qO- "http://localhost:8080/sabnzbd/api?mode= ... utput=json"
gives:
{"have_warnings":"3","timeleft":"0:58:11","mb":4816.505752,"noofslots":1,"paused":false,"mbleft":4175.837344,"diskspace2":583.092541,"diskspace1":583.092541,"kbpersec":1224.630289,"jobs":[{"msgid":"4996513","filename":"Ong bak 2 (2008) (Thai)","mbleft":4175.837344,"id":"SABnzbd_nzo_844aHB","mb":4816.505752}]}
XML:
wget -qO- "http://localhost:8080/sabnzbd/api?mode= ... output=xml"
gives:
False
1250.88619515
3265.23821259
4816.50575161
1
582.213054657
582.213054657
0:44:32
SABnzbd_nzo_844aHB
4996513
Ong bak 2 (2008) (Thai)
3265.23821259
4816.50575161
The XML variant fails when I try to parse it ( is unexcpected and not closed and no root tag).
In the JSON case it is more complete but the parser I'm using (XStream for Java) expects all elements to be named. This includes the root and job elements. As I understand the JSON specs all {...} are to be prefixed with a name which is not the case here.
What's up, is this a bug or am I doing something wrong?
wget http://localhost:8080/sabnzbd/api?mode=version
gives:
0.4.9
running on Ubuntu 9.04 64bit
Thanks
Emil
I'm writing a third-party application that will manage my downloads (see: http://wiki.github.com/emilb/TvSeriesNZ ... -and-setup )
As a part of this app I now want to add a check sequence that verifies that the configuration regarding SABnzbd is correct. My plan is to show the result from the qstatus query via the API. As usual I try the command with wget and I'm not getting parseable results. See examples below.
JSON:
wget -qO- "http://localhost:8080/sabnzbd/api?mode= ... utput=json"
gives:
{"have_warnings":"3","timeleft":"0:58:11","mb":4816.505752,"noofslots":1,"paused":false,"mbleft":4175.837344,"diskspace2":583.092541,"diskspace1":583.092541,"kbpersec":1224.630289,"jobs":[{"msgid":"4996513","filename":"Ong bak 2 (2008) (Thai)","mbleft":4175.837344,"id":"SABnzbd_nzo_844aHB","mb":4816.505752}]}
XML:
wget -qO- "http://localhost:8080/sabnzbd/api?mode= ... output=xml"
gives:
False
1250.88619515
3265.23821259
4816.50575161
1
582.213054657
582.213054657
0:44:32
SABnzbd_nzo_844aHB
4996513
Ong bak 2 (2008) (Thai)
3265.23821259
4816.50575161
The XML variant fails when I try to parse it ( is unexcpected and not closed and no root tag).
In the JSON case it is more complete but the parser I'm using (XStream for Java) expects all elements to be named. This includes the root and job elements. As I understand the JSON specs all {...} are to be prefixed with a name which is not the case here.
What's up, is this a bug or am I doing something wrong?
wget http://localhost:8080/sabnzbd/api?mode=version
gives:
0.4.9
running on Ubuntu 9.04 64bit
Thanks
Emil