addurl/addid - Return NZO_ID

Want something added? Ask for it here.

addurl/addid - Return NZO_ID

Postby markus101 » January 30th, 2012, 8:47 pm

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
markus101
Release Testers
Release Testers
 
Posts: 404
Joined: August 13th, 2008, 3:51 am

Re: addurl/addid - Return NZO_ID

Postby shypike » January 31st, 2012, 3:43 am

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: 18735
Joined: January 18th, 2008, 1:49 pm

Re: addurl/addid - Return NZO_ID

Postby shypike » February 5th, 2012, 9:03 am

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

Re: addurl/addid - Return NZO_ID

Postby markus101 » February 5th, 2012, 11:57 pm

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)
markus101
Release Testers
Release Testers
 
Posts: 404
Joined: August 13th, 2008, 3:51 am

Re: addurl/addid - Return NZO_ID

Postby shypike » February 6th, 2012, 5:29 am

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

Re: addurl/addid - Return NZO_ID

Postby Usenet » February 10th, 2012, 3:05 am

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


Return to Feature Requests