INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: List Of Expression Functions... Spot any missing?  (Read 6623 times)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
List Of Expression Functions... Spot any missing?
« on: August 12, 2010, 03:08:41 pm »

These ones below are a direct copy/paste from the wiki page I created, which is long overdue some TLC:

    * 2.1 Field(...): Outputs the value for a given field.
    * 2.2 If(...): Outputs different values depending on the value of the first parameter.
    * 2.3 IsMissing(...): Checks to see if a file exists on the system.
    * 2.4 IsRemovable(...): Checks to see if a file resides on removable media.
    * 2.5 IsEqual(...): Compares values and outputs a "1" if the values pass the test, and "0" if they don't pass the test.
    * 2.6 IsEmpty(...): Tests to see if a value is empty and outputs a "1" if the value is empty, and "0" if it's not empty.
    * 2.7 IsRange(...): Compares a value against a range and outputs a "1" if the values is inside the range, and "0" if not.
    * 2.8 FilePath(...): Returns the path from a filename.
    * 2.9 FileName(...): Returns the name from a filename.
    * 2.10 FileVolume(...): Returns the volume name from a filename.
    * 2.11 FormatNumber(...): Formats a number in a specified manner.
    * 2.12 FormatDate(...): Formats a date value in a specified manner.
    * 2.13 FormatBoolean(...): Formats a boolean (true / false) value in a specified manner.
    * 2.14 FormatDuration(...): Formats a duration in seconds to a readable string.
    * 2.15 FormatFileSize(...): Formats a number of bytes as a readable string.
    * 2.16 FormatRange(...): Formats a value as a range.
    * 2.17 AlbumArtist(...): Returns the calculated album artist for a file.
    * 2.18 AlbumType(...): Returns the album type for a file.
    * 2.19 Size(...): Returns the size of a file in a media-type independent manner.
    * 2.20 CustomData(...): Returns custom data stored in a file array. (used primarily for internal uses)
    * 2.21 Clean(...): Returns a cleaned up version of a filled in template.
    * 2.22 FixCase(...): Changes the case of a string.
    * 2.23 Mid(...): Retrieves specified characters from a value.
    * 2.24 PadNumber(...): Use to add leading zeros to a number.
    * 2.25 RemoveLeft(...) and RemoveRight(...): Use to trim characters from the start or end of a field
    * 2.26 Counter(...): Use to return a value that starts at one and counts up with each use
    * 2.27 Now(...): Use to return the current date
    * 2.28 ListItem(...): Use to return a value from a delimited list
    * 2.29 ListCount(...): Use to return the number of items in a delimited list
    * 2.30 Replace(...): Use to find string items and replace or remove them
    * 2.31 ListCombine(...): Use to merge one list type field into another
    * 2.32 Tag(...): Reads in the physical file tag rather than looking in the database

As far as I can tell, these are the functions that are missing:

IsPlaying()
IsInPlayingNow()
math()
Length(...)
Left(...)
Right(...)
FormatDate(...) expression function accepts a new format "DateTime" that formats using the system format and includes the time.
FormatDate(...) type "minute" and "hour" for getting the time from a date.
"CustomData(#)" expression in the Rename, Move, & Copy Files dialog for outputting the list index.
Improved FileVolume(...) expression support for (Install Drive):\ style filenames used in portable installs.
The MP3 plugin will respond to 'Gapless Header' and 'Gapless Footer' in Tag(...) expression requests to allow querying for gapless information. (remember that Tag(...) expressions query physical file tags and are 1000s of times slower than database access)
ListBuild(...) expression function for building a delimited list of values, possibly suppressing empty values.

=========

