Page 1 of 1

addurl/addid - Return NZO_ID

Posted: January 30th, 2012, 7:47 pm
by markus101
I'm not sure if this is possible (I guess it depends on when a queued item gets an NZO_ID), but I was hoping that SABnzbd could return the NZO_ID when a new item is sent to the queue, allowing tracking of that NZO_ID through the queuing, downloading and post-procesing process.

In addition it would be nice to be able to query SABnzbd for a NZO_ID and have SABnzbd return its current status, queued, downloading, post-processing, complete, etc.

I'm primarily inquiring about the first request, the latter would be an added bonus.

Thanks for all the great work.

-Markus

Re: addurl/addid - Return NZO_ID

Posted: January 31st, 2012, 2:43 am
by shypike
It's probably possible, but I need to look into this.
You won't get one when you send an URL of an indexing site.

Re: addurl/addid - Return NZO_ID

Posted: February 5th, 2012, 8:03 am
by shypike
First part is implemented.
0.7.0 will return a list of nzo_ids.
JSON example:

Code: Select all

{"status":0,"nzo_ids":["SABnzbd_nzo_bjibsz", "SABnzbd_nzo_ihfghs"]}
ZIP-files with NZBs will return multiple nzo_ids, in other cases the list will have only one element.

I'll think about the other request.

Re: addurl/addid - Return NZO_ID

Posted: February 5th, 2012, 10:57 pm
by markus101
Awesome. Thanks. To confirm whayt situations will this json be returned?

Directing Sab to a local nzb file?
Posting a nzb file to sab?
Add by URL? (I think this is a no)

Re: addurl/addid - Return NZO_ID

Posted: February 6th, 2012, 4:29 am
by shypike
API functions "addfile" (upload) and "addlocalfile".
Not "addid" and "addurl", because it could take hours before you have a result.
The "nzo_id" isn't known yet.
In fact, the "fetch" items do have an identifier, but it changes once the job becomes '"real".
So in principle it could return the temporary id for the addurl call, but it won't be the handle
for the final entry.

Re: addurl/addid - Return NZO_ID

Posted: February 10th, 2012, 2:05 am
by Usenet
I grab the nzo_id by looping thought the queue asking for the nzb name

Code: Select all

def nzo_id(self, nzbname):
        url = self.baseurl + "&mode=queue&start=START&limit=LIMIT&output=xml"
        doc = _load_xml(url)
        sab_nzo_id = None
        if doc:
            if doc.getElementsByTagName("slot"):
                for slot in doc.getElementsByTagName("slot"):
                    filename = get_node_value(slot, "filename")
                    if filename.lower() == nzbname.lower():
                        sab_nzo_id  = get_node_value(slot, "nzo_id")
        return sab_nzo_id