Erwan Kerfourn
- Updated
This article has been written to help users participating to the Dalet Flex Challenge 2023 - Challenge number 3 Publish. The configurations described here are not intended to be reproduced in a production environment.
Start by creating a new Decision action with the plugin JEF Script Multi-Decision.
Begin the script by defining the execute() function. Use the following line of code:
def execute() {
Declare the asset variable and assign it the value of context.asset. This can be done with the following line of code:
def asset = context.asset
Log the information about the video stream contexts using context.logInfo(). You can use the following line of code:
context.logInfo("Video Stream Info: " + asset.assetContext?.videoStreamContexts?.toString())
Log the information about the format context using context.logInfo(). Add the following line of code:
context.logInfo("Context: " + asset.assetContext?.formatContext?.toString())
Log a warning message about the format using context.logWarn(). Use the following line of code:
context.logWarn("The format is: " + asset.assetContext.formatContext.format.toString())
Declare the format variable and assign it the value of asset.assetContext.formatContext.format.toString(). This can be done with the following line of code:
def format = asset.assetContext.formatContext.format.toString()
Set a workflow string variable named 'test' with the value of format as a string using context.setWorkflowStringVariable(). Add the following line of code:
context.setWorkflowStringVariable('test', format as String)
Implement a conditional statement to check if the format is one of the specified formats ("MXF", "MP4", or "MOV"). Use an if-else statement as follows:
if (format == "MXF" || format == "MP4" || format == "MOV") {
return 'ok'
} else {
return 'fail'
}
Finally, close the execute() function by adding the following line of code:
}
So, this script retrieves an asset, logs information about the video stream contexts and format context, sets a workflow string variable, and checks if the format is "MXF", "MP4", or "MOV". It returns 'ok' if the format matches one of the specified formats and 'fail' otherwise.
def execute() {
def asset = context.asset
context.logInfo("Video Stream Info: "+ asset.assetContext?.videoStreamContexts?.toString())
context.logInfo("Context: "+ asset.assetContext?.formatContext?.toString())
context.logWarn("The format is: "+ asset.assetContext.formatContext.format.toString())
def format = asset.assetContext.formatContext.format.toString()
context.setWorkflowStringVariable('test', format as String)
if( format == "MXF" || format == "MP4" || format == "MOV" ){
return 'ok'
}
else {
return 'fail'
}
}
Comments
0 comments
Please sign in to leave a comment.