Have I missed any, and can anyone give me a working example for CustomData(#) as I'm not sure what it's supposed to do at all!!

Also,

Back when the playingnow() expressions were added, I remember they caused a fair bit of excitement... why was that, as I appear to be missing their value so far?

Regards,
-marko

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42442
  • Shoes gone again!
Re: List Of Expression Functions... Spot any missing?
« Reply #1 on: August 12, 2010, 03:14:19 pm »

Marko,

Here's the list straight from the code:

Code: [Select]
SetAt(_T("Field"), new CExpressionFunction(EF_FIELD));
SetAt(_T("If"), new CExpressionFunction(EF_IF));
SetAt(_T("FilePath"), new CExpressionFunction(EF_FILE_PATH));
SetAt(_T("FileName"), new CExpressionFunction(EF_FILE_NAME));
SetAt(_T("FileVolume"), new CExpressionFunction(EF_FILE_VOLUME));
SetAt(_T("IsMissing"), new CExpressionFunction(EF_IS_MISSING));
SetAt(_T("IsRemovable"), new CExpressionFunction(EF_IS_REMOVABLE));
SetAt(_T("IsEqual"), new CExpressionFunction(EF_IS_EQUAL));
SetAt(_T("IsEmpty"), new CExpressionFunction(EF_IS_EMPTY));
SetAt(_T("IsRange"), new CExpressionFunction(EF_IS_RANGE));
SetAt(_T("AlbumKey"), new CExpressionFunction(EF_ALBUM_KEY));
SetAt(_T("AlbumArtist"), new CExpressionFunction(EF_ALBUM_ARTIST));
SetAt(_T("AlbumType"), new CExpressionFunction(EF_ALBUM_TYPE));
SetAt(_T("Size"), new CExpressionFunction(EF_SIZE));
SetAt(_T("CustomData"), new CExpressionFunction(EF_CUSTOM_DATA));
SetAt(_T("TrackNumber"), new CExpressionFunction(EF_TRACK_NUMBER));
SetAt(_T("Tag"), new CExpressionFunction(EF_TAG));
SetAt(_T("TVInfo"), new CExpressionFunction(EF_TV_INFO));
SetAt(_T("ListItem"), new CExpressionFunction(EF_LIST_ITEM));
SetAt(_T("ListCount"), new CExpressionFunction(EF_LIST_COUNT));
SetAt(_T("ListCombine"), new CExpressionFunction(EF_LIST_COMBINE));
SetAt(_T("ListBuild"), new CExpressionFunction(EF_LIST_BUILD));
SetAt(_T("FormatNumber"), new CExpressionFunction(EF_FORMAT_NUMBER));
SetAt(_T("FormatDate"), new CExpressionFunction(EF_FORMAT_DATE));
SetAt(_T("FormatBoolean"), new CExpressionFunction(EF_FORMAT_BOOLEAN));
SetAt(_T("FormatDuration"), new CExpressionFunction(EF_FORMAT_DURATION));
SetAt(_T("FormatFileSize"), new CExpressionFunction(EF_FORMAT_FILESIZE));
SetAt(_T("FormatRange"), new CExpressionFunction(EF_FORMAT_RANGE));
SetAt(_T("PadNumber"), new CExpressionFunction(EF_PAD_NUMBER));
SetAt(_T("Clean"), new CExpressionFunction(EF_CLEAN));
SetAt(_T("FixCase"), new CExpressionFunction(EF_FIX_CASE));
SetAt(_T("Length"), new CExpressionFunction(EF_LENGTH));
SetAt(_T("Left"), new CExpressionFunction(EF_LEFT));
SetAt(_T("Right"), new CExpressionFunction(EF_RIGHT));
SetAt(_T("Mid"), new CExpressionFunction(EF_MID));
SetAt(_T("RemoveLeft"), new CExpressionFunction(EF_REMOVE_LEFT));
SetAt(_T("RemoveRight"), new CExpressionFunction(EF_REMOVE_RIGHT));
SetAt(_T("Counter"), new CExpressionFunction(EF_COUNTER));
SetAt(_T("Now"), new CExpressionFunction(EF_NOW));
SetAt(_T("Replace"), new CExpressionFunction(EF_REPLACE));
SetAt(_T("Hexify"), new CExpressionFunction(EF_HEXIFY));
SetAt(_T("Math"), new CExpressionFunction(EF_MATH));
SetAt(_T("Note"), new CExpressionFunction(EF_NOTE));
SetAt(_T("IsPlaying"), new CExpressionFunction(EF_IS_PLAYING));
SetAt(_T("IsInPlayingNow"), new CExpressionFunction(EF_IS_IN_PLAYING_NOW));

Thanks for thinking about this.

If bribes work, if you update the Wiki, we'll add a new expression function of your choosing.

Thanks again.
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42442
  • Shoes gone again!
Re: List Of Expression Functions... Spot any missing?
« Reply #2 on: August 12, 2010, 03:15:45 pm »

And here's the built-in documentation for the functions:

Code: [Select]
// switch based on function
switch (Function)
{
case EF_FIELD:
{
strDescription = _I("Outputs the value of a library field.");
aryParameters.Add(_I("Field name: the name of the field to evaluate (i.e. Artist, Album, Name, etc.)"));
aryParameters.Add(_I("Format for display: 0 to use raw data, 1 to use data formatted for display (optional: defaults to 1) "));
aryExamples.Add(_T("Field(Artist)"));
aryExamples.Add(_T("Field(Artist, 0)"));
break;
}
case EF_IF:
{
strDescription = _I("Outputs different values depending on the value of the first parameter.");
aryParameters.Add(_I("Test Expression: the value that gets tested"));
aryParameters.Add(_I("True: the value used if the test expression does not equal 0"));
aryParameters.Add(_I("False: the value used if the test expression equals 0"));
aryExamples.Add(_T("If(1, 1, 0)"));
aryExamples.Add(_T("If(IsMissing(), The file is missing., The file is here.)"));
break;
}
case EF_FILE_PATH:
{
strDescription = _I("Returns the path from a filename.");
aryParameters.Add(_I("Filename: the filename to check (optional: defaults to this file)"));
aryExamples.Add(_T("FilePath()"));
aryExamples.Add(_T("FilePath([Filename])"));
break;
}
case EF_FILE_NAME:
{
strDescription = _I("Returns the name from a filename.");
aryParameters.Add(_I("Filename: the filename to check (optional: defaults to this file)"));
aryExamples.Add(_T("FileName()"));
aryExamples.Add(_T("FileName([Filename])"));
break;
}
case EF_FILE_VOLUME:
{
strDescription = _I("Returns the volume name from a filename.");
aryParameters.Add(_I("Filename: the filename to check (optional: defaults to this file)"));
aryExamples.Add(_T("FileVolume()"));
aryExamples.Add(_T("FileVolume([Filename])"));
break;
}
case EF_IS_MISSING:
{
strDescription = _I("Checks to see if a file exists on the system.");
aryParameters.Add(_I("Filename: the filename to check (optional: defaults to this file)"));
aryExamples.Add(_T("IsMissing()"));
aryExamples.Add(_T("IsMissing([Filename])"));
break;
}
case EF_IS_REMOVABLE:
{
strDescription = _I("Checks to see if a file resides on removable media.");
aryParameters.Add(_I("Filename: the filename to check (optional: defaults to this file)"));
aryExamples.Add(_T("IsRemovable()"));
aryExamples.Add(_T("IsRemovable([Filename])"));
break;
}
case EF_IS_EQUAL:
{
strDescription = _I("Compares values and outputs a \"1\" if the values pass the test, and \"0\" if they don't pass the test.");
aryParameters.Add(_I("Value 1: the first value"));
aryParameters.Add(_I("Value 2: the second value"));
JRString strCompareType = _I("Compare type: the mode to compare (optional: defaults to case-sensitive string compare)");
strCompareType += _I("\r\n\t0: case-sensitive string compare for equality");
strCompareType += _I("\r\n\t1: case-insensitive string compare for equality");
strCompareType += _I("\r\n\t2: numeric compare for equality");
strCompareType += _I("\r\n\t3: numeric less than");
strCompareType += _I("\r\n\t4: numeric less than or equal to");
strCompareType += _I("\r\n\t5: numeric greater than");
strCompareType += _I("\r\n\t6: numeric greater than or equal to");
strCompareType += _I("\r\n\t7: substring search (case sensitive)");
strCompareType += _I("\r\n\t8: substring search (case insensitive)");
aryParameters.Add(strCompareType);
aryExamples.Add(_T("IsEqual([Artist], [Album], 1)"));
aryExamples.Add(_T("IsEqual([Duration, 0], [Bitrate, 0], 2)"));
break;
}
case EF_IS_EMPTY:
{
strDescription = _I("Tests to see if a value is empty and outputs a \"1\" if the value is empty, and \"0\" if it's not empty.");
aryParameters.Add(_I("Value: the value to test"));
aryParameters.Add(_I("Mode: the testing mode (options: defaults to 0)"));
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t0: string style, so \"\" is empty");
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t1: number style, so \"\" or 0 is empty");
aryExamples.Add(_T("IsEmpty([Artist])"));
aryExamples.Add(_T("IsEmpty([Duration, 0], 1)"));
break;
}
case EF_IS_RANGE:
{
strDescription = _I("Compares a value against a range and outputs a \"1\" if the values is inside the range, and \"0\" if not.");
aryParameters.Add(_I("Value: the value to test"));
aryParameters.Add(_I("Range: the range of values (in the form: a-z or 1-100)"));
aryExamples.Add(_T("IsRange([Artist], a-b)"));
aryExamples.Add(_T("IsRange([Bitrate, 0], 128-192)"));
break;
}
case EF_ALBUM_KEY:
{
strDescription = _I("Returns a unique album key for the file.");
aryExamples.Add(_T("AlbumKey()"));
break;
}
case EF_ALBUM_ARTIST:
{
strDescription = _I("Returns the calculated album artist for a file.");
aryExamples.Add(_T("AlbumArtist()"));
break;
}
case EF_ALBUM_TYPE:
{
strDescription = _I("Returns the album type for a file.");
aryExamples.Add(_T("AlbumType()"));
break;
}
case EF_SIZE:
{
strDescription = _I("Returns the size of a file in a media type independent manner.");
aryExamples.Add(_T("Size()"));
break;
}
case EF_CUSTOM_DATA:
{
strDescription = _I("Returns custom data stored in a file array (used primarily for internal uses).");
aryParameters.Add(_I("Field: custom field name (# gets array sequence number)"));
aryExamples.Add(_T("CustomData(#)"));
aryExamples.Add(_T("CustomData(My Special Field)"));
break;
}
case EF_TRACK_NUMBER:
{
rbInternalOnly = TRUE;
break;
}
case EF_TAG:
{
strDescription = _I("Returns a physical file tag (rather than looking in the database).");
aryParameters.Add(_I("Field: field to read from the tag (case is important)"));
aryExamples.Add(_T("Tag(Artist)"));
aryExamples.Add(_T("For JPEG, you can prefix the tag with XMP, ITPC, MJMD, EXIF like Tag(XMP: Keywords)"));
break;
}
case EF_TV_INFO:
{
strDescription = _I("Returns television-specific information about a file.");
JRString strField = _I("Field: field to load");
strField += _I("\r\n\tIsProgram: whether the file is a program (0 or 1)");
strField += _I("\r\n\tIsGuideProgram: whether the file is a guide program (0 or 1)");
strField += _I("\r\n\tIsRecordedProgram: whether the file is a recorded program (0 or 1)");
strField += _I("\r\n\tNameDisplay: name display");
strField += _I("\r\n\tNameDisplayWithDate: name display with date");
strField += _I("\r\n\tSeriesDisplay: series display");
strField += _I("\r\n\tTimeDisplay: time display");
strField += _I("\r\n\tTimeDisplayNoOnNow: time display without special handling for programs on now");
strField += _I("\r\n\tSizeDisplay: size display, formatted nicely for a television program");
strField += _I("\r\n\tWatchedDisplay: watched information, like no, yes, 80%, etc.");
aryParameters.Add(strField);
aryExamples.Add(_T("TVInfo(TimeDisplay)"));
break;
}
case EF_LIST_ITEM:
{
strDescription = _I("Returns a value from a delimited list.");
aryParameters.Add(_I("List: the delimited list"));
aryParameters.Add(_I("Index: the item to retrieve (starts at 0)"));
aryParameters.Add(_I("Delimiter: the list delimiter (options: defaults to semi-colon)"));
aryExamples.Add(_T("ListItem([People], 0)"));
aryExamples.Add(_T("ListItem([Filename (path)], 2, \\)"));
break;
}
case EF_LIST_COUNT:
{
strDescription = _I("Returns the number of items in a delimited list.");
aryParameters.Add(_I("List: the delimited list"));
aryParameters.Add(_I("Delimiter: the list delimiter (options: defaults to semi-colon)"));
aryExamples.Add(_T("ListCount([People])"));
aryExamples.Add(_T("ListCount([Filename (path)], \\)"));
break;
}
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42442
  • Shoes gone again!
