Until such time as the functions have been added to Picard, I have put together a plugin that adds some text-based scripting functions. The pre-release (testing) version of the plugin is available from my plugin repository on GitHub.
Any testing comments would be appreciated so the plugin can be fine-tuned for official release (or the functionality added to Picard).
Text Compare Functions [Download]
Overview
This plugin provides text-based comparison scripting functions similar to the integer-based comparison functions $lt()
, $lte()
, $gt()
and $gte()
, plus two additional functions to find the minimum and maximum values using a text-based comparison. These can be used for comparing non-integer values such as dates.
Scripting Functions Added
This plugin adds six new scripting functions to allow text-based operations:
$tlt(x,y)
Returns true if x
is less than y
using a text comparison.
$tlte(x,y)
Returns true if x
is less than or equal to y
using a text comparison.
$tgt(x,y)
Returns true if x
is greater than y
using a text comparison.
$tgte(x,y)
Returns true if x
is greater than or equal to y
using a text comparison.
$tmin(x,…)
Returns the minimum value using a text comparison. Can be used with an arbitrary number of arguments.
$tmax(x,…)
Returns the maximum value using a text comparison. Can be used with an arbitrary number of arguments.
Examples
Example 1:
Determine if the release is a re-issue based on the release date, so that it can be used in the file naming script.
$set(_type,$if($and(%date%,%originaldate%),$if($tgt(%date%,%originaldate%),Original Release,Re-Release),Unknown))
Example 2:
Find the earliest of recording date or release date.
$set(_type,$if($or(%date%,%originaldate%),$tmin($if2(%date%,9999-12-31),$if2(%date%,9999-12-31)),0000-00-00))