api attribute for jobs

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
bobbintb
Newbie
Newbie
Posts: 16
Joined: August 24th, 2012, 11:09 am

api attribute for jobs

Post 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?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: api attribute for jobs

Post 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.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: api attribute for jobs

Post 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
bobbintb
Newbie
Newbie
Posts: 16
Joined: August 24th, 2012, 11:09 am

Re: api attribute for jobs

Post by bobbintb »

wow, that is awesome. thanks so much. :D
bobbintb
Newbie
Newbie
Posts: 16
Joined: August 24th, 2012, 11:09 am

Re: api attribute for jobs

Post 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?
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: api attribute for jobs

Post by shypike »

Yes, although there could be exceptional situations.
But generally, yes.
Post Reply