Re: List Of Expression Functions... Spot any missing?
« Reply #3 on: August 12, 2010, 03:16:02 pm »

Continued:
Code: [Select]
case EF_LIST_COMBINE:
{
strDescription = _I("Combines two delimited lists into a single delimited list.");
aryParameters.Add(_I("List 1: the first delimited list"));
aryParameters.Add(_I("List 2: the second delimited list"));
aryParameters.Add(_I("Delimiter: the list delimiter (options: defaults to semi-colon)"));
aryExamples.Add(_T("ListCombine([Keywords], [People])"));
break;
}
case EF_LIST_BUILD:
{
strDescription = _I("Build a list from a series of values, possibly suppressing empty items.");
JRString strMode = _I("Mode: the mode to use when building the list");
strMode += _I("\r\n\t0: combine all values");
strMode += _I("\r\n\t1: combine non-empty values");
aryParameters.Add(strMode);
aryParameters.Add(_I("Delimiter: the delimiter to be used in the list"));
aryParameters.Add(_I("List: the list of items (any number)"));
aryExamples.Add(_T("ListBuild(1, / • , a, , b, , c)"));
break;
}
case EF_FORMAT_NUMBER:
{
strDescription = _I("Formats a number in a specified manner.");
aryParameters.Add(_I("Value: the number to format"));
aryParameters.Add(_I("Number of decimal places: specifies how many decimals to use (-1 uses as many as necessary) (optional: defaults to 0)"));
aryParameters.Add(_I("Empty display: value to display for an empty number (optional: defaults to nothing)"));
aryParameters.Add(_I("Label (singular): label to apply to the number if equal to one"));
aryParameters.Add(_I("Label (plural): label to apply to the number if not equal to one"));
aryExamples.Add(_T("FormatNumber(3.123224, 0)"));
aryExamples.Add(_T("FormatNumber([Replay Gain, 0], 3)"));
aryExamples.Add(_T("FormatNumber([Number Plays, 0], 0, never played, play, plays)"));
break;
}
case EF_FORMAT_DATE:
{
strDescription = _I("Formats a date in a specified manner.");
aryParameters.Add(_I("Value: the date to format"));
JRString strFormattingStyle;
strFormattingStyle = _I("Formatting: the formatting style");
strFormattingStyle += _I("\r\n\tYear: 1997");
strFormattingStyle += _I("\r\n\tMonth: March");
strFormattingStyle += _I("\r\n\tDay: 12");
strFormattingStyle += _I("\r\n\tHour: 16");
strFormattingStyle += _I("\r\n\tMinute: 32");
strFormattingStyle += _I("\r\n\tFilename: 20040521-032221");
strFormattingStyle += _I("\r\n\tElapsed: 3.2 days ago");
strFormattingStyle += _I("\r\n\tDate: format using system standard");
strFormattingStyle += _I("\r\n\tDateTime: format using system standard, including time");
strFormattingStyle += _I("\r\n\tOther: flexible formatting (i.e. yy-MMMM-dd)");
aryParameters.Add(strFormattingStyle);
aryParameters.Add(_I("No date output: the output when the date is emtpy (optional: defaults to nothing)"));
aryExamples.Add(_T("FormatDate([Date Imported, 0], elapsed)"));
aryExamples.Add(_T("FormatDate([Date, 0], MMMM: d, no date)"));
break;
}
case EF_FORMAT_BOOLEAN:
{
strDescription = _I("Formats a boolean (true / false) value in a specified manner.");
aryParameters.Add(_I("Value: the boolean to format"));
aryParameters.Add(_I("True display: string to display for true (optional: defaults to \"True\")"));
aryParameters.Add(_I("False display: string to display for false (optional: defaults to \"False\")"));
aryExamples.Add(_T("FormatBoolean(1)"));
aryExamples.Add(_T("FormatBoolean(IsMissing(), File missing, File exists)"));
break;
}
case EF_FORMAT_DURATION:
{
strDescription = _I("Formats a duration in seconds to a readable string.");
aryParameters.Add(_I("Value: the value in seconds to format"));
aryExamples.Add(_T("FormatDuration(60)"));
aryExamples.Add(_T("FormatDuration([Duration, 0])"));
break;
}
case EF_FORMAT_FILESIZE:
{
strDescription = _I("Formats a number of bytes as a readable string.");
aryParameters.Add(_I("Value: the value in bytes to format"));
aryExamples.Add(_T("FormatFileSize(1024)"));
aryExamples.Add(_T("FormatFileSize([File Size, 0])"));
break;
}
case EF_FORMAT_RANGE:
{
strDescription = _I("Formats a value as a range.");
aryParameters.Add(_I("Value: the value to format"));
aryParameters.Add(_I("Range size: the number of letters / numbers to put in a grouping (optional: defaults to 1)"));
aryParameters.Add(_I("Mode: the mode to perform the grouping (optional: defaults to 0)"));
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t0: automatically choose between number / letter grouping");
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t1: use letter grouping");
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t2: use number grouping");
aryExamples.Add(_T("FormatRange(Abba, 3)"));
aryExamples.Add(_T("FormatRange([Artist])"));
aryExamples.Add(_T("FormatRange(([Bitrate, 0], 100, 2)"));
break;
}
case EF_PAD_NUMBER:
{
strDescription = _I("Adds leading zeros to a number.");
aryParameters.Add(_I("Value: the value to pad"));
aryParameters.Add(_I("Number of digits: the number of digits in the number"));
aryExamples.Add(_T("PadNumber([Track #], 3)"));
break;
}
case EF_CLEAN:
{
strDescription = _I("Returns a cleaned up version of a filled in template.");
aryParameters.Add(_I("Value: the value to clean"));
aryExamples.Add(_T("Clean(Abba - - Gold)"));
aryExamples.Add(_T("Clean([Artist] - [Album] /([Genre]/))"));
break;
}
case EF_FIX_CASE:
{
strDescription = _I("Changes the case of a string.");
aryParameters.Add(_I("Value: the value to change"));
aryParameters.Add(_I("Mode: case mode (optional: defaults to title case)"));
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t0: title case");
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t1: all words");
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t2: first word");
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t3: all uppercase");
aryParameters[aryParameters.GetUpperBound()] += _I("\r\n\t4: all lowercase");
aryExamples.Add(_T("FixCase(MaKe ME PreTTy)"));
aryExamples.Add(_T("FixCase([File Type], 3)"));
break;
}
case EF_LENGTH:
{
strDescription = _I("Returns the number of characters in a value.");
aryParameters.Add(_I("Value: the value to get number of characters from"));
aryExamples.Add(_T("Length(Abba)"));
aryExamples.Add(_T("Length([Artist])"));
break;
}
case EF_LEFT:
{
strDescription = _I("Retrieves specified number of characters from the left of a value.");
aryParameters.Add(_I("Value: the value to get characters from"));
aryParameters.Add(_I("Characters: the number of characters to get"));
aryExamples.Add(_T("Left(Abba, 2)"));
aryExamples.Add(_T("Left([Artist], 3)"));
break;
}
case EF_RIGHT:
{
strDescription = _I("Retrieves specified number of characters from the right of a value.");
aryParameters.Add(_I("Value: the value to get characters from"));
aryParameters.Add(_I("Characters: the number of characters to get"));
aryExamples.Add(_T("Right(Abba, 2)"));
aryExamples.Add(_T("Right([Artist], 3)"));
break;
}
case EF_MID:
{
strDescription = _I("Retrieves specified characters from a value.");
aryParameters.Add(_I("Value: the value to get characters from"));
aryParameters.Add(_I("Start: the character to start at (optional: defaults to 0)"));
aryParameters.Add(_I("Characters: the number of characters to get (-1 returns all) (optional: defaults to 1)"));
aryExamples.Add(_T("Mid(Abba, 1)"));
aryExamples.Add(_T("Mid(Abba, 0, 1)"));
aryExamples.Add(_T("Mid([Artist], 3, -1)"));
break;
}
case EF_REMOVE_LEFT:
{
strDescription = _I("Trims characters from the start of a value.");
aryParameters.Add(_I("Value: the value to trim"));
aryParameters.Add(_I("Characters: how many characters to trim (spaces count as characters)"));
aryExamples.Add(_T("RemoveLeft(01. Abba, 4)"));
aryExamples.Add(_T("RemoveLeft([Artist], 1)"));
break;
}
case EF_REMOVE_RIGHT:
{
strDescription = _I("Trims characters from the end of a value.");
aryParameters.Add(_I("Value: the value to trim"));
aryParameters.Add(_I("Characters: how many characters to trim (spaces count as characters)"));
aryExamples.Add(_T("RemoveRight(Abba junkatend, 10)"));
aryExamples.Add(_T("RemoveRight([Artist], 1)"));
break;
}
case EF_COUNTER:
{
strDescription = _I("Return a value that starts at one and counts up with each use.");
aryParameters.Add(_I("Start: number to start counting from (optional: defaults to 1)"));
aryParameters.Add(_I("Increment: number to increment by each iteration (optional: defaults to 1)"));
aryExamples.Add(_T("Counter()"));
break;
}
case EF_NOW:
{
strDescription = _I("Returns the current date.");
aryExamples.Add(_T("FormatDate(Now(), Year)"));
break;
}
case EF_REPLACE:
{
strDescription = _I("Replace or remove strings from a value.");
aryParameters.Add(_I("Value: the value to search in"));
aryParameters.Add(_I("Find: the value to search for"));
aryParameters.Add(_I("Replace: the value to replace with (optional: defaults to empty / remove)"));
aryExamples.Add(_T("Replace(Abxxxba, x)"));
aryExamples.Add(_T("Replace([Artist], Featuring, ft.)"));
break;
}
case EF_HEXIFY:
{
strDescription = _I("Hexifies a string to make it suitable for website usage.");
aryParameters.Add(_I("Value: the value hexify"));
aryExamples.Add(_T("Hexify([Artist])"));
break;
}
case EF_MATH:
{
strDescription = _I("Evaluates a mathematical formula.");
aryParameters.Add(_I("Formula: the formula to evaluate"));
aryExamples.Add(_T("Math(3 + 4)"));
aryExamples.Add(_T("Math((3 + 4) / 2)"));
aryExamples.Add(_T("Math((Length([Artist]) + Length([Album]) / 2)"));
aryExamples.Add(_T("Left([Artist], Math(Length([Artist]) - 1))"));
break;
}
case EF_NOTE:
{
strDescription = _I("Gets information from a note.");
aryParameters.Add(_I("Field: the field name"));
aryParameters.Add(_I("Type: the field type (optional: defaults to any type)"));
aryParameters.Add(_I("Occurrence: the occurence (optional: defaults to 0)"));
aryExamples.Add(_T("Note(Phone)"));
aryExamples.Add(_T("Note(Phone, Work)"));
aryExamples.Add(_T("Note(Phone, Work, 1)"));
break;
}
case EF_IS_PLAYING:
{
strDescription = _I("Determines if a file is currently playing in any zone.");
aryExamples.Add(_T("IsPlaying()"));
break;
}
case EF_IS_IN_PLAYING_NOW:
{
strDescription = _I("Determines if a file is in Playing Now in any zone.");
aryExamples.Add(_T("IsInPlayingNow()"));
break;
}

