addurl/addid - Return NZO_ID

Want something added? Ask for it here.
Post Reply
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

addurl/addid - Return NZO_ID

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

Re: addurl/addid - Return NZO_ID

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

Re: addurl/addid - Return NZO_ID

Post 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.
markus101
Release Testers
Release Testers
Posts: 406
Joined: August 13th, 2008, 2:51 am

Re: addurl/addid - Return NZO_ID

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

Re: addurl/addid - Return NZO_ID

Post 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.
Usenet
Jr. Member
Jr. Member
Posts: 87
Joined: February 12th, 2008, 6:04 pm

Re: addurl/addid - Return NZO_ID

Post 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
Post Reply