Page 1 of 1

sabcli and sabconky (for users), sabapi (for developers)

Posted: March 16th, 2008, 8:34 pm
by sabooky
run sabcli.py or sabstatus.py with `python sabcli.py` or make them executable (chmod 755 sabcli.py) and run them directly.
files attached as text files, need to be renamed

sabcli: A Python CLI interface to the sabconky server.
config options:

Code: Select all

################################################################################
# SETTINGS
#change this if your sabnzbd.ini is in a different location
CFGFILE = '~/.sabnzbd/sabnzbd.ini'
#default post process, same order as drop menue: 0 = nothing, 6 = DS
PP = 6
################################################################################
usage:

Code: Select all

Usage: sabcli.py [command] [argument]
    addid [id]      adds newzbin ID to queue
    addurl [url]    adds the url to queue (url points to nzb file)
    list            list items in queue
    queue           same as list, but different format
    pause           pauses sabnzbd
    resume          resumes sabnzbd
    shutdown        shuts down sabnzbd


sabconky: sabnzbd status information formatted for conky
since output is just formatted text, this can be used for other conkylike programs and scripts
config options:

Code: Select all

################################################################################
# SETTINGS
#change this if your sabnzbd.ini is in a different location
CFGFILE = '~/.sabnzbd/sabnzbd.ini'
#conky width, long fields will be cropped to fit
WIDTH = 52
#fields to display, order matters
FIELDS = ['Current Name', 'Current ETA', 'Total ETA', 'Download speed', 'Current Queue', 'Queue']
#delimiter between field and value
DELIM = ' : '
#hide current eta/queue when there's one job or sab is paused
HIDE_CUR = True
#display nothing if there's 0 jobs, or if paused.
HIDE_INACTIVE = False
HIDE_PAUSED = False
#prefix at the start of every line
PREFIX = ' '
################################################################################
sample output:

Code: Select all

 Current Name   : *************
 Current ETA    : 4h 53m 34s
 Total ETA      : 6h 4m 31s
 Download speed : 385.31 KB/s
 Current Queue  : 6627.81/6884.06 MB
 Queue          : 8229.73/8485.99 MB


sabapi: sanbzd interface module
Usage:
class sab(user='', passwd='', host='localhost', port='8080', pp='6', cfgfile='')
    cfgfile is a fileobject or a string to file location ex. '~/.sabnzbd/sabnzbd.ini'
    if cfgfile is given it overrides all other arguments (except pp).
sab methods:
get_data(): Returns a dict representation of qstatus
addid(id): add newzbin report id to sab
addurl(url): add url of nzb file to sab
pause(): pause sab
resume(): resume sab
shutdown():shutdown sab

EDIT: let me know of any feedback/feature request. This does everything I need for personal use, but willing to expand on it if it proves useful for others.

Re: sabcli and sabconky (for users), sabapi (for developers)

Posted: June 10th, 2008, 11:53 am
by DigitalChaos
looks like a really good start to some sort of shell interface!