Scripting overview

Subtitle Processor contains Ruby scripting engine. It can run any Ruby code. Ruby is not required to be installed (As long as the scripts are using only the core functions (i.e. no 'require' statement), SP has it's own Ruby interpreter DLL.

Subtitle Processor provides a low-level scripting API, that comprises of several Ruby modules providing various methods for manipulating SP objects. There also are the high-level classes. These classes serve as a layer between the script and the low level API. Scripts should use the high level classes where possible.

Scripts are placed in the data/script directory by default, but they can be anywhere on the HDD.

Subtitle Processor maintains a list of scripts (Settings - General - Scripting) that are evaluated upon start. These scripts are loaded and a special expression is evaluated for each script:

Each script must define a method sp_query, that is called in case of initialization. This method receives the path to the script file in it's file parameter. This value can be used for registration of various UI components.