[]
  • :
  • In DOPAL 0.60, a new module was introduced to make it more convenient for writing scripts which used the DOPAL library - the scripting module. It allows small scripts to be written which are provided with convenience functions to make life easier for the script, and it also allows the details of how to run the script (and what Azureus instance to connect to) to be controlled from the command line, rather than hardcoding settings in the script.

    The following scripts are examples of how the scripting module can be used (it also shows how easy it is to write a script to perform a particular piece of functionality rather than writing a plugin in Azureus to achieve the same thing):

      Example script which showcases a lot of the functionality the scripting module has to offer. Script which parses a simple text file containing IP addresses and port number pairs, and adds them to all running downloads. Script which pauses downloads for 5 minutes, and then resumes them. Prints the request and response XML when retrieving information about all downloads.

    By passing the script function to the dopal.scripting.run handler function, you can then configure the way the script runs through command line arguments. I'll explain more about the available options at a later date - for now, here's the help text generated by the scripting module.


    Usage
    =====
      example.py [options] [--help]
    
    Options
    =======
    --help, -h              show this help message and exit
    
    --run-mode=[background, command, app]
                            profile to run script in
    
    --needs-connection=[YES, no]
                            indicates whether the ability to connect is required,
                            if not, then it causes the script to terminate cleanly
    
    --announce=[yes, ERROR, no]
                            indicates whether the user should be alerted via
                            Azureus when the script starts and stops (or just when
                            errors occur)
    
    --pause-on-exit=[yes, error, NO]
                            indicates whether the script should pause and wait for
                            keyboard input before terminating
    
    Logging setup options
    ---------------------
    These options will configure how logging is setup for the script.
    
    --logging=[none, LOCAL]
                            details where the script can send log messages to
    
    --loglevel=[debug, info, WARN, error, fatal]
                            set the threshold level for logging
    
    --logdest=[FILE, stderr]
                            set the destination for local logging output
    --logfile=LOGFILE       log file to write out to
    
    Connection setup options
    ------------------------
    These options are used to set up and test your own personal connection
    settings. Running with any of these options will cause the script not to be
    executed.
    
    --setup-connection      Setup up the default connection data for scripts.
    --test-connection       Test that DOPAL can connect to the connection
                            configured.
    --delete-connection     Removes the stored connection details.
    
    Script setup options
    --------------------
    These options are used to extract and set information related to the environment
    set up for the script. Running with any of these options will cause the script
    not to be executed.
    
    --data-dir-info         Prints out where the data directory is for this script.