User Tools

Site Tools


functions:others_functions

This is an old revision of the document!


Functions

All these functions will manipulate character strings to fit your needs. Functions can use into conditional node and populate variable node and keep the result in a variable.

There are 3 groups of functions :

  1. Others functions

Others Functions

$exists

  • This is a file function that will tell if file(s) exists. Returns the amount of files found and and 0 if it there is no match.

Usage:
$exists(input string = “string/%variable%”)

$exists(“C:\Windows\explorer.exe”) 1

$exists(“C:\Windows\system32\win*”) 98


$base64

TODO: seems to be broke currently


$jsonencode and $jsonget

  • $jsonencode : Converts the input string to an JSON friendly string.

Note that this does not produce any JSON data structure but one can use the result as a “Value” in a JSON data structure. This can be used in order to produce a JSON string for further automatic processing, e.g. send a POST request to some 3rdparty API using the HTTP Request processor. Or to write a JSON File using the Write File processor.

  • $jsonget : Retrieves the value from a JSON object key. The first argumenst accept a string or a variable representing a valid JSON string. In the second section you refer to the object/key/array you want to get.

Usages:
$jsonencode(input string = “string/%variable%”) $jsonget(input string = “string/%variable%”[, input string = “string/%variable%”])

$jsonencode(“D:\My\Media\folder”) D:\\My\\Media\\folder

$jsonencode('Hello “World”') } Hello \“World\”

$jsonget('{“things”:{“myStuff”:“some other stuff”}}', “things.myStuff”) some other stuff

$jsonget('%s_info_ffprobe%', '[1].format_name') mov,mp4,m4a,3gp,3g2,mj2


$readarray

  • Returns an instance from a valid array which must be in the form of “[“data”, data, etc…]”. All JSON formated data is valid. By default the function will return the first instance. If none is found it will return an empty string; “”.

This can be used in combination with another processor which generates JSON on output, for example loudness filter or in combination again with a HTTP Get processor that receives JSON data from a 3rdparty API.

Usage:
$readarray(input string = “string/%variable%”[, input integer = integer/%variable%])

$readarray(“[23, 55.5, 19]”, 2) 55.5

$readarray('[“make”, “my”, “day”]', 3) day


$regext

  • This is regular expression function. It extracts text based on recognition patterns. It uses the Perl Compatible Regular Expressions (PCRE) engine. http://www.pcre.org/

Usage :
$regext(input string = “string/%variable%”, pattern = “string/%variable%”)

$regext(“<Duration value=“1214”/>”, “<Duration value=”(\d+)“/>”) 1214

$regext(“TVShow_EP0013.mxf”, “/(EP\d{4})/”) EP0013


$hex and $dec

  • $hex : Converts a decimal integer to hexadecimal number.
  • $dec : Converts a hexadecimal number to decimal integer. Function accepts both quoted and unquoted input.

Usages :
$hex(input integer = integer/%variable%)
$dec(input string/integer = “string”/integer/%variable%)

$hex(8) 8 $hex(15) f

$dec(8) 8 $dec(“f”) 15


$guid

  • Returns a random GUID/UUID.

Usage :
$guid()

$guid() bc067580-f7de-4e12-9f84-7e905bd60378


$xxhash

  • Returns an eight character hash for any file. Must include full path. The hash is created using Yann Collet's xxHash which is very fast and suits large video files.

Usage :
$xxhash(input string = “string/%variable%”)

$xxhash(“x:\path\to\file.mxf”) 61abf926


$read

  • $read : Reads the contents of a any text file. The function will automatically try to determine correct encoding. If storing as a variable the string length is limited to approximately 80.000 characters.

$read(“metadata.xml”)


$urlencode

  • Converts the input string to an URL friendly string.

Usage :
$urlencode(input string = “string/%variable%”)

$urlencode(“FFAStrans is #supercool!”) FFAStrans%20is%20%23supercool!


functions/others_functions.1577194126.txt.gz · Last modified: 2020/11/16 19:08 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki