http://www.mediafire.com/?zii2l3znmmq
I've put in in the typical distutils format, so to install, just unzip the archive, go into the Sabapi-0.1 directory, and run:
Code: Select all
python setup.py install
Code: Select all
#Setup the API connection
import Sabapi
api = Sabapi(apikey='xxxxxxxxxxxxxxxxxxxxxxx') #Assuming http://localhost:8080
#Pause and resume all
api.pause()
api.resume()
#Pause for 30 minutes
api.pause(time='30')
#Pause a single item
api.pause(nzo_id='SABnzbd_nzo_zt2syz')
#Add an item from a URL
api.add(url='http://myawesomenzbsite.com/nzbs/TotallyLegalBinaryItem.nzb')
#Add an item using a newzbin id
api.add(id='123456')
A few notes on this:
* All methods that return data are setup to return a python dictionary that's created from the JSON
* The dictionaries contain strings in unicode format, not sure if that's the best way to go, but that's how it works for now.
* Not all API methods are a one-to-one mapping. In some cases, I've combined two or more SABnzbd API methods into one function here. For instance pause() can pause a single item as well as the entire queue. When in doubt, check the manual I've included.
* You'll need the simplejson module in order to use this. Simplejson is pretty common, and on many systems, you can install it with:
Code: Select all
easy_install simplejson