default:
// there should be a handler for every function
ASSERT(FALSE);
bRetVal = FALSE;
}
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42442
  • Shoes gone again!
Re: List Of Expression Functions... Spot any missing?
« Reply #4 on: August 12, 2010, 03:18:15 pm »

Back when the playingnow() expressions were added, I remember they caused a fair bit of excitement... why was that, as I appear to be missing their value so far?

I think there were some users (DJs maybe) that wanted an easy way to see what was already queued up.  The functions allow you to add a column to any view showing what files are already in Playing Now.
Logged
Matt Ashland, JRiver Media Center

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: List Of Expression Functions... Spot any missing?
« Reply #5 on: August 12, 2010, 03:49:10 pm »

I'll do the update of the Wiki if you add 1-based counting for grouping (or better, arbitrarily any starting number/letter, and increment).  See:

http://yabb.jriver.com/interact/index.php?topic=38566.msg262262#msg262262

I have a nice view I'd like to make, but it is impractical without this.
Logged
The opinions I express represent my own folly.

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: List Of Expression Functions... Spot any missing?
« Reply #6 on: August 12, 2010, 03:55:32 pm »

Back when the playingnow() expressions were added, I remember they caused a fair bit of excitement... why was that, as I appear to be missing their value so far?

It's rather boring by itself, but very cool things can be done using it in expressions. I use it in Theatre View to create views for the Artist, Album and tracks Similar to what is playing now. Great fun when used in conjunction with Radio play.
Logged

