Miscellaneous Functions: Difference between revisions
RoderickGI (talk | contribs) (Added Range() function.) |
No edit summary |
||
(19 intermediate revisions by 2 users not shown) | |||
Line 89: | Line 89: | ||
<div style="text-align:right;">([[#top|Back to top)]]</div> |
<div style="text-align:right;">([[#top|Back to top)]]</div> |
||
=== <span id=" |
=== <span id="Char">Char(…)</span> === |
||
: Returns a character from the numeric code of that character |
|||
: Counts upwards in specified increments. |
|||
{{function description box |
|||
{| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |
|||
| name=Char |
|||
|- id="Counter" valign="top" |
|||
| arguments=Numeric Number Code |
|||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description |
|||
| description= |
|||
| style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>counter(</b><i>start value</i><b>, </b><i>increment</i><b>)</b></span> |
|||
[[#Char|Char()]] has unicode support, however, only decimal values are supported. If you require a Hex to Decimal convertor, try [https://unicode-search.net/ unicode-search.net], or search for an alternative online. |
|||
The [[#Counter|Counter()]] function outputs a monotonically increasing number (more simply stated, it counts) from a <i>start value</i>, |
|||
and each time called, increases by the <i>increment</i> value. |
|||
It is useful for sequentially numbering fields. |
|||
The [[#Counter|Counter()]] function maintains an internal counter, and it resets itself to zero after five seconds of inactivity. |
|||
| examples= |
|||
Because [[#Counter|Counter()]] continues to count, it should only be used in single-use situations such as assigning its output to some field through field value assignment, for example, <span style="font-family: monospace,monospace; font-size:1em;">=counter()</span>. |
|||
'''{{monospace|Char(189)}}''' |
|||
With proper care, it can be used as part of an expression in the Rename, Move & Copy tool, but see also [[#CustomData|CustomData()]]. |
|||
: Returns ½ |
|||
'''{{monospace|Char(9679)}}''' |
|||
It is not recommended for use in any context that continually refreshes its content, such as in a panes column, file list, or expression-based custom query. |
|||
: Returns ● |
|||
Probably the best way to understand the results is to test the first example below as an expression column in a file list, and move the mouse around over that column. |
|||
}} |
|||
Argument <i>start value</i> is optional (defaults to 1). |
|||
Argument <i>increment</i> is optional (defaults to 1). |
|||
|- valign="top" |
|||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |
|||
|style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>counter()</nowiki></b></span> |
|||
<p style="margin-left:20pt;">Outputs values starting at <span style="font-family: monospace,monospace; font-size:1em;">1</span>, and incrementing by one, it will return <span style="font-family: monospace,monospace; font-size:1em;">1</span>, <span style="font-family: monospace,monospace; font-size:1em;">2</span>, <span style="font-family: monospace,monospace; font-size:1em;">3</span>, ... until no longer called. |
|||
This might be used, for example, to assign to the [Track #] field of several tracks using the field assignment expression <span style="font-family: monospace,monospace; font-size:1em;">=counter()</span>.</p> |
|||
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>padnumber(counter(370, 2), 4)</nowiki></b></span> |
|||
<p style="margin-left:20pt;">Outputs numbers beginning from 370, incremented by two each, and padded to four digits. For example, <span style="font-family: monospace,monospace; font-size:1em;">0370</span>, <span style="font-family: monospace,monospace; font-size:1em;">0372</span>, <span style="font-family: monospace,monospace; font-size:1em;">0374</span>, etc.</p> |
|||
|} |
|||
<div style="text-align:right;">([[#top|Back to top)]]</div> |
|||
=== <span id="CustomData">CustomData(…)</span> === |
=== <span id="CustomData">CustomData(…)</span> === |
||
Line 158: | Line 142: | ||
<p style="margin-left:20pt;">In and of itself, you might think that this is not 'all that', however, remember that we can combine this with other functions, thus giving us the ability to create expressions with playlist rules. A simple example would be:</p> |
<p style="margin-left:20pt;">In and of itself, you might think that this is not 'all that', however, remember that we can combine this with other functions, thus giving us the ability to create expressions with playlist rules. A simple example would be:</p> |
||
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>[=IsEqual(fileplaylists(),genre,8)]=1</nowiki></b></span> |
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>[=IsEqual(fileplaylists(),genre,8)]=1</nowiki></b></span> |
||
<p style="margin-left:20pt;">which when used in the search bar, will return all files that appear on |
<p style="margin-left:20pt;">which when used in the search bar, will return all files that appear on any playlist containing 'Genre' in its name</p> |
||
|} |
|} |
||
<div style="text-align:right;">([[#top|Back to top)]]</div> |
<div style="text-align:right;">([[#top|Back to top)]]</div> |
||
=== <span id=" |
=== <span id="Literal">Literal(…)</span> === |
||
: Returns a string as given without any formatting or processing |
|||
: Evaluates a given mathematical formula. |
|||
{{function description box |
|||
{| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |
|||
| name=Literal |
|||
|- id="Math" valign="top" |
|||
| arguments=String |
|||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description |
|||
| description= |
|||
| style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>math(</b><i>expression</i><b>)</b></span> |
|||
[[#Literal|Literal()]] returns a given string as-is without any formatting or processing |
|||
The [[#Math|Math()]] function performs mathematical calculations. |
|||
Standard arithmetic operators are supported, as are various numerical, trigonometric, and comparative functions. |
|||
Simple variables are supported, as are multiple statements. |
|||
| examples= |
|||
<blockquote> |
|||
'''{{monospace|If(IsEqual([Artist], Queen, 1), Literal(If all music was Queen, I would be 10/10ths happy!), Literal(This is not Queen, which makes me sad. :-/))}}''' |
|||
{| style="background: #f9f9f9;" border="1" cellpadding="1" cellspacing="0" |
|||
: This does not work, with the sad face breaking the expression completely and generating an error. It should work, suggesting that the Literal() function is currently broken. |
|||
| rowspan="6" width="100" valign="top" | '''Arithmetic Operators''' |
|||
: This reference will be updated once clarification has been received. In the meantime, as detailed under [[Expression Language#Expression Language Syntax|Expression Language Syntax]], using /* ... /* does work as Literal() is expected to. See next example... |
|||
| align="center" width="65" | + || Addition |
|||
|- |
|||
| align="center" | - || Subtraction |
|||
|- |
|||
| align="center" | * || Multiplication |
|||
|- |
|||
| align="center" | / || Division |
|||
|- |
|||
| align="center" | ^ || Power |
|||
|- |
|||
| align="center" | % || Modulo |
|||
|- |
|||
| rowspan="3" | '''Boolean Operators''' |
|||
| align="center" | ! || NOT |
|||
|- |
|||
| align="center" | & || AND |
|||
|- |
|||
| align="center" | <nowiki>|</nowiki> || OR |
|||
|- |
|||
| rowspan="1" | '''Grouping Operators''' |
|||
| align="center" | ( ) || Precedence grouping |
|||
|- |
|||
| rowspan="4" | '''Comparison Operators''' |
|||
| align="center" | } || Absolute value maximum (i.e. x or y that is maximum distance from 0). |
|||
|- |
|||
| align="center" | { || Absolute value minimum (i.e. x or y that is minimum distance from 0). |
|||
|- |
|||
| align="center" | > || Distance between x and y, positive when x greater than y, negative otherwise. |
|||
|- |
|||
| align="center" | < || Distance between x and y, positive when x less than y, negative otherwise. |
|||
|- |
|||
| rowspan="7" | '''Functions''' |
|||
| align="center" | abs(x) || Returns the absolute value of x. |
|||
|- |
|||
| align="center" | sign(x) || Returns the sign of x (1 when x >= 0, -1 when x < 0). |
|||
|- |
|||
| align="center" | log(x) || Returns the natural logarithm (base e) of x. |
|||
|- |
|||
| align="center" | log10(x) || Returns the common logarithm (base 10) of x. |
|||
|- |
|||
| align="center" | pow(x,y) || Returns x raised to the y-th power. |
|||
|- |
|||
| align="center" | rand(x) || Returns a random value ranging between 0 to x. |
|||
|- |
|||
| align="center" | randn(x) || Returns a random value ranging between -x and x. |
|||
|- |
|||
| rowspan="5" | '''Comparison Functions''' |
|||
| align="center" | min(x,y) || Returns the minimum value of x and y. |
|||
|- |
|||
| align="center" | max(x,y) || Returns the maximum value of x and y. |
|||
|- |
|||
| align="center" | equal(x,y) || Returns 1 when x = y, 0 otherwise. |
|||
|- |
|||
| align="center" | below(x,y) || Returns 1 when x < y, 0 otherwise. |
|||
|- |
|||
| align="center" | above(x,y) || Returns 1 when x > y, 0 otherwise. |
|||
|- |
|||
| rowspan="4" | '''Formatting Functions''' |
|||
| align="center" | int(x) || Returns the integer portion of x. |
|||
|- |
|||
| align="center" | frac(x) || Returns the fractional portion of x. |
|||
|- |
|||
| align="center" | round(x) || Returns x rounded to the nearest whole number. |
|||
|- |
|||
| align="center" | trunc(x,n) || Returns x truncated to n decimal places. |
|||
|- |
|||
| rowspan="6" | '''Trigonometric Functions''' |
|||
| align="center" | atan(x) || Returns the arctangent of x. |
|||
|- |
|||
| align="center" | cos(x) || Returns the cosine of x. |
|||
|- |
|||
| align="center" | sin(x) || Returns the sine of x. |
|||
|- |
|||
| align="center" | tan(x) || Returns the tangent of x. |
|||
|- |
|||
| align="center" | abscos(x) || Returns the absolute value of cosine(x). |
|||
|- |
|||
| align="center" | abssin(x) || Returns the absolute value of sin(x). |
|||
|} |
|||
</blockquote> |
|||
'''{{monospace|/*Left(Theater,3) returns/* Left(Theater,3)}}''' |
|||
The order of operator precedence is summarized as follows, from top to bottom: |
|||
: Returns {{monospace|Left(Theater,3) returns The}}. Here, the first expression function is not evaluated and instead, presented as given, whilst the second function, which is not escaped, is evaluated. Escaping text in this way could be useful if working with a large block of text that might contain parenthesis, forward slashes or other characters that would otherwise require to be escaped individually. |
|||
}} |
|||
=== <span id="Repeat">Repeat(…)</span> === |
|||
<div style="margin-left: 20pt;"><table style="border-spacing:0px; border-collapse:collapse; background: #f9f9f9"> |
|||
: Repeats a given string a specified number of times |
|||
<tr><td style="text-align:left; padding-right:20pt"><b>( )</b></td><td> </td></tr> |
|||
<tr><td style="text-align:left; padding-right:20pt"><b> !</b></td><td> </td></tr> |
|||
<tr><td style="text-align:left; padding-right:20pt"><b> ^</b></td><td> </td></tr> |
|||
<tr><td style="text-align:left; padding-right:20pt"><b>* /</b></td><td>Left to right</td></tr> |
|||
<tr><td style="text-align:left; padding-right:20pt"><b>+ -</b></td><td>Left to right</td></tr> |
|||
<tr><td style="text-align:left; padding-right:20pt"><b><nowiki>|</nowiki> &</b></td><td>Left to right</td></tr> |
|||
</table></div> |
|||
{{function description box |
|||
Variables may be assigned and used by specifying a simple string of letters. Examples: <span style="font-family: monospace,monospace; font-size:1em;">math(val=2)</span> or <span style="font-family: monospace,monospace; font-size:1em;">math(x=pow(2,3))</span>. |
|||
| name=Repeat |
|||
| arguments=Value, Count |
|||
| description= |
|||
Repeats {{monospace|"Value", "Count"}} number of times. |
|||
| examples= |
|||
'''{{monospace|<nowiki>Repeat(*,10)</nowiki>}}''' |
|||
: Returns ********** |
|||
'''{{monospace|<nowiki>Repeat(Ha,5)</nowiki>}}''' |
|||
Multiple equations may be specified, each separated by a semicolon. |
|||
: Returns HaHaHaHaHa |
|||
Expressions are evaluated left to right. |
|||
}} |
|||
The final value of the [[#Math|Math()]] function will be the result of the right-most equation. For example, the equation <span style="font-family: monospace,monospace; font-size:1em;">math(x=4; pow(2^x))</span> will output 16. |
|||
=== <span id="Row">Row(…)</span> === |
|||
<b>Note</b>: Empty fields |
|||
: Returns the row number of a list entry |
|||
{{function description box |
|||
Fields used inside of [[#Math|Math()]] are expanded (interpolated) directly. |
|||
| name=Row |
|||
Fields with empty values may produce incomplete [[#Math|Math()]] statements. |
|||
| arguments= |
|||
For example, if the field [number plays] is empty, an <i>expression</i> such as <span style="font-family: monospace,monospace; font-size:1em;">math([number plays] + 2)</span> would be seen |
|||
| description= |
|||
by [[#Math|Math()]] as <span style="font-family: monospace,monospace; font-size:1em;"> + 2</span>. |
|||
Row() returns the row number for each item in a list. |
|||
This incomplete <i>expression</i> would produce a syntax error. See the Additional Examples for more information. |
|||
| examples= |
|||
'''{{monospace|<nowiki>Row()</nowiki>}}''' |
|||
: When used as an expression column in a file list, each row is numbered starting at 1, incrementing by 1. |
|||
}} |
|||
<b>Note</b>: Locales and Commas |
|||
Special care must be taken with the [[#Math|Math()]] function and locales that use <span style="font-family: monospace,monospace; font-size:1em;">,</span> (comma) as a decimal separator. |
|||
Many Media Center fields and the return values from functions may contain comma as the decimal point. |
|||
Your expressions will need to [[#Replace|Replace()]] these before passing the values to [[#Math|Math()]], |
|||
which always uses dot <span style="font-family: monospace,monospace; font-size:1em;">.</span> as the numeric decimal point. |
|||
For example, the <i>expression</i> <span style="font-family: monospace,monospace; font-size:1em;">math(1,5 + 1,5)</span> will fail since [[#Math|Math()]] does not consider <span style="font-family: monospace,monospace; font-size:1em;">1,5</span> to be a valid number. |
|||
Fields that cause problems are any fields that produce floating-point values, such as any Date type field in raw format |
|||
(e.g. <span style="font-family: monospace,monospace; font-size:1em;">[date,0]</span>, <span style="font-family: monospace,monospace; font-size:1em;">[last played,0]</span>, <span style="font-family: monospace,monospace; font-size:1em;">[date modified,0]</span>, and <span style="font-family: monospace,monospace; font-size:1em;">[date imported,0]</span>), or any textual field that contains |
|||
floating-point values that will be used for various calculations (e.g. any of the Dynamic Range variants). |
|||
Certain functions such as [[#Now|Now()]] and [[#ConvertTime|ConvertTime()]] also return localized floating-point values. |
|||
Handling this problem is not difficult. |
|||
Before passing any floating point number to [[#Math|Math()]], use [[#Replace|Replace()]] first. See the examples below. |
|||
|- valign="top" |
|||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |
|||
|style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>math(10 + 4)</nowiki></b></span> |
|||
<p style="margin-left:20pt;">Returns 14.</p> |
|||
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>math(10 + 2 * 25)</nowiki></b></span> |
|||
<p style="margin-left:20pt;">Returns 60, demonstrating that multiplication has higher precedence than addition.</p> |
|||
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>math((10 + 2) * 25)</nowiki></b></span> |
|||
<p style="margin-left:20pt;">Returns 300, demonstrating that parenthesis grouping has higher precedence than multiplication.</p> |
|||
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>math(replace(now(), /,, .) - replace([last played,0], /,, .))</nowiki></b></span> |
|||
<p style="margin-left:20pt;">The <span style="font-family: monospace,monospace; font-size:1em;">,</span> is replaced by a <span style="font-family: monospace,monospace; font-size:1em;">.</span> in the output of both [[#Now|Now()]] and in the raw field value <span style="font-family: monospace,monospace; font-size:1em;">[last played,0]</span>. |
|||
Note that the comma must be escaped so that it is seen as an argument and not as an argument separator.</p> |
|||
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>math(replace(now() - [last layed,0], /,, .))</nowiki></b></span> |
|||
<p style="margin-left:20pt;">The same as the previous example, but is more efficient and simpler since it calls [[#Replace|Replace()]] just once on the entire string to be passed to [[#Math|Math()]].</p> |
|||
Additional Examples |
|||
:[http://yabb.jriver.com/interact/index.php?topic=58110.0 An explanation and some solutions for fields that evaluate to empty within Math().] |
|||
|} |
|||
<div style="text-align:right;">([[#top|Back to top)]]</div> |
|||
=== <span id="Range">Range(…)</span> === |
|||
: Creates a semi-colon delimited list of numbers in a field. |
|||
{| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |
|||
|- id="Range" valign="top" |
|||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description |
|||
| style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>Range(</b><i>Start</i><b>, </b><i>Step</i><b>, </b><i>Count</i><b>)</b></span> |
|||
The [[#Range|Range()]] function returns a list of semi-colon separated numbers into one field, starting at the <i>Start</i> number, incrementing by the <i>Step</i> number, producing <i>Count</i> numbers. |
|||
Arguments <i>Start</i> and <i>Step</i> are optional (default to 0 Zero), and can be negative. |
|||
Argument <i>Count</i> is required and must be positive. |
|||
|- valign="top" |
|||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |
|||
|style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>Range(1, 1, 10)</nowiki></b></span> |
|||
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">1; 2; 3; 4; 5; 6; 7; 8; 9; 10</span>.</p> |
|||
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>Range(5, -1, 6)</nowiki></b></span> |
|||
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">5; 4; 3; 2; 1; 0</span>.</p> |
|||
|} |
|||
<div style="text-align:right;">([[#top|Back to top)]]</div> |
|||
=== <span id="Size">Size(…)</span> === |
=== <span id="Size">Size(…)</span> === |
||
Line 366: | Line 220: | ||
<div style="text-align:right;">([[#top|Back to top)]]</div> |
<div style="text-align:right;">([[#top|Back to top)]]</div> |
||
=== <span id=" |
=== <span id="Translate">Translate(…)</span> === |
||
: Converts an English string found in the program to the current language selected in the language menu |
|||
: Returns a file's track # value. |
|||
{{function description box |
|||
{| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |
|||
| name=Translate |
|||
|- id="TrackNumber" valign="top" |
|||
| arguments=String |
|||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description |
|||
| description= |
|||
| style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>tracknumber(</b><b>)</b></span> |
|||
When using Media Center with any language ''other than English'', the Translate() function can be used to translate an English string in the program to the current language. |
|||
The [[#TrackNumber|TrackNumber()]] function returns a file's track #, or 0 if the no value exists. |
|||
It is used to populate the Library field <span style="font-family: monospace,monospace; font-size:1em;">track #</span> with its value. |
|||
| examples= |
|||
Either the field or [[#TrackNumber|TrackNumber()]] can be used. |
|||
'''{{monospace|<nowiki>Translate(Keywords)</nowiki>}}''' |
|||
|- valign="top" |
|||
: If using the French language setting, this will return Mots-clés |
|||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples |
|||
}} |
|||
|style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>tracknumber()</nowiki></b></span> |
|||
<p style="margin-left:20pt;">Returns the value present in the <span style="font-family: monospace,monospace; font-size:1em;">track #</span> field.</p> |
|||
=== <span id="TreeNode">TreeNode(…)</span> === |
|||
|} |
|||
: Returns the selected tree path. |
|||
<div style="text-align:right;">([[#top|Back to top)]]</div> |
|||
{{function description box |
|||
| name=TreeNode |
|||
| arguments=Mode |
|||
| description= |
|||
{{argument optional}} |
|||
{{argument table |
|||
| name=mode |
|||
| contents= |
|||
{{argument table row|0|Returns the full tree path}} |
|||
{{argument table row|1|Returns the currently selected tree node}} |
|||
{{argument table row|2|Returns the parent of the currently selected tree node}} |
|||
}} |
|||
| examples= |
|||
'''{{monospace|<nowiki>TreeNode()</nowiki>}}''' |
|||
: Will return the full tree path of the currently selected tree item (Uses mode zero by default) |
|||
What this function does is self-explanatory. '''[https://yabb.jriver.com/interact/index.php/topic,128134.msg888957.html#msg888957 This conversation]''' on the Interact forums demonstrates a practical use-case scenario. |
|||
}} |
|||
=== <span id="TVInfo">TVInfo(…)</span> === |
=== <span id="TVInfo">TVInfo(…)</span> === |
Latest revision as of 05:44, 5 June 2021
- See also: Expression Language and Function Index
The functions in this section are varied and have specialized applicability. Some are primarily used internally by MC to generate values available in various Library fields.
AlbumArtist(…)
- Returns a file's calculated album artist.
Description | albumartist()
The AlbumArtist() function calculates the album artist value used in various views and fields. It is used to populate the Library field album artist (auto) with its value. Either the field or AlbumArtist() can be used. |
---|---|
Examples | albumartist()
Returns the value present in the album artist (auto) field. Additional Examples |
AlbumKey(…)
- Returns a unique album key for a file.
Description | albumkey()
The AlbumKey() function returns "[album artist (auto)] - [album]". It is a convenience function, used to return the generally unique album / artist combination string used to distinguish between two like-named albums such as "Greatest Hits". |
---|---|
Examples | albumkey()
For an album named Greatest Hits and an album artist (auto) of The Eagles, returns The Eagles - Greatest Hits. |
AlbumType(…)
- Returns the album type for a file.
Description | albumtype()
The AlbumType() function returns a description regarding an album's completeness and its quantity of artists. It is used to populate the Library field album type with its value. Either the field or AlbumType() can be used. |
---|---|
Examples | albumtype()
Returns, for example, Single artist (complete), or Multiple artists (incomplete). |
AudioAnalysisState(…)
- Returns the state of audio analysis for a file.
Description | audioanalysisstate()
The AudioAnalysisState() function returns a file's state of audio analysis. It can be used to determine if audio analysis (Library Tools > Analyze Audio...) should be performed on a media file. The AudioAnalysisState() function will return a string indicating the state of analysis. Possible values are currently:
| ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Examples | audioanalysisstate()
Returns, for example, Needed for files that require audio analysis, or N/A if the file type does not support audio analysis. Additional Examples |
Char(…)
- Returns a character from the numeric code of that character
Description | Char(Numeric Number Code)
Char() has unicode support, however, only decimal values are supported. If you require a Hex to Decimal convertor, try unicode-search.net, or search for an alternative online. |
---|---|
Examples | Char(189)
Char(9679)
|
CustomData(…)
- Returns internal data to the expression language.
Description | customdata(mode)
The CustomData() function supports returning Media Center internal data to the expression language. Currently the only supported mode provides a file's row number in a file list, which is useful in the Rename, Move & Copy tool to assist in numbering files. It can also be used in expressions in a playlist to obtain the file's sequence number. Available mode values:
| ||
---|---|---|---|
Examples | Spring_Break_Bash_padnumber(customdata(#), 4)
In the Rename, Move & Copy tool, each consecutive file would be named Spring_Break_Bash_ followed by a four digit, zero-padded number starting at 0001. |
FilePlaylists()
- Returns a list of playlists a file belongs to.
Description | FilePlaylists()
This function returns the list of playlists a file is in separated by semi-colons. |
---|---|
Examples | FilePlaylists()
Using this will return a list of all the playlists a file is in, separated by semi-colons. In and of itself, you might think that this is not 'all that', however, remember that we can combine this with other functions, thus giving us the ability to create expressions with playlist rules. A simple example would be: [=IsEqual(fileplaylists(),genre,8)]=1 which when used in the search bar, will return all files that appear on any playlist containing 'Genre' in its name |
Literal(…)
- Returns a string as given without any formatting or processing
Description | Literal(String)
Literal() returns a given string as-is without any formatting or processing |
---|---|
Examples | If(IsEqual([Artist], Queen, 1), Literal(If all music was Queen, I would be 10/10ths happy!), Literal(This is not Queen, which makes me sad. :-/))
/*Left(Theater,3) returns/* Left(Theater,3)
|
Repeat(…)
- Repeats a given string a specified number of times
Description | Repeat(Value, Count)
Repeats "Value", "Count" number of times. |
---|---|
Examples | Repeat(*,10)
Repeat(Ha,5)
|
Row(…)
- Returns the row number of a list entry
Description | Row()
Row() returns the row number for each item in a list. |
---|---|
Examples | Row()
|
Size(…)
- Returns a file's size in a format specific to the media type.
Description | size()
The Size() function returns media size information specific to the particular media type. It is used to populate the Library fields duration and dimensions with their values. Either the field or Size() can be used. Type of information reported by size for the file's media type:
| ||||||||
---|---|---|---|---|---|---|---|---|---|
Examples | size()
Returns values such as 400x225 for images, or 3:09 for audio files. |
Translate(…)
- Converts an English string found in the program to the current language selected in the language menu
Description | Translate(String)
When using Media Center with any language other than English, the Translate() function can be used to translate an English string in the program to the current language. |
---|---|
Examples | Translate(Keywords)
|
TreeNode(…)
- Returns the selected tree path.
Description | TreeNode(Mode)
Available mode values:
| ||||||
---|---|---|---|---|---|---|---|
Examples | TreeNode()
What this function does is self-explanatory. This conversation on the Interact forums demonstrates a practical use-case scenario. |
TVInfo(…)
- Miscellaneous television and other pre-formatted information.
Description | tvinfo(type)
The TVInfo() function is multi-purpose, and returns a specific type of information about television recordings, programs, and pre-formatted informational strings for use in captions, thumbnails, grouping, etc. Available type values:
| ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Examples | tvinfo(namedisplay)
Returns formatted name and series output. If the file has no [series] value, only [name] is output. |