Cinegy Convert supports the automatic execution of PowerShell scripts for various specific cases.

Tip
You can use one of the actual Cinegy sample scripts hosted on GitHub, or you can customize them to suit your needs.

Press the Profile_Editor_browse_icon button in the "Pre-processing" field of the profile configuration window. The script will be applied before task processing:

scripting_parameters

The following dialog appears:

script_editor_empty

script_import_button

Press the "Import" button to select an existing PowerShell script from the "Import script from" dialog that appears.

The script will be loaded into the dialog. You can edit it directly via the keyboard if necessary:

script_editor_loaded

script_export_button

The currently loaded script can be saved as a PS1 file by pressing the "Export" button and defining its location and name in the "Export script as" dialog that appears.

Press "OK".

You can also apply a script to be executed when task processing is finished in the same way by pressing Profile_Editor_browse_icon in the "Post-processing" field.

With the script(s) applied, the field value(s) in the profile editing form will be changed correspondingly:

script_is_set

To expel a selected script, click Profile_Editor_Edit_icon and select the "Clear" command:

Clear_field_value

Examples

Pre-processing Scripting

The pre-processing script will be executed before the task processing starts. It is used for defining additional metadata for a task, for instance, scanning the file, calculating the MD5 hash value, and locating it into one of the macros, which can be further used in profiles, for example, when importing into the Cinegy Archive database.

A sample script provided by Cinegy for download from GitHub enables generating TrafficID by a certain pattern.

Pre-processing scripting allows adding {src.meta.*} fields and their values to generate additional metadata to be applied to the media.

Important
Refer to the Source Macros article to get more information on the supported macros and their usage.

The script sample that demonstrates the required syntax is provided below:

param([Cinegy.Media.Linker.Strategies.ScriptOptimizationProvider]$provider)

$provider.AddMetadata('test_key', 'test1'); //Adding new value
$meta_value = $provider.Metadata['test_key']; //Reading of the added value

$provider.AddMetadata('test_key', 'test2'); //Exception will be generated
$provider.AddMetadata('src.name', 'new_name'); //Exception will be generated

The example above shows that the new metadata generated during the pre-processing script execution can be registered using $provider.AddMetadata(<macro>', $value). Once registered, the new metadata can be referenced, for example, in the profile parameters:

custom_metadata
Note
On the attempt to override the existing metadata values, the exception will occur.

Post-processing Scripting

The post-processing script will be applied on the entire completion of task processing, once the file is created or the node is registered in the Cinegy Archive database.

A sample script provided by Cinegy for download from GitHub uploads the video file processed by Cinegy Convert on Facebook.

Important
More information about this particular case can be found in the post devoted to the presentation "Hacking Cinegy" at Cinegy TechCon 2017.