Check Queue Empty?

Come up with a useful post-processing script? Share it here!
Post Reply
methanoid
Jr. Member
Jr. Member
Posts: 66
Joined: March 7th, 2008, 6:33 am

Check Queue Empty?

Post by methanoid »

I did actually look at the Wiki and see I can check the queue with this

http://IP:PORT/sabnzbd/api?output=json&apikey=MYAPIKEY&mode=queue

But what if I want to check to see whether the queue is empty or not? Basically I want to update parity on a low powered server IF/WHEN Sab has finished download and process of files....
User avatar
safihre
Administrator
Administrator
Posts: 5523
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Check Queue Empty?

Post by safihre »

You can look at noofslots_total, if it is 0 than there's nothing in the queue.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
horstepipe
Newbie
Newbie
Posts: 8
Joined: October 4th, 2021, 7:28 am

Re: Check Queue Empty?

Post by horstepipe »

hello
I need to come back to this, I also regularly want to check whether my queue is empty.
I see the noofslots_total value, but how can I access it? Parsing the api respond with jq gives an error "parse error: Invalid numeric literal at line 1, column 11".
Could anybody advise me another way to extract the value from the response?
User avatar
safihre
Administrator
Administrator
Posts: 5523
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Check Queue Empty?

Post by safihre »

Did you make sure to include mode=json in the url? Otherwise it will not output json to parse.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
sander
Release Testers
Release Testers
Posts: 9070
Joined: January 22nd, 2008, 2:22 pm

Re: Check Queue Empty?

Post by sander »

Works for me:

Code: Select all

sander@brixit:~$ curl -s 'http://192.168.1.4:8080/api?apikey=f7c0d38b95f2blablaa2607f5ba7673&output=json&mode=queue' | python3 -m json.tool | grep noof
        "noofslots_total": 0,
        "noofslots": 0,
HTH
Post Reply