datdude

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2228
Re: List Of Expression Functions... Spot any missing?
« Reply #7 on: August 12, 2010, 08:37:24 pm »

It's rather boring by itself, but very cool things can be done using it in expressions. I use it in Theatre View to create views for the Artist, Album and tracks Similar to what is playing now. Great fun when used in conjunction with Radio play.


Would you mind explaning how to set that up?  ;)
Logged
"You are not a beautiful or unique snowflake." -  Just a very big snowball

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: List Of Expression Functions... Spot any missing?
« Reply #8 on: August 12, 2010, 10:59:07 pm »

Quote
Would you mind explaning how to set that up?

I got the idea from mark_h here, and posted my view expressions here.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: List Of Expression Functions... Spot any missing?
« Reply #9 on: August 16, 2010, 02:40:14 am »

Matt, thanks for the info. I see there's a whole heap of TV stuff there I'd completely missed!!

The re-write is now under way and could take anything between two to four weeks to complete.
I've had another look at that customdata(#) function and couldn't get anything meaningful out of it. I take it this is something more for MC's own internal use?

Also, I'm a little non-plussed about the Clean() function. What's it supposed to do? I messed up a few fields here, making them all lower case, sticking some capitals in the middle, etc. and then passed them through Clean() and they came out the same way they went in!! Anyone?

