Page 1 of 1

api attribute for jobs

Posted: August 24th, 2012, 8:41 pm
by bobbintb
i am trying to write a script to shutdown sabnzbd if it isnt doing anything but i cant find much documentation on what the xml api attributes do. i figured out how to work with the queue but is there one for something like jobs? i can tell it to shutdown if the queue is empty but i would also need a way to interface with sabnzbd to see if it is doing any other processing such as extracting, repairing, running post-processing scripts, etc. is this possible?

Re: api attribute for jobs

Posted: August 25th, 2012, 3:52 am
by shypike
It is a bit complicated, but you would need the "history" api call to determine the state of the post-processing queue.

Code: Select all

http://host:8080/sabnzbd/api?mode=history&start=0&limit=4&apikey=bla&output=json
Any history item that has a "loaded" attribute with value "true", is either waiting or being processed.

I'll see if I can add a simple status variable to the "qstatus" call.
But that won't help you until the next release.

Re: api attribute for jobs

Posted: August 25th, 2012, 4:22 am
by shypike
A solution will be in 0.7.4
The qstatus call will have a new variable "pp_active".
This combination will indicate idle mode:

Code: Select all

(state=="IDLE" or state=="PAUSED") and not pp_active

Re: api attribute for jobs

Posted: August 25th, 2012, 1:27 pm
by bobbintb
wow, that is awesome. thanks so much. :D

Re: api attribute for jobs

Posted: August 25th, 2012, 7:40 pm
by bobbintb
so, just to make sure i understand this correctly, anytime there is a "loaded" attribute in the history api with a value of "true", then it is busy doing something?

Re: api attribute for jobs

Posted: August 26th, 2012, 3:41 am
by shypike
Yes, although there could be exceptional situations.
But generally, yes.