= hellanzb XML-RPC = hellanzb is a fully functional XML-RPC server (and client). Most of the remote calls listed in hellanzb.py --help are done via XML RPC: hellanzb runs a client process that talks to the downloader process The XML-RPC server supports the XML-RPC introspection API (it's self documenting). The XML-RPC server is passworded via HTTP AUTH. The username is hardcoded to 'hellanzb' while the password is set in hellanzb.conf (defaults to 'changeme'). The URL would be something like: http://hellanzb:changeme@localhost:8760/ An example of using introspection: {{{ Python 2.4.2 (#2, Oct 5 2005, 22:27:51) [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "license" for more information. >>> from xmlrpclib import ServerProxy >>> hellanzbServer = ServerProxy('http://hellanzb:changeme@localhost:8760/') >>> hellanzbServer.system.listMethods() ['status', 'setrarpass', 'enqueuenewzbin', 'force', 'continue', 'process', 'dequeue', 'clear', 'move', 'list', 'up', 'asciiart', 'next', 'down', 'enqueue', 'pause', 'shutdown', 'cancel', 'last', 'maxrate', 'aolsay', 'system.methodHelp', 'system.listMethods', 'system.methodSignature'] >>> hellanzbServer.system.methodSignature('enqueuenewzbin') [['struct', 'string'], ['struct', 'int']] >>> hellanzbServer.system.methodHelp('enqueuenewzbin') ' Download the NZB with the specified NZB ID from www.newzbin.com, and enqueue it ' >>> from pprint import pprint >>> responseStruct = hellanzbServer.enqueuenewzbin(9991199) >>> pprint responseStruct {'currently_downloading': [], 'currently_processing': [{'id': 1, 'nzbName': 'The_Advantage-berkeley_live'}], 'eta': 0, 'is_paused': False, 'log_entries': [{'INFO': 'Parsed: 54 posts (5 files, skipping 2 on disk files & 2 par files)'}, {'INFO': 'Transferred 4.1MB in 14s at 287.1KB/s'}, {'INFO': ''}, {'INFO': 'BearShare: Verifying via par group: BearShare4.cbr*.{par2,PAR2}..'}, {'INFO': 'BearShare: Finished par verify (1 par group, took: 0s)'}, {'INFO': 'BearShare: Unraring BearShare4.cbr..'}, {'INFO': 'BearShare: Finished unraring (1 rar group, took: 1s)'}, {'INFO': 'BearShare: Finished processing (took: 2s)'}, {'INFO': 'The_Advantage-berkeley_live: Finished par verify (1 par group, took:58s)'}, {'INFO': 'The_Advantage-berkeley_live: Unraring The Advantage art.rar..'}, {'INFO': 'The_Advantage-berkeley_live: Finished unraring (1 rar group, took: 1s)'}, {'INFO': 'The_Advantage-berkeley_live: Decompressing 4 files via 2 threads..'}, {'INFO': 'The_Advantage-berkeley_live: Decompressing to wav: CD101- Mega Man.flac'}, {'INFO': 'The_Advantage-berkeley_live: Decompressing to wav: CD102- Z (pt. 1).flac'}, {'INFO': 'Downloading newzbin NZB: 9991199 '}], 'maxrate': 0, 'percent_complete': 0, 'queued': [], 'queued_mb': 0, 'rate': 0, 'time': , 'total_dl_files': 20, 'total_dl_mb': 733, 'total_dl_nzbs': 4, 'total_dl_segments': 1055, 'uptime': '00:43', 'version': '0.9-trunk'} >>> for x in hellanzbServer.system.listMethods(): ... print x ... print hellanzbServer.system.methodSignature(x) ... print hellanzbServer.system.methodHelp(x) ... force [['struct', 'string'], ['struct', 'int']] Force hellanzb to begin downloading the NZB with the specified ID immediately, interrupting the current download process [['struct', 'string'], ['struct', 'string', 'string']] Post process the specified directory. The -p option is preferable -- it will do this for you, or use the current process if this XML-RPC call fails dequeue [['list', 'string'], ['list', 'int']] Remove the NZB with specified ID from the queue move [['list', 'string', 'string'], ['list', 'int', 'int']] Move the NZB with the specified ID to the specified index in the queue down [['list', 'string'], ['list', 'int'], ['list', 'string', 'string'], ['list', 'int', 'int']] Move the NZB with the specified ID down in the queue. The optional second argument specifies the number of spaces to shift by (Default: 1) cancel [['struct']] Cancel the current download and move the current NZB to Hellanzb.TEMP_DIR shutdown [['boolean']] Shutdown hellanzb. Will quietly kill any post processing threads that may exist asciiart [['string']] Return a random ascii art aolsay [['string']] Return a random aolsay (from Da5id's aolsay.scr) setrarpass [['struct', 'int', 'string'], ['struct', 'string', 'string']] Set the rarPassword for the NZB with the specified ID enqueueurl [['struct', 'string']] Download the NZB at the specified URL, and enqueue it next [['list', 'string'], ['list', 'int']] Move the NZB with the specified ID to the beginning of the queue maxrate [['int'], ['int', 'string'], ['int', 'int']] Return the Hellanzb.MAX_RATE (maximum download rate) value. Specify a second argument to change the value -- a value of zero denotes no maximum rate status [['struct']] Return hellanzb's current status text enqueuenewzbin [['struct', 'string'], ['struct', 'int']] Download the NZB with the specified NZB ID from www.newzbin.com, and enqueue it enqueue [['struct', 'string'], ['struct', 'string', 'string']] Add the specified NZB file to the end of the queue pause [['struct']] Pause downloading last [['list', 'string'], ['list', 'int']] Move the NZB with the specified ID to the end of the queue clear [['struct'], ['struct', 'boolean']] Clear the current nzb queue. Specify True as the second argument to clear anything currently downloading as well (like the cancel call) list [['list'], ['list', 'boolean']] List the NZBs in the queue, along with their NZB IDs. Specify True as the second argument to exclude the NZB ID in the listing. Returns a list of structs (nzbid -> nzbName). Excluding the NZB IDs returns a list of nzbName strings up [['list', 'string'], ['list', 'int'], ['list', 'string', 'string'], ['list', 'int', 'int']] Move the NZB with the specified ID up in the queue. The optional second argument specifies the number of spaces to shift by (Default: 1) continue [['struct']] Continue downloading after being paused system.methodHelp [['string', 'string']] Return a documentation string describing the use of the given method. system.listMethods [['array']] Return a list of the method names implemented by this server. system.methodSignature [['array', 'string'], ['string', 'string']] Return a list of type signatures. Each type signature is a list of the form [rtype, type1, type2, ...] where rtype is the return type and typeN is the type of the Nth argument. If no signature information is available, the empty string is returned. }}} Calls typically take both strings and ints where appropriate, for example the enqueuenewzbin call shown above Calls typically return one of: * boolean, if they completed successfully or not * list (of items in the queue) * struct (the status struct shown above) The method signatures can be determined from the introspection docs. For more information on XML-RPC introspection go here: http://ldp.kernelnotes.de/HOWTO/XML-RPC-HOWTO/xmlrpc-howto-interfaces.html XML-RPC TODO: better introspection docs