Test and Comparison Functions: Difference between revisions
Line 166: | Line 166: | ||
{{function description box |
{{function description box |
||
| name= |
| name=IsInPlayingNow |
||
| arguments= |
| arguments=filepath |
||
| description= |
| description= |
||
⚫ | |||
DESCRIPTION |
|||
{{argument optional|filepath|the current [filename]}} |
|||
| examples= |
| examples= |
||
'''{{monospace| |
'''{{monospace|IsInPlayingNow()}}''' |
||
⚫ | |||
: EXAMPLETEXT |
|||
'''{{monospace| |
'''{{monospace|<nowiki>if(isinplayingnow(), Queued, Not queued)</nowiki>}}''' |
||
⚫ | |||
: EXAMPLETEXT |
|||
'''{{monospace|EXAMPLE3}}''' |
|||
: EXAMPLETEXT |
|||
'''{{monospace|EXAMPLE4}}''' |
|||
: EXAMPLETEXT |
|||
}} |
}} |
||
<pre> |
|||
To insert a table of arguments in the DESCRIPTION, use: |
|||
{{subst:argument table preset}} |
|||
</pre> |
|||
{| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0" |
|||
|- id="IsInPlayingNow" 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>isinplayingnow(</b><i>filepath</i><b>)</b></span> |
|||
The [[#IsInPlayingNow|IsInPlayingNow()]] function tests if a file is in any zone's Playing Now list. |
|||
⚫ | |||
Argument <i>filepath</i> is optional (defaults to [filename]). |
|||
|- 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;" | {{monospace|<b><nowiki>isinplayingnow()</nowiki></b>}} |
|||
⚫ | |||
{{monospace|<b><nowiki>if(isinplayingnow(), Queued, Not queued)</nowiki></b>}} |
|||
⚫ | |||
Additional Examples |
|||
:[http://yabb.jriver.com/interact/index.php?topic=57461.0 How to use IsPlaying() and IsInPlayingNow()] |
|||
|} |
|||
<div style="text-align:right;">([[#top|Back to top)]]</div> |
|||
=== <span id="IsPlaying">IsPlaying(…)</span> === |
=== <span id="IsPlaying">IsPlaying(…)</span> === |
Revision as of 21:34, 25 January 2016
- See also: Expression Language and Function Index
The functions in this section return a Boolean value of either 1 (true) or 0 (false). They are generally used to drive an action specified in one of the Conditional Functions.
Compare(…)
- Compares two numbers.
Description | Compare(value1, operator, value2)
The Compare() function compares two numeric values value1 and value2 using the specified operator. Available operator values:
Outputs 1 if the comparison is true, and 0 otherwise. | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Examples | compare([bitrate], <, 320)
if(compare(math(now() - [date modified, 0]), >, 21), Expired, formatdate([date modified, 0], elapsed))
|
IsEqual(…)
- Compares two values in one of nine specified modes.
Description | IsEqual(value1, value2, mode)
The IsEqual() function compares value1 with value2 using any mode from the list of modes below. Outputs 1 when the comparison succeeds according to the mode, and 0 otherwise. Although the mode is specified as the last argument, the comparison should be mentally read as: value1 mode value2. Available mode values:
| ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Examples | isequal([artist], [album], 1)
if(isequal([artist], [album], 1), Eponymous, [album])
if(isequal([artist], [album], 1), Eponymous/,, [album]/))
if(isequal([filename (path)], classical, 8), Classical, Not Classical)
|
IsEmpty(…)
- Tests a value for emptiness.
Description | IsEmpty(value, mode)
The IsEmpty() function tests the given value for emptiness. The value passed is typically an Media Center field, so that some action may be taken when the field is or is not empty. Returns 1 when the value is empty, otherwise 0. Available mode values:
Note that Media Center does not discriminate between a 0 value and an empty value for fields of type Integer and Decimal - both 0 and empty are considered equivalent for these field types. This is useful for fields such as the integer field Disc #, where an empty or 0 value implies that Disc # contains no useful data, and should be generally ignored or absent in display output. Pay particular attention to the third example offered below, as it covers a caveat that comes with this particular function. | ||||
---|---|---|---|---|---|
Examples | isempty([comment], 0)
isempty([track #], 1)
ifelse(!isempty([disc #]), [disc #])
|
IsRange(…)
- Tests a value for inclusion within a given range.
Description | IsRange(value, range)
The IsRange() function tests if a value falls within a given range of values. If the value falls within the given range, 1 is returned, otherwise 0 is returned. A range is specified in the form of low-high, where low and high are either letters or numbers. The lowest value comes first, the highest second. Both low and high must be the same kind (letters or numbers). The low and high values are inclusive. Some Example Ranges: 1-100
a-z
c-d
23-7542
|
---|---|
Examples | isrange([artist], a-c)
if(isrange([bitrate], 96-191), Poor Quality, High Quality)
Additional Examples |
IsMissing(…)
- Tests to see if a file exists on the system.
Description | IsMissing(filepath)
The IsMissing() function tests for the existence of a file in the file system. If the file is missing, the function returns 1, otherwise 0 is returned if the file exists. This function is useful for checking for missing files in a Library. IsMissing() treats special entries such as ripped Blu-ray or DVDs as single files, even though they physically exist in the file system as several files and directories. Note: Any view or list that uses IsMissing() will be slow, is Media Center must interrogate each referenced file in the file system. The larger the number of files being queried, the longer it will take to produce results. Use IsMissing() with care.
|
---|---|
Examples | ismissing()
ismissing(C:\Music\My Lost File.mp3)
if(ismissing(), File is missing, File exists)
[=ismissing([filename])]=1
|
IsRemovable(…)
- Tests to see if a file is stored on removable media.
Description | IsRemovable(filepath)
The IsRemovable() function tests if a file resides on removable media and if so, returns 1, and if not, returns 0. The Media Center field [Removable] also provides the same value for a given file.
|
---|---|
Examples | IsRemovable()
|
IsInPlayingNow(…)
- Tests to see if a file is in the Playing Now playlist.
Description | IsInPlayingNow(filepath)
The IsInPlayingNow() function tests if a file is in any zone's Playing Now list. Used as an expression category, pane or file list column allows distinguishing files that are in the Playing Now list.
|
---|---|
Examples | IsInPlayingNow()
if(isinplayingnow(), Queued, Not queued)
|
IsPlaying(…)
- Tests to see if a file is in currently being played.
Description | isplaying(filepath)
The IsPlaying() function tests if a file is playing in any zone. Used as an expression category, pane or file list column allows distinguishing files that are playing now. Argument filepath is optional (defaults to [filename]). |
---|---|
Examples | ifelse(isplaying(), <font color="ff0000">♪<//font>, isinplayingnow(), ♪)
This expression in a file list expression column shows which files are in the Playing Now list and which are currently playing by outputting a musical note in the column. The musical note will be displayed in red for any currently playing file. Additional Examples |