Page 1 of 1

[New Feature] General scripts concept

Posted: 06 May 2014, 16:02
by hugbug
The post-processing scripts concept initially introduced in v11 has provided an easy way to install and configure post-processing scripts. This made it easier for users to share their scripts. Although post-processing scripts are the most important scripts there are also other kinds of scripts used in the program:
  • scan-script, called for each nzb-file or any other file found in the incoming nzb-directory. The script is called before the nzb-file is added to queue (option NzbProcess);
  • queue-script, called for each nzb-file after it is added to queue (option NzbAddedProcess);
  • scheduler scripts, which are executed by task scheduler (option TaskX.Process).
Now all these scripts work the same way as post-processing scripts and can be easier installed and configured by users. Few interesting scan-scripts were posted on forum (extract password from nzb-filename, unzip packed nzb-files, send notification). The general scripts concept allows for easier sharing of scripts of all kinds.

Details:
  • option "NzbProcess" renamed to "ScanScript";
  • option "NzbAddedProcess" renamed to "QueueScript";
  • option "DefScript" and "CategoryX.DefScript" renamed to "PostScript" and "CategoryX.PostScript" (options with old names are recognized and automatically converted on first settings saving);
  • new option "TaskX.Script"; old option "TaskX.Process" kept for scheduling of external programs not related to nzbget (to avoid writing of intermediate proxy scripts);
  • scan-script, queue-script and scheduler-script now work similar to post-processing scripts:
    • scripts must be put into scripts-directory;
    • scripts can be configured via web-interface and can have options;
    • multiple scripts can be chosen for each scripts-option, all chosen scripts are executed;
    • program and script options are passed to the script as env. variables;
  • renamed default directory with scripts from "ppscripts" to "scripts";
  • script signature indicates the type of script (post-processing, scan, queue or scheduler);
  • one script can have mixed signature allowing it to be used for multiple purposes (for example a notification script can send a notification on both events: after adding to queue and after post-processing);
  • result of RPC-method "configtemplates" has new fields "PostScript", "ScanScript", "QueueScript", "SchedulerScript" to indicate the purpose of the script;
  • queue-script (formerly NzbAddedProcess) has new parameter "NZBNA_EVENT" indicating the reason of calling the script;
  • currently the script is called only after adding of files to download queue and therefore the parameter is always set to "NZB_ADDED" but the queue-script can be called on other events in the future too
Implemented in r 1012.

Documenation
The documentation page for post-processing scripts will be extended with info on writing scan, queue and scheduler scripts. Basically the scripts need signature to be recognized as such and the scripts now have the whole environment similar to post-processing scripts (program options, script options). The following signatures are used:

Code: Select all

### NZBGET SCAN SCRIPT
### NZBGET QUEUE SCRIPT
### NZBGET SCHEDULER SCRIPT
One script can be used for multiple purposes. It need a mixed signature then, for example:

Code: Select all

### NZBGET SCAN/QUEUE SCRIPT
or

Code: Select all

### NZBGET SCAN/POST-PROCESSING SCRIPT
Feedback
Please ask any questions or report problems in this topic.

Re: [New Feature] General scripts concept

Posted: 13 May 2014, 14:06
by Telman12
HI
I had interest in the script.
where can I find them

Re: [New Feature] General scripts concept

Posted: 13 May 2014, 15:33
by hugbug
All scripts are in subforum Post-processing scripts, but the scan and queue scripts may not be adopted to new concept yet.

Re: [New Feature] General scripts concept

Posted: 15 May 2014, 08:28
by hugbug
Small change on forum: renamed sub-forum Post-processing scripts to Extension scripts.