

exit ( COMMAND_ERROR ) if test_mode : print ( ' Test connection.' ) sys. get ( 'NZBCP_COMMAND' ) test_mode = command = 'ConnectionTest' if command != None and not test_mode : print ( ' Invalid command ' + command ) sys. In the next example we define a new section with two options:ĬOMMAND_SUCCESS = 93 COMMAND_ERROR = 94 # Check if the script is executed from settings page with a custom commandĬommand = os. The options are then made available on the settings page for user to configure.Įvery option belongs to a configuration section.

To avoid hard-coding of these data in the script NZBGet allows the script to define the required options in the configuration section. The user needs to configure the script with options such as SMTP-Server host, port, login and password. Let’s say we are writing a script to send E-Mail notification. The script definition can be longer than 10KB but it must start within first 10KB of the script. Put the script definition at the beginning of the script. NOTE: for performance reasons NZBGet scans only first 10KB of the script. If a signature is found, the file is considered to be a script. NZBGet scans all files in script-directory (option ScriptDir) and all files in first-level sub-directories looking for script definition signature # NZBGET SCRIPT. The long description is separated with an empty line. This should be a short one sentence description.
#LOG NZBGET DOWNLOAD#
The short description stays near the script name in the edit download dialog. This line is a short description of what our pp-script does. The definition starts with one of the possible signatures depending on the purpose of the script: Configuration definitionĮach script must have a configuration definition. For specific information about certain kinds of scripts please also read the dedicated articles.
#LOG NZBGET HOW TO#
This article describes how to write extension scripts in general. Select a script to review or change its options (if it has any). Menu at the left of page should list all extension scripts found in ScriptDir. Then go to settings tab in web-interface (if you were already on settings tab switch to downloads tab and then back to settings tab to reread the list of available scripts from the disk). To make a script available in NZBGet put the script into this directory. Option ScriptDir defines the location of extension scripts. On certain events the scripts are executed, they receive information about event, do certain work and can communicate with NZBGet to give it instructions for further processing. NZBGet provides documented entry points for scripts. The core functionality of NZBGet can be extended using extension scripts.