I got the idea from mark_h here, and posted my view expressions here.
Clever stuff. I'll reference those posts from the wiki page if that's OK with you guys?

Regards,
marko.

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4583
Re: List Of Expression Functions... Spot any missing?
« Reply #10 on: August 16, 2010, 03:11:39 am »

Also, I'm a little non-plussed about the Clean() function. What's it supposed to do? I messed up a few fields here, making them all lower case, sticking some capitals in the middle, etc. and then passed them through Clean() and they came out the same way they went in!! Anyone?

clean takes away spaces in front and at the end of fields, maybe there is more. i misuse it in views with panes where i dont want any taging in the panes.

 :)
gab

btw.. thanks a lot you are working on that. 8)
Logged

zxsix

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1753
Re: List Of Expression Functions... Spot any missing?
« Reply #11 on: August 17, 2010, 11:49:15 am »

2.30 Replace(...): Use to find string items and replace or remove them  could use some more detailed info.
I know I can do  Replace([Album],')   to remove apostrophes. 
But what's the syntax to substitute a space instead of the apostrophe?
Also, what's the syntax if I want to remove apostrophes AND colons AND semicolons?  Do you nest them all like:
Replace(([Album],:)Replace([Album],'))
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: List Of Expression Functions... Spot any missing?
« Reply #12 on: August 17, 2010, 12:28:17 pm »

Hi zxsix,
Quote
But what's the syntax to substitute a space instead of the apostrophe?

replace([album],'/ )

Spaces that come after a comma are ignored by the expression engine, so, in order to get our space recognised and utilised, it must be 'escaped' using a preceding forward slash character.

Quote
Also, what's the syntax if I want to remove apostrophes AND colons AND semicolons?
As far as I can tell, there's no way to use replace() to remove multiple items in one sweep. It does not accept multiple values and cannot be strung together.
-marko

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: List Of Expression Functions... Spot any missing?
« Reply #13 on: August 18, 2010, 02:51:34 am »

Because I'm up to my neck in this stuff atm, I got curious... 4 ÷ 3 = 1.33 recurring, so what would MC do when I gave it the following to work on:

formatnumber(math(4/3),-1)

Now, the -1 should tell MC to use as many decimal places as necessary, so, when would it give up, I wondered...

The MC result is 1.3333333730697632

How does it arrive at that? (and yes, I'm now working on the Format functions!!)

-marko

Mr ChriZ

  • Citizen of the Universe
  • *****
  • Posts: 4375
  • :-D
Re: List Of Expression Functions... Spot any missing?
« Reply #14 on: August 18, 2010, 03:33:11 am »

That's an impressive switch statement :-)

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4583
Re: List Of Expression Functions... Spot any missing?
« Reply #15 on: August 18, 2010, 04:54:51 am »

The MC result is 1.3333333730697632

How does it arrive at that? (and yes, I'm now working on the Format functions!!)

-marko
that is what they call dither as far as i understand it.. :)
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4583
Re: List Of Expression Functions... Spot any missing?
« Reply #16 on: August 25, 2010, 10:10:47 am »


Back when the playingnow() expressions were added, I remember they caused a fair bit of excitement... why was that, as I appear to be missing their value so far?

since i was answering something i remembered this question... im using it on several spots. for me the enthousiasm of back then is that it made it possible to make a simple smartlist that gives the whole album of the song playing now. so when i listen to radio i can hit a button on my remote to play the whole album of the song i hear. something i still enjoy and use a lot (before i had something like that programmed in a plug to do the same)

 :)
gab

edit: a thing i use in a lot of views, also in Theater View, is that playingnow() gives the possibility when you have a sorting with last played (albums or songs) it can start with track/album that is playing now.  8)
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: List Of Expression Functions... Spot any missing?
« Reply #17 on: August 25, 2010, 01:43:06 pm »

Cheers gappie. If you laid out the details in a forum post on the main board, I could link to it from the wiki page.

The wiki gave me a warning when saving this evening's additions:

WARNING: This page is 31 kilobytes long; some browsers may have problems editing pages approaching or longer than 32kb. Please consider breaking the page into smaller sections.

Is this something I should be genuinely concerned about, or can I carry on regardless?

-marko

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4583
Re: List Of Expression Functions... Spot any missing?
« Reply #18 on: August 25, 2010, 02:38:57 pm »

i will marko. guess i can come up with something..
about the warning. i got that one the last time i edited the mcc page too, everytime, but i also think i got it before. i did not worry  8)

32kb sounds like something from the past or for mobile phones. why would they read the dev part of the mc wiki.  ;)

 :)
