Difference between revisions of "Miscellaneous Functions"
(→FilePlaylists()) |
|||
(26 intermediate revisions by 3 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 |
− | {| | + | {{function description box |
− | | | + | | name=Char |
− | + | | arguments=Numeric Number Code | |
− | + | | description= | |
− | + | [[#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. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | | examples= | |
− | + | '''{{monospace|Char(189)}}''' | |
− | + | : Returns ½ | |
− | + | '''{{monospace|Char(9679)}}''' | |
− | | | + | : Returns ● |
− | + | }} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== <span id="CustomData">CustomData(…)</span> === | === <span id="CustomData">CustomData(…)</span> === | ||
Line 151: | Line 135: | ||
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description | ! 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>FilePlaylists()</b></span> | | 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>FilePlaylists()</b></span> | ||
− | + | This function returns the list of playlists a file is in separated by semi-colons. | |
− | |||
− | |||
− | |||
− | |||
− | |||
|- valign="top" | |- 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 | ! 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>FilePlaylists()</nowiki></b></span> | |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>FilePlaylists()</nowiki></b></span> | ||
− | <p style="margin-left:20pt;">Using this will return a list of all the playlists a file is in, separated by semi-colons.</span> | + | <p style="margin-left:20pt;">Using this will return a list of all the playlists a file is in, separated by semi-colons.</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> | ||
+ | <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 |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | {{function description box | |
− | { | + | | name=Literal |
− | | | + | | arguments=String |
− | | | + | | description= |
− | + | [[#Literal|Literal()]] returns a given string as-is without any formatting or processing | |
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | | examples= | |
+ | '''{{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. :-/))}}''' | ||
+ | : 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. | ||
+ | : 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... | ||
− | + | '''{{monospace|/*Left(Theater,3) returns/* Left(Theater,3)}}''' | |
− | + | : 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> === | |
+ | : Repeats a given string a specified number of times | ||
− | + | {{function description box | |
− | + | | 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>}}''' |
+ | : Returns HaHaHaHaHa | ||
+ | }} | ||
− | + | === <span id="Row">Row(…)</span> === | |
− | + | : Returns the row number of a list entry | |
− | |||
− | |||
− | |||
− | < | + | {{function description box |
+ | | name=Row | ||
+ | | arguments= | ||
+ | | description= | ||
+ | Row() returns the row number for each item in a list. | ||
+ | | 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. | ||
− | + | }} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== <span id="Size">Size(…)</span> === | === <span id="Size">Size(…)</span> === | ||
Line 346: | 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 |
+ | |||
+ | {{function description box | ||
+ | | name=Translate | ||
+ | | arguments=String | ||
+ | | description= | ||
+ | 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= | ||
+ | '''{{monospace|<nowiki>Translate(Keywords)</nowiki>}}''' | ||
+ | : If using the French language setting, this will return Mots-clés | ||
+ | }} | ||
− | + | === <span id="TreeNode">TreeNode(…)</span> === | |
− | + | : Returns the selected tree path. | |
− | + | ||
− | + | {{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 00: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.
Contents
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. |