gab
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: List Of Expression Functions... Spot any missing?
« Reply #19 on: August 25, 2010, 03:16:41 pm »

30k is hardly a concern for a page size today on a browser.
Logged
The opinions I express represent my own folly.

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: List Of Expression Functions... Spot any missing?
« Reply #20 on: August 29, 2010, 06:48:56 pm »

I quickly added the following missing functions below to the list.  I realize Marco will modify soon.

AlbumKey
Hexify
IsInPlayingNow
IsPlaying
Left
Length
ListBuild
Math
Note
Right
TrackNumber (what does this do?)
TVInfo
Logged
The opinions I express represent my own folly.

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: List Of Expression Functions... Spot any missing?
« Reply #21 on: September 05, 2010, 09:25:16 am »

Quote
I realize marko will modify soon.
Work still in progress... page is up to 57Kb so far!!

Does anyone know if there's anything currently on the wiki that describes what list type fields are, and how they are used?
I wanted to use a link for reference, but can't find one!!

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Re: List Of Expression Functions... Spot any missing?
« Reply #22 on: September 05, 2010, 10:14:01 am »

Excellent job, thanks

A couple of suggestions

The expressions are a bit hard to find in the main index of the Wiki  simply because it is called Media Center expression language
Expression language would be more convenient as it will appear where you expect  it , under the E

The list is a bit random organized, a alphabetical listing will improve it.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: List Of Expression Functions... Spot any missing?
« Reply #23 on: September 05, 2010, 10:50:41 am »

Excellent job, thanks
Vincent, I have not published the revamped page yet, you do realise that, yes? Hopefully, you'll still feel the same way once it's out there :)

A couple of suggestions

The expressions are a bit hard to find in the main index of the Wiki  simply because it is called Media Center expression language
Expression language would be more convenient as it will appear where you expect  it , under the E
I was looking at that this afternoon, and see that there's also an entry under "D" called Database Expressions. For now, when the new page is published, it will replace the existing one, under M, as many people will have that page bookmarked, and I don't fancy going through the wiki and editing any other pages that link there to point to a new page.

The list is a bit random organized, a alphabetical listing will improve it.
Once published, the new page should hopefully deal with this issue, though I can tell you in advance that alphabetical doesn't come into it!!

Regards,
-marko

Vincent Kars

  • Citizen of the Universe
  • *****
  • Posts: 1154
Re: List Of Expression Functions... Spot any missing?
« Reply #24 on: September 05, 2010, 10:53:10 am »

Quote
you do realise that, yes?
Obvious not, sorry
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: List Of Expression Functions... Spot any missing?
« Reply #25 on: September 05, 2010, 10:58:54 am »

Obvious not, sorry
Apology is absolutely not required.

back to my original question...
Does anyone know if there's anything currently on the wiki that describes what list type fields are, and how they are used?
I wanted to use a link for reference, but can't find one!!

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
ListBuild() - Bug, or by design?
« Reply #26 on: September 09, 2010, 10:59:24 am »

If I use a listbuild function
Code: [Select]
listbuild(1,\,[genres],[genre],[genre+])&datatype=[list] to create an expression based pane, the pane does not create nested entries, populating as [genres\[genre]\[genre+] instead.

If I take the exact same expression and create a list type, expression based library field, and use that as a view pane, it nests correctly.

Is that a bug, or by design?


Also:
ListBuild and ListCombine when used as category panes, still require "&datatype=[ list]" in order to function correctly. Surely, by simply using either of these two functions, the datatype is implied and should not need specifying?

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: List Of Expression Functions... Spot any missing?
« Reply #27 on: September 09, 2010, 07:17:08 pm »

Quote
Is that a bug, or by design?

I have an idea of why this might be by "natural limitation." But that's too fuzzy for me to remember, so my usual practise is to use an expression, discover it doesn't work, and then replace it with an expression field. It seems to me the same thing comes up in Theatre views. It would be nice if the wiki could include a concise explanation of this limitation (if that's what it is). If I could remember that, it would save me from some trial & error. More importantly, it might same others from thinking an expression is wrong or not feasible when the issue is really the circumstance in which it's being used.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: List Of Expression Functions... Spot any missing?
« Reply #28 on: September 10, 2010, 01:29:21 am »

Yeah, that's why I asked. The wiki page update is about half way done now, and not having made much use of the listbuild and combine functions since I used them to move everything into the keywords field a few years, I'm not too familiar with their nuances, and wanted to check this one out before writing up that section of the page.

I think most (all?) of the team are on a break at the moment? so will hang out for a bit until I find out for sure.

regards,
-marko.
Pages: [1]   Go Up