INTERACT FORUM

Please login or register.

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

Author Topic: Expression Language Wiki  (Read 10734 times)

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3119
Expression Language Wiki
« on: May 05, 2020, 08:02:23 am »

This was a great effort. Thanks. However, now they need to be documented in the Wiki. Otherwise, it is somewhat hit and miss how to use them. I was looking for the syntax of Find and realized I could not find it.   The questions I had were if any of the capitalization options were implemented and if you could start the serach at someplace other than the beginning.   Nobody likes to do documentation, but we need that to make these functions useful.  Thanks.
Logged

Mike Foran

  • World Citizen
  • ***
  • Posts: 212
Re: Expression Language Wiki
« Reply #1 on: May 05, 2020, 09:05:47 am »

NEW: Added a SearchTags(...) expression function that takes a value and returns all the fields that have a match (the parameter after the value is an integer that when set to 1, just returns true or false for matches instead of the field names).

SearchTags works GREAT!!!! Wow this really made my day! I'm going to have fun with this. Finally my Obsessive Tagging Disorder will pay off dividends. Thank you for implementing that!

Question: Is there any way to dynamically feed a search parameter to a search expression? For instance, Can I have a Panes view with column A being "Artist" which would feed selected names to a SearchTags query and return results either in a column B or in a lower panel content list?
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #2 on: May 16, 2020, 05:01:00 am »

These need to be added to the wiki....

I've made a start, adding "IfCase()" this morning. Just adding that one took way too long as I'm not familiar enough with wiki markup, and there seems to be multiple pages to edit just to add one function, so relied upon much copy/pasting/editing. Was also helped by wer's full description in it's proposal. Getting them all added will take literally months.

If anyone with more time on their hands feels like helping, don't hold back :)

These are added to the wiki expressions page
These are still to be added


Changed: Added the expression function ListMix2 that removes the escapement (so it will return with the ListMix expression).
NEW: Added a Dehexify expression function. (Bld 26)
1. NEW: Added PlaylistAdd and PlaylistRemove expression functions. (33.0.15)
New modes for listgrep added: 33.0.31


NEW: Added the IfCase(...) expression function ( details here: https://yabb.jriver.com/interact/index.php/topic,124543.msg866100.html#msg866100 ).
NEW: Added a ListMix(...) expression function (see this thread for details: https://yabb.jriver.com/interact/index.php/topic,124543.0.html)
NEW: Added a mode to the Find(...) expression function "2" to reverse find instead of forward find in the string.
NEW: Added the expression function Letter(...) to output the starting letters of a string.
NEW: Added the expression function TrimLines(...) to standardize and consolidate newlines.
NEW: Added a SearchTags(...) expression function that takes a value and returns all the fields that have a match (the parameter after the value is an integer that when set to 1, just returns true or false for matches instead of the field names).
NEW: Added the expression function Find(...) to search for a substring in a string.
NEW: Added the expression function Trim(...) to trim non-printable characters and newlines from a string.
NEW: Added the expression function Range(...) to create a numbered list.
NEW: Added the ListShuffle(...) expression function.
NEW: Added modes 9 (List search ANY (case sensitive)), 10 (List search ANY (case insensitive)), 11 (List search ALL (case sensitive)), and 12 (List search ALL (case insensitive)) to the IsEqual expression function.
NEW: Added modes 13 through 16 to IsEqual to do full string matching (instead of partial).
NEW: The Regex expression function takes a -2 mode that outputs all the captures as a semi-colon delimited list.
NEW: Added a mode 5 to the Clean(...) expression function that standardizes quotes.
NEW: Added a ListGrep expression function to filter a list to a matching string.
NEW: Added the expression function ListFind(...) to search a list for a value (takes a final parameter to decide if it should return the value or the index).
NEW: Added the Char(...) expression function to output a character from the numeric code of the character.
NEW: Added the expression function Number(...) that takes a string and finds the number (plus decimal) in the string.
NEW: Added modes 3 (remove empty strings) and 4 (trim strings) to the ListClean(...) expression function.
NEW: Added a ListRemove expression.
NEW: Added the ListFormat(...) expression function.
NEW: Added the expression function Or(...) to test a list of values and output true if any are set.
NEW: Added the expression function And(...) to test a list of values and output true if all are set.
Rand(...)
DateInRange(...)
FileLookup(...)
IsDigit(...)
IsDriveMissing(...)
IsLowerCase(...)
IsUpperCase(...)
StackCount(...)
Row(...)
NoArticles(...)
URLify(...)
RatingStars10(...)
DBLocation(...)
NEW: Added the expression Enviro to load a system environment variable.
Translate(...)
Literal(...)
NEW: Added a GroupCountQuery(...) expression function to group files by a field, then count another field.
NEW: String literals can be defined in expressions by using /* comment here /*.  The text will be output without any formatting. (Added info to Expression Language Syntax info)
ItemCount(...) https://yabb.jriver.com/interact/index.php?topic=122319.0
NEW: Added the expression function GroupSummaryQuery to build a summary for files matching the given fields.
Changed: Made the ListFind(...) expression function support outputting a custom not found string when searching on index (keep blank to output -1).
Changed: The ListLimit(...) expression function takes a delimiter (optional and defaults to semi-colon).
NEW: Added mode 2 to the ListRemove expression function which does substring matching (instead of entire string).
NEW: The ListItem(...) expression functions optionally takes a negative number to mean from the end of the list (-1 is last, -2 is second to last, etc.).
It seems that Matt did add the ListMath() function listed here.
NEW: Added the expression functions PadLeft(...) and PadRight(...) to pad a string.
NEW: Added a Roman(...) expression function to convert to and from roman numerals.
NEW: Added a Repeat(...) expression function to output a string over and over a given number of times.
NEW: Added the min and max expression functions (they take any number of parameters).
NEW: Added the expression functions avg and sum to average and sum numbers.
NEW: The Mid(...) expression function takes a mode so that you can pass the end as an index instead of a count of characters.
NEW: Added a match mode to the ListFind(...) expression function to switch between partial matching and full matching.
NEW: Added a Not(...) expression function to flip the state of a variable.
NEW: Added the PlaylistTime(...) expression
NEW: Added the TreeNode(...) expression.  Mode 0 (the default) returns the full path.  Mode 1 returns the current item.  Mode 2 returns the parent item.
Extract()
NEW: Added the FieldQuery expression function to return a list of matches based on a list of fields to search.
NEW: Added the SetField(...) expression function.
NEW: Added the number 4 to the TrimLines expression function to replace triple new lines with double.
NEW: Added the ListFilter(...) expression function
NEW: Added another mode to ListCombine(...) expression function to allow outputting only values not common to both lists.
NEW: Added a checkbox to library fields "Allow custom data to override the expression" that will allow editing the value of an expression and then show the edited value instead of the expression (just empty to bring the expression back).
NEW: Added modes 7 and 8 to the Clean(...) expression to remove numbers from the end of the string ( 7 ) or either side of the string ( 8 )
Changed: Added an optional third parameter to the Counter expression function to set when to start over.
NEW: When setting a field to an expression, a "this" variable is saved so doing something like =RemoveLeft([this], 3) will work.
Additional modes for PlaylistTime()
Changed: Made the Field expression function take an optional third parameter to specify a file key (defaults to empty which evaluates the current file).
NEW: Made FieldQuery take a Scope of 2 to match files of the same media type (the list is gathered one time, so you will need to restart to see newly imported files).
Changed: ListMix allows specifying flag value of 4 to not evaluate the inner portion as another expression.
Changed: ListMix takes parameter value of 8 which tells it to do no unescape after everything.
NEW: Added a mode 3 to ListCombine that's A - B.
ConvertDate() updates
NEW: Added a CompareDates expression function to compare by year, days, or calendar years. (30.0.52)
NEW: Added IsOverridden expression function to test if an expression field has a stored value. (32.0.21) (why...)
NEW: Added a FileExtension expression function. (32.0.13)
5. NEW: Added a Decimal expression function to convert to dot for a number.


Done
ListMix examples need attention (Thanks lepa)
The ListLimit() needs fleshing out a bit.
Add clarity to GroupCountQuery


I am illiterate when it comes to regex so could not provide an example use case for the new -2 mode. If anyone can write this up I can add it to the regex examples. Thanks to wer for some detailed regex information.

-marko

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #3 on: May 16, 2020, 08:06:26 pm »

I promised Matt I would document one, but then I hit this issue;

Just adding that one took way too long as I'm not familiar enough with wiki markup

I did make a start, producing a simpler list of functions to work through, and adding an earlier one that hasn't been documented, IsUpperCase(...).

Full List
IfCase(...)
ListMix(...)
Find(...)
Letter(...)
TrimLines(...)
SearchTags(...)
Trim(...)
Range(...)
ListShuffle(...)
Char(...)
Number(...)
ListFind(...)
Or(...)
And(...)
IsUpperCase(...)
ListGrep() https://yabb.jriver.com/interact/index.php/topic,124543.msg869886.html#msg869886
Regex(...) Mode -2 example: https://yabb.jriver.com/interact/index.php/topic,119385.msg870800.html#msg870800
ListRemove(...)
IsEqual(...) - Update with all the new Modes. I guess that is in your list above, but not in mine.
NEW: Added modes 3 (remove empty strings) and 4 (trim strings) to the ListClean(...) expression function.
DateInRange(...)
FileLookup(...)
IsDigit(...)
IsDriveMissing(...)
IsLowerCase(...)
NoArticles(...)       Matt, the Tooltip for this one needs to be fixed. Refers to "RemoteArticles" 
Rand(...)
Row(...)
StackCount(...)
Link to the IsEqual command in the IfCase(...) doesn't work though.
NEW: String literals can be defined in expressions by using /* comment here /*.  The text will be output without any formatting. https://yabb.jriver.com/interact/index.php?topic=122149.0
ItemCount(...) https://yabb.jriver.com/interact/index.php?topic=122319.0



GroupSummaryQuery(...)
GroupCountQuery(...)
DBLocation(...)
Literal(...)
RatingStars10(...)
Translate(...)
URLify(...)
Enviro variable

Min(...)
Max(...)
Avg(...)
Sum(...)
FieldQueert(...)



We also need to add to the list:
Should add a link to Boolean Operations as they would be helpful, but not easy to find.

We should reference functions that are available in the Player Display such as [Remaining Time], [Playlist Remaining Time] etc., which look like fields but aren't. See https://yabb.jriver.com/interact/index.php/topic,125595.0.html and search for more. Maybe these are already in the Wiki somewhere... Maybe not. This is all a quick search finds: https://wiki.jriver.com/index.php/Player
I know of:
[Elapsed Time]
[Remaining Time]
[Total Time]
[Bitrate (labeled)]
[PN Position]
[PN Tracks]
[Zone]
[App Name]
[App Version]
[Library]
[View Filter]
[Playlist Remaining Time]

In future (MC27):
[Playlist Total Time]

From Matt 2020-07-23:
Here's the full list of specials for the player in MC27:
Alternate Settings|App Name|App Version|Bitrate|Bitrate (Labeled)|Channels|Elapsed Time|Library|Playstate|PN Position|PN Tracks|Remaining Time|Total Time|Playlist Remaining Time|Playlist Total Time|User|View Filter|Volume|Zone|Zone ID|In Sample Rate|Out Sample Rate


27.0.4 (8/22/2020)
2. Changed: Added the min and max expression functions (they take any number of parameters).
5. NEW: Added the expression functions avg and sum to average and sum numbers.
7. NEW: Added the FieldQuery expression function to return a list of matches based on a list of fields to search.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Expression Language Wiki
« Reply #4 on: May 16, 2020, 08:37:42 pm »

GroupSummaryQuery and GroupCountQuery don't work correctly yet, so I'd hold off on those.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #5 on: May 17, 2020, 12:07:28 am »

Quote
Your link to the IsEqual command doesn't work though.
I know, but don't know why. It follows the exact same syntax as FirstNotEmpty above it.

It's because, in yet another step, a redirect for every function is required. Sorted now.

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #6 on: May 17, 2020, 01:52:23 am »

Those redirects only seem to be required where you are redirecting to another point on the same page. It still wasn't working for me.

You have used this form, which redirects to another point on the same page, I think: [[#IsEqual|IsEqual()]]

To direct to a point on a different page only seems to need, I think: [[IsEqual()]]


I worked that out from the link to the If() function in the examples for the IsEqual() function on the "Test and Comparison Functions" page, which redirects to the "Conditional Functions" page.

So the text "The If() function bases its decision on the outcome of..." is coded as ": The [[If()]] function bases its decision on the outcome of...".

In fact, looking further, the second form is used to jump to a point on the same page as well. Both forms work for that. Maybe one version does use the redirect, and the other doesn't. Why not just use the full URL, which in the case of the If() function is "https://wiki.jriver.com/index.php/Conditional_Functions#If" ?   I don't know, yet.



I had to edit your IfCase() entry to test that out, as the Preview didn't really prove anything. It works now, using the second form above. 

This is why I hadn't edited these pages before, except for minor tweaks. I don't find reading the Wiki Media documentation very easy either.  ? Which is why I have avoided it.  ;D  There must be an easier way to create these pages.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #7 on: May 17, 2020, 02:11:32 am »

Ah, it looks like that first form might be used to hide the redirect, which shows at the top of the page if you use the second form.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #8 on: May 17, 2020, 03:31:23 am »

Hmmm. It looks like the correct form, without using a Redirect, is:

[[Test_and_Comparison_Functions#IsEqual|IsEqual()]]

Where Blue [[]] designates the start and end of a Link.
The Orange "Test_and_Comparison_Functions" is the page to go to.
The Purple "#" designates the following text is the name of an Anchor (I think that is the correct term) to go to on the above page.
The Black "IsEqual" is the name of an Anchor to go to on the above page.
The Red | designates that the following is the text to show.
The Green "IsEqual()" is the text to show in the body of the Wiki.

I suspect that using the above form doesn't require a Redirect to work, but I haven't deleted the "IsEqual" Redirect to test that. In fact, I suspect that when just the "#IsEqual" form is used in the first part, MediaWiki tries to find a page of that name, can't, and so tries to find a Redirect of that name. Although the Redirect is actually named "IsEqual()".

I just can't find a better explanation in the MediaWiki help pages at the moment.

Anyway, using this form works, makes the Wiki easier to read when editing it, and potentially doesn't need a Redirect. Good enough for me.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #9 on: May 17, 2020, 03:35:46 am »

That's IsEqual() updated and Letter() added.

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #10 on: May 17, 2020, 03:37:37 am »

Not sure about all that linkage stuff. I can only imagine glynor set it up that way with good reason.

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #11 on: May 17, 2020, 03:54:17 am »

Maybe. having to create the Redirects seems a bit strange. I can't find any reason for that in the MediaWiki help pages. The only reason I can think of is if the Redirects are used elsewhere, so need to be created anyway. Dunno.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #12 on: May 23, 2020, 05:52:52 am »

I could well be wrong, but I think they might be helping with searches. So, if you search for ListMix() and press enter, it takes you directly there. Either way, I've made them just to keep as much uniformity as possible.

This morning, I've added the ListMix() function, with huge thanks to zybex for the comprehensive write up. I would likely as not been unable to write it up as cleanly as that. Thank you zybex.

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Expression Language Wiki
« Reply #13 on: May 23, 2020, 04:34:34 pm »

I could well be wrong, but I think they might be helping with searches. So, if you search for ListMix() and press enter, it takes you directly there. Either way, I've made them just to keep as much uniformity as possible.

Correct. Each one is its own "page" in the Wiki (the pages are just redirects to the proper index of the section pages), so you can do this:
https://wiki.jriver.com/index.php/If()
https://wiki.jriver.com/index.php/IsPlaying()
https://wiki.jriver.com/index.php/Regex()

And those links will take you directly to the proper spot. That also allows you to search for the name of an expression function and be taken directly to the entry (rather than to a search page and have to find it). That's basically how the search index is built in MediaWiki. Alternate terms are always redirects.

It is also very handy for documenting functions elsewhere in the Wiki. Because if you use a function name anywhere on any page, you can just surround it with brackets and it'll automatically go to the right spot (you don't have to use "extended" mediawiki links). The idea of a MediaWiki is to keep those types of "manual deep links" to a minimum, because if you're linking to a page based on the term, it should be searchable based on that same term. Plus they're prone to breaking if you move a subsection out to its own "full" page in the future.

Therefore, add a redirect.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Expression Language Wiki
« Reply #14 on: May 23, 2020, 04:38:57 pm »

It has been a long time, but the easiest way to add functions to that section of the wiki is to copypasta a previous entry in the same section, and then modify it. Doing it that way is reasonably simple.

Then, once you've created the main entry, just click on the redlink in the "title" and make the redirect (like the others use).

Lastly, go and add them to the Function Index, and point towards the redirect page you just made (which basically happens automatically when you surround the function name with brackets).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #15 on: May 23, 2020, 06:09:40 pm »

Thanks Glynor.

I still haven't done one of these. But I follow why it is done that way.

So the Function Index needs to be manually updated? I always thought there was some indexing going on in the background building summaries. It looks like it needs some love. I just corrected one small error produced by Copy/Paste (GroupSummary). I think I corrected that previously in the main Expression Language page, not knowing about the Function Index needing separate update. The correction is there, but it isn't showing in History. Strange.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Expression Language Wiki
« Reply #16 on: May 23, 2020, 09:12:36 pm »

So the Function Index needs to be manually updated?

It does, unless someone else built something much fancier than I did when I last left it. My guess is that errors were introduced as others made edits not fully understanding the system, though it is possible that I left it behind with some errors of my own.

Auto-generated content like you were envisioning can be done, but it is substantially complex, and requires server-side scripting that I didn't have access to add (nor the knowledge or desire to implement it and maintain it).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Expression Language Wiki
« Reply #17 on: May 23, 2020, 09:21:06 pm »

I should note...

This Function Index is wrong: https://wiki.jriver.com/index.php/Function_Index
It should be a redirect to here: https://wiki.jriver.com/index.php/Expression_Language#Function_Index

I think that was an cruddy page that 6233638 made long ago (because he didn't understand the setup of the main page). Then it looks like Marko and others have been trying to fix it, but it should have just been made into a redirect to the Function Index in the Expression Language article. It isn't needed, and is just a duplicate place to have to edit everything.

Edit: I fixed it. If you added anything useful to 6233638's weird Function Index page, you'll need to look at the history and move them to the proper Function Category sub-page.

Oh, and the reason why I split it up into sub-pages is because there was WAY too much on one page to be able to edit it in a manageable fashion.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #18 on: May 23, 2020, 09:55:22 pm »

Now that makes a lot more sense. You fixed it and edited that post while I was typing. Ta.

The sub-pages make a lot of sense. One big page would be a nightmare.

It looks like the three new functions added so far are on the main page already, so all good, thanks to Marko.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #19 on: May 23, 2020, 11:11:29 pm »

Okay, there is still something funky going on with the IsEqual link in the IfCase section, as per my reply 8 above.

I removed my direct link and put back the correct link in the form [[#IsEqual|IsEqual()]]. It doesn't work, just linking back to the top of the "Conditional Functions" page, rather than jumping to the "IsEqual" on the "Test and Comparison Functions" page.

The redirect looks correct and works correctly. It hasn't been edited since you created it Glynor.

When I hover over the link it shows the incorrect information, pointing to "https://wiki.jriver.com/index.php/Conditional_Functions#IsEqual" instead of the correct "https://wiki.jriver.com/index.php/Test_and_Comparison_Functions#IsEqual", as seen in other instances of using that same redirect on other pages, with the exact same form of link in the other pages, being "[[#IsEqual|IsEqual()]]". There is no error in the text, and yet the link in the IfCase section doesn't work correctly.

I tried deleting that link, saving the page, and recreating the link again, and it still doesn't work. I can't see what the problem is.

It seems like MediaWiki has remembered that link for that section, and it isn't going to forget it or update the page no matter what. I've looked at the Redirect every way I can, done searches and compared the results to other functions. I just can't see a fix for this issue.

Sure, I could just put the direct link back, but what if the next one doesn't work?


PS: Marko, when I first tried the link in the form [[#IsEqual|IsEqual()]] after you set it up, it didn't work then either. It always jumped to the top of the "Conditional Functions" page.


Nope. I come back to the same thing I said in Reply 8. That form of link only works to jump to a location on the same page. It does not use the Redirect, and hence doesn't jump to a location on another page. As evidence, I direct anyone interested to the Expression Language Archive page, which uses the same form and only redirects back to locations on the same page.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #20 on: May 24, 2020, 01:54:54 am »

This wiki editing discussion should be moved to its own thread...

The IsEqual link in the IfCase description has been fixed using [[Test and Comparison Functions#IsEqual|IsEqual()]] (as per reply #10)

Regarding copy/paste...
This is the markup used for the listcombine function, which is about as unuser friendly as you could get....
Code: [Select]
=== <span id="ListCombine">ListCombine(&hellip;)</span> ===
: Combines two delimited lists into a single delimited list.

{| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0"
|- id="ListCombine" 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>listcombine(</b><i>list1</i><b>, </b><i>list2</i><b>, </b><i>input delimiter</i><b>, </b><i>output delimiter</i><b>, </b><i>mode</i><b>)</b></span>
The [[#ListCombine|ListCombine()]] function returns a single list after performing the operation specified by <i>mode</i> on the two lists <i>list1</i> and <i>list2</i>.
An <i>input delimiter</i> and an <i>output delimiter</i> may be specified.
The <i>input delimiter</i> is effective for both <i>list1</i> and <i>list2</i>, and the <i>output delimiter</i> will be used in the returned list, replacing the
<i>input delimiter</i> from both <i>list1</i> and <i>list2</i>.

Available <i>mode</i> values:

<div style="margin-left: 20pt;"><table style="border-spacing:0px; border-collapse:collapse; background: #f9f9f9">
<tr><td style="text-align:left; padding-right:20pt"><b>0</b></td><td>Combine lists removing duplicates (order is preserved).</td></tr>
<tr><td style="text-align:left; padding-right:20pt"><b>1</b></td><td>Output only items contained in both lists (order is preserved).</td></tr>
</table></div>

Argument <i>input delimiter</i> is optional (defaults to SEMICOLON).

Argument <i>output delimiter</i> is optional (defaults to SEMICOLON).

Argument <i>mode</i> is optional (defaults to 0).

|- 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>listcombine(a;b;e, a;b;c;d)</nowiki></b></span>
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">a;b;e;c;d</span>.
This example uses the default <i>mode</i> 0 to combine <i>list1</i> with <i>list2</i>, preserving the order of items.
The default <span style="font-family: monospace,monospace; font-size:1em;">;</span> <i>input delimiter</i> and <i>output delimiter</i> is used.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine(a;b;e, a;b;c;d, ;, ;, 1)</nowiki></b></span>
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">a;b</span>.
The <i>input delimiter</i> and <i>output delimiter</i> are both specified as <span style="font-family: monospace,monospace; font-size:1em;">;</span>,
and <i>mode</i> 1 is used to produce a list of only items that exist in both <i>list1</i> and <i>list2</i>.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine(a-c, c-f, -, ..., 0)</nowiki></b></span>
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">a...c...f</span>. The <i>input delimiter</i> is <span style="font-family: monospace,monospace; font-size:1em;">-</span>, while the <i>output delimiter</i> is <span style="font-family: monospace,monospace; font-size:1em;">...</span>, and <i>mode</i> 0 combines both lists.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine(a#@#c, c#@#f, #@#, ., 0)</nowiki></b></span>
<p style="margin-left:20pt;">Returns <span style="font-family: monospace,monospace; font-size:1em;">a.c.f</span>. This example demonstrates how to combine two lists with duplicates removed while replacing a multi-character <i>input delimiter</i> <span style="font-family: monospace,monospace; font-size:1em;">#@#</span> with a single-character <i>output delimiter</i> <span style="font-family: monospace,monospace; font-size:1em;">.</span>.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>listcombine([people], [places])&amp;datatype=[list]</nowiki></b></span>
<p style="margin-left:20pt;">The result here would be a single, semicolon delimited list containing all the list items from the [people] and [places] fields.
For example, if [people] contains <span style="font-family: monospace,monospace; font-size:1em;">Family\Mum; Family\Dad; Family\Gran</span>, and [places] contains <span style="font-family: monospace,monospace; font-size:1em;">UK\Scotland\Edinburgh; UK\Scotland\Edinburgh\Edinburgh Castle</span>,
the output list would be <span style="font-family: monospace,monospace; font-size:1em;">Family\Mum; Family\Dad; Family\Gran; UK\Scotland\Edinburgh; UK\Scotland\Edinburgh\Edinburgh Castle</span>.
Using the <span style="font-family: monospace,monospace; font-size:1em;">&datatype=[list]</span> cast makes the expression split individual list items in a panes or categories view.</p>
|}
<div style="text-align:right;">([[#top|Back to top)]]</div>

This, is the markup used for listmix, which is a whole lot easier to follow...
Code: [Select]
=== <span id="ListMix">ListMix(&hellip;)</span> ===
: Combine corresponding values from multiple lists into a new list, using a template to process each item.

{{function description box
| name=ListMix
| arguments=template, mode, list1, [list2, ... listN]
| description=
{{argument optional|mode|0}}
The [[#ListMix|ListMix()]] function processes the elements of one or more lists, returning a new list where each element is similar to the provided template modified with the elements of the list argument(s).
The number of list arguments to be mixed is variable, but at least one must be provided. The lists can have different lengths, with mode controlling the length of the returned list.
The first element of the returned list is generated by applying the first element of each provided list to the template; the second element is generated using the second element(s) of the list(s), and so on until all elements are processed, according to mode.

The <i>'''template'''</i> is a text string with placeholders like [L1], [L2], etc, indicating where the elements of the provided lists should be inserted. [L1] refers to elements of list1, [L2] refers to list2, and so on. The special placeholder [N] refers to the item number within the resulting list.

A <i>'''template'''</i> is also itself an Expression, so it can contain other functions/expressions. A template can be escaped using the escape sequence /#template#/. This is usually not required but may be useful to enter templates containing functions, commas, or other special symbols.

The default semi-colon list delimiter is used for both input and output lists.

{{argument table
| name=mode
| contents=
{{argument table row|0|Return as many elements as the '''longest''' provided list}}
{{argument table row|1|Return as many elements as the '''shortest''' provided list}}
{{argument table row|2|Return as many elements as the '''first''' provided list}}

}}
| examples=
'''{{monospace|<nowiki>ListMix(Actor #[N] is [L1],, a;b;c)</nowiki>}}'''
: Returns Actor #1 is a; Actor #2 is b; Actor #3 is c
This example uses mode 0 and demonstrates the usage of [N] and [L1] on a single list.

'''{{monospace|<nowiki>ListMix([L1][L2]=[L3], 0, a;b;c;d, 1;2;3;4;5, blue;red;green)</nowiki>}}'''
: Returns a1=blue; b2=red; c3=green; d4=; =5
Mode 0 returns 5 elements which is the length of the longest list. Note that on the last two the missing values on the template are also missing on the output.

'''{{monospace|<nowiki>ListMix([L1][L2]=[L3], 1, a;b;c;d, 1;2;3;4;5, blue;red;green)</nowiki>}}'''
: Returns a1=blue; b2=red; c3=green
: Mode 1 returns only 3 elements, the length of the shortest list.

'''{{monospace|<nowiki>ListMix([L1][L2]=[L3], 2, a;b;c;d, 1;2;3;4;5, blue;red;green)</nowiki>}}'''
: Returns : a1=blue; b2=red; c3=green; d4=
: Mode 2 returns only 4 elements, the length of the first list.

'''{{monospace|<nowiki>ListMix(FixCase([L1],3)=Math([L2]*[L3]),, aa;bb;cc, 10;20;30, 5;4;3)</nowiki>}}'''
: Returns : AA=50; BB=80; CC=90
: This example uses two different functions on the template to further transform each element of the lists before inserting it into the output.


'''{{monospace|<nowiki>ListMix(<img src=tooltip:actors\\[L1]> \ , 1, [Actors], 1;2;3;4;5)</nowiki>}}'''
: Returns (example): <img src=tooltip:actors\Daisy Ridley>  ;<img src=tooltip:actors\Adam Driver>  ;<img src=tooltip:actors\John Boyega>  ;<img src=tooltip:actors\Oscar Isaac>  ;<img src=tooltip:actors\Mark Hamill> 
: This example transforms the [Actors] field into a list of <img> tags ready to load the actor thumbnails into the Theather View or Movie Tooltip. It uses mode 1 (shortest list) with a dummy [L2] list of 5 elements to make sure the resulting list is at most 5 items long. An alternative way to accomplish the same would be to use ListLimit([Actors],5) as [L1].

}}

My quest to learn more about this apparent shorthand led me to this page which helps, a lot :D

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #21 on: May 24, 2020, 02:26:56 am »

This wiki editing discussion should be moved to its own thread...

Agreed. Needs an administrator. Really, the discussion should happen for specific articles mostly in the Wiki Discussion area of each article. But there probably should be a Wiki editing forum for broader discussion. It might encourage more people to write articles.


The IsEqual link in the IfCase description has been fixed using [[Test and Comparison Functions#IsEqual|IsEqual()]] (as per reply #10)

I changed it to that because I thought it was the correct way to do it, and the only way that worked. I changed it back because it sounded like it should work. Obviously not. I shall undo the change. EDIT: I see you already have Marko.



My quest to learn more about this apparent shorthand led me to this page which helps, a lot :D

I can read and understand all the formating on that template page, and most of the stuff above. But write it from scratch? Nah. It is a seriously complex formating language in need of a simple GUI. Word is complex, but does the same things in a far easier manner.

Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #22 on: May 24, 2020, 02:37:18 am »

At its most basic, click to edit the template page, copy, cancel out of the edit page, and use clipboard to paste where the addition is going. Place text in the appropriate places and save. Job done.

It's not quite that simple, I know, but this is a massive help.

Quote
I changed it to that because I thought it was the correct way to do it, and the only way that worked. I changed it back because it sounded like it should work. Obviously not. I shall undo the change.
I had already fixed it. There are plenty of these dotted throught the various expression function descriptions. I have stumbled across at least three by accident. No, I didn't fix them because I could'nt risk losing the current place in my mind for the expression I was adding at the time and knew I would get sidetracked onto a massively time consuming tangent!

A bit like this morning, where I sat down to add Find() to the wiki over an hour ago, and have not even started yet :)

-marko.

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #23 on: May 24, 2020, 05:59:40 am »

Find() has now been added.

Could someone verify that if searching from the end of the string, any specified "start" argument is ignored and the search is always conducted from the very end?

-marko.

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3119
Re: Expression Language Wiki
« Reply #24 on: May 24, 2020, 10:10:35 am »

Thanks for you efforts Marko. Documentation is never fun, but with the vagaries of the WIki format it is even more challenging.

For Find, I agree that the Start value is ignored for mode 3. In fact, even a  negative value for Start is ignored, whereas for the other modes a negative value for Start always returns -1.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Expression Language Wiki
« Reply #25 on: May 24, 2020, 01:33:59 pm »

My quest to learn more about this apparent shorthand led me to this page which helps, a lot :D

Well, yes. Best to copypasta one of the ones where I used the nice template I made, and not one of the ones done manually.

In some cases, the entries were just created before I made the template. In others, I was repurposing the content made by MrC (who was, himself, repurposing content made by you, marko), and re-doing them with the template was more work than just copypasta.

And, of course, all of my comments here are based on memory of things I was doing over 4 years ago, so.... YMMV.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Expression Language Wiki
« Reply #26 on: May 24, 2020, 01:50:14 pm »

Another tip: For many of the things I heavily edited, I kept "notes" on my Wiki page (including a "test/template" of the Function Description template I made). Can be useful for instructional purposes (and copypasting): https://wiki.jriver.com/index.php/User:Glynor
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #27 on: May 24, 2020, 08:17:29 pm »

Added

ListEqual(...)
ListContains(...)
MoveArticles(...)
UnmoveArticles(...)

To the Function Index.

Reordered (alphabetised) and cleaned up the String Manipulation Functions a bit.


Confirmed that the following functions are not described in the wiki. Source of list was Moe.

DateInRange(...)
DBLocation(...)
FileLookup(...)
IsDigit(...)
IsDriveMissing(...)
IsLowerCase(...)
Literal(...)
NoArticles(...)       Matt, the Tooltip for this one needs to be fixed. Refers to "RemoteArticles"  ?
Rand(...)
RatingStars10(...)
Row(...)
StackCount(...)
Translate(...)
URLify(...)

I added these to my list above, so they are all in one place.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #28 on: May 24, 2020, 10:35:56 pm »

SearchTags() has been added.


Added a Redirect for ListShuffle().
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #29 on: May 25, 2020, 12:03:28 am »

Thanks Rod. I nipped in and added the available modes to it.

Had no idea so many had fallen under the rader. Will try and get some more done next weekend. As I've been deemed an essential worker, I have to go in... It can be a little worriesome, especially when I find myself around care homes.

-marko

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #30 on: May 25, 2020, 12:19:47 am »

Ah, I missed the table for mode. So many screens open to check what to do where. I could have picked a better example to Copy/Paste to start from. Oh well, getting some stuff done.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #31 on: May 25, 2020, 12:39:09 am »

ListShuffle() was actually done by Matt in March, but the Redirect wasn't correct. Fixed.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #32 on: May 25, 2020, 03:00:12 am »

Range() has been added.

even the simple ones take a lot of time. Maybe because I am testing the functions to breaking point.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72444
  • Where did I put my teeth?
Re: Expression Language Wiki
« Reply #33 on: May 25, 2020, 06:48:05 am »

Thanks for you work on this, Rod and Mark.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #34 on: May 27, 2020, 11:34:04 am »

We're getting there...

added "NEW: The Regex expression function takes a -2 mode that outputs all the captures as a semi-colon delimited list." to the todo list.

-marko

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #35 on: May 28, 2020, 11:25:11 am »

added "NEW: Added a mode 5 to the Clean(...) expression function that standardizes quotes." to the todo list.

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Expression Language Wiki
« Reply #36 on: May 28, 2020, 05:14:12 pm »

 :o  The list is getting bigger rather than smaller!

I'll get back to doing some more soon. Did you know that MediaWiki has a WYSIWYG Editor, VisualEditor? That would be nice, although it doesn't get a good writeup.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #37 on: May 31, 2020, 03:23:30 am »

Regex() and Clean() are now updated. Clean() was also missing mode 4! I am illiterate when it comes to regex so could not provide an example use case for the new -2 mode.

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #38 on: May 31, 2020, 05:27:06 am »

Trim() and TrimLines() are added. Half a dozen missing redirect pages created, along with a currently intentionally orphaned, flat, alphabetical list of functions page.

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #39 on: June 06, 2020, 05:13:25 am »

ListGrep() and ListFind() are done.

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Expression Language Wiki
« Reply #40 on: June 07, 2020, 09:05:16 pm »

Thanks for doing these updates, guys.

Marko, if I may, a little feedback/info on the Regex-2 documentation...

First, it's important to note somewhere that MC's Regex() function takes a non-standard regular expression syntax, in that it will ONLY return results for things that are explicitly placed in a capture group.

For example:
[\w\s]+
is a perfectly valid regular expression that returns results, everywhere, except MC.

To work in MC, it must be modified, as so:
([\w\s]+)
Putting parens around it creates a capture group, and that is the only way MC will return a result.

Second, all the old Regex() functionality (meaning everything except the new -2 mode) will return exactly one result for each defined capture group.

Third, one must be careful working with strings of indeterminate length, or lists with an indeterminate number of elements, as if you have more capture groups in your expression that there exist matches in the string, Regex() will return NOTHING.

Regex-2 was devised specifically to get around the above issues, which made it almost impossible to deal with lists a variable number of elements using regular expressions in MC.

Lastly, here's an example for Regex-2, to extract the names of the actors from a list that contains actors and roles.
[Actors]=F. Murray Abraham [Antonio Salieri];Tom Hulce [Wolfgang Amadeus Mozart];Elizabeth Berridge [Constanze Mozart];Roy Dotrice [Leopold Mozart];Simon Callow [Emanuel Schikaneder];Christine Ebersole [Katerina Cavalieri];Jeffrey Jones [Emperor Joseph II];Barbara Bryne [Mrs. Weber]

Regex([Actors],/#([\w\s\.]+(?=\s\[))#/,-2)
returns:
F. Murray Abraham;Tom Hulce;Elizabeth Berridge;Roy Dotrice;Simon Callow;Christine Ebersole;Jeffrey Jones;Barbara Bryne

The reason I gave you those notes first through third is that they are all non-standard and undocumented, and so anyone that knows regular expressions will stumble around trying to understand why normal things are not working as expected.


-Will
Logged

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Expression Language Wiki
« Reply #41 on: June 07, 2020, 10:01:12 pm »

Also, GroupSummaryQuery and GroupCountQuery appear to be working ok now.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9140
Re: Expression Language Wiki
« Reply #42 on: June 07, 2020, 11:47:03 pm »

Marko, if I may, a little feedback/info on the Regex-2 documentation...
Thanks Will, exactly what was needed. I'll get it mashed into the wiki page next weekend.

I almost had Char() added but stumbled... I messed around with it a bit...
Char(189) returns ½
\u25CF/ returns a syntax error
u25CF returns nothing
https://yabb.jriver.com/interact/index.php/topic,124543.msg862539.html#msg862539

I could just add it as-is, but couldn't see any useful reason for its existance to convey in the addition, and where possible, I like to try and do that as I believe it helps people using the expression function pages to learn from, to fully realise the potential they have at their disposal.

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Expression Language Wiki
« Reply #43 on: June 08, 2020, 02:30:08 am »

Regarding Char(), the intention for Char(189) is as you saw, to use the ASCII code to produce a character.

Perhaps Matt didn't add the unicode support? I see no mention of it in the expression editor tooltip.


Regarding Regex-2, there is a hidden gotcha:
Multiple capture groups return invalid results, but that may be a bug.
Nested parenthesis create duplicate results, so one must avoid nested parenthesis.

Example:
(\d) is a valid capture group
(\w) is a valid capture group
(\d)|(\w) is a valid expression, but returns invalid results in MC
((\d)|(\w))  is a valid expression, but returns duplicate results in MC
(\d|\w)  is a valid expression, but and returns correct results in MC
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10942
Re: Expression Language Wiki
« Reply #44 on: June 08, 2020, 02:56:33 am »

Multiple capture groups return invalid results, but that may be a bug.

Multiple capture groups seem to work fine. I suppose it depends what you define as "invalid". We try to keep the output consistent, independent of the input string, so that eg. optional captures always get an empty entry in the resulting token list.
As a consequence of that, if you use alternate captures, you also get one entry for every alternate capture group, even though only one will ever be filled, since technically they act like optional captures. The solution is of course to move the alternate into the capture if you don't want that.

The alternative is to not actually fill in results for not-matched optional captures, however you wouldn't like that, since the returned indices no longer match their group position.
The regex engine does not differentiate between these situations, so its either the current behavior or skipping empty optional captures - which IMHO is worse, since that has no easy workaround.

Nested parenthesis create duplicate results, so one must avoid nested parenthesis.

This seems to be pretty normal behavior.
Throw any such regex at https://regex101.com/ or https://regexr.com/, and it shows you two captures of the same string, as will MC.

Do note that we are using ECMAScript Regex syntax, and not PCRE, which you seem to be under the misconception of.

Not returning results without a capture group is entirely intentional. In absence of any captures, we could return the entire matched string, but I feel like its better to explicitly request which part you want returned.

You seem to be representing the old Regex mode as entirely flawed and broken, but you should remove the "g" modifier from testing in other regex tools and you'll notice that it suddenly behaves quite in the same way.
One result per capture group.  Not enough string to fill all captures? You get nothing.
Logged
~ nevcairiel
~ Author of LAV Filters

wer

  • Citizen of the Universe
  • *****
  • Posts: 2640
Re: Expression Language Wiki
« Reply #45 on: June 08, 2020, 03:33:32 am »

Multiple capture groups seem to work fine. I suppose it depends what you define as "invalid".
See my post here for an example.  https://yabb.jriver.com/interact/index.php/topic,124543.msg870827.html#msg870827
I don't think returning a list with a bunch of empty elements is a good idea.  Someone might want to display it or use the resulting list for something else, and now you have an ugly hard to read list with a lot more elements than you had matches, and a lot more elements than can be used. I don't see the good in that.

Do note that we are using ECMAScript Regex syntax, and not PCRE, which you seem to be under the misconception of.

You seem to be representing the old Regex mode as entirely flawed and broken, but you should remove the "g" modifier from testing in other regex tools and you'll notice that it suddenly behaves quite in the same way.
One result per capture group.  Not enough string to fill all captures? You get nothing.
Well, your current usage was only recently revealed. I was foolish enough to believe what had been written in the forum and wiki, sorry.

Re entirely flawed and broken, not at all. It's good for lots of things. But it is problematic to use against a string when you want to get all the matches, but don't know how many matches there will be.
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10942
Re: Expression Language Wiki
« Reply #46 on: June 08, 2020, 03:37:24 am »

See my post here for an example.  https://yabb.jriver.com/interact/index.php/topic,124543.msg870827.html#msg870827
I don't think returning a list with a bunch of empty elements is a good idea.  Someone might want to display it or use the resulting list for something else, and now you have an ugly hard to read list with a lot more elements than you had matches, and a lot more elements than can be used. I don't see the good in that.

As I explained above, its an artifact of another feature which is good and has no workaround otherwise, and this is easy enough to work around by just moving a pipe character a bit. And actually the number of entries in the list matches the number of matches perfectly. You just don't count them the same way as the program does. :)

It literally cannot be "fixed" without making optional captures practically unusable.
Logged
~ nevcairiel
~ Author of LAV Filters

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Expression Language Wiki
« Reply #47 on: June 08, 2020, 04:46:21 am »

I almost had Char() added but stumbled... I messed around with it a bit...
Char(189) returns ½
\u25CF/ returns a syntax error
u25CF returns nothing

It only takes decimal values. 0x25CF = 9679 decimal, so Char(9679) works.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2619
Re: Expression Language Wiki
« Reply #48 on: June 08, 2020, 04:48:21 am »

Regarding the regex -2 multiple-captures, I think it's OK and desirable:
https://yabb.jriver.com/interact/index.php/topic,124543.msg870844.html#msg870844
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Expression Language Wiki
« Reply #49 on: June 08, 2020, 08:49:54 am »

https://wiki.jriver.com/index.php/List_Manipulation_Functions#ListMix

Last example is little strange.
Quote
ListMix(<img src=tooltip:actors\\[L1]> \ , 1, [Actors], 1;2;3;4;5)

    Returns (example): <img src=tooltip:actors\Daisy Ridley>  ;<img src=tooltip:actors\Adam Driver>  ;<img src=tooltip:actors\John Boyega>  ;<img src=tooltip:actors\Oscar Isaac>  ;<img src=tooltip:actors\Mark Hamill>

Shouldn't i be something like this instead
Code: [Select]
ListMix(<img src=tooltip:actors\[L1]>, 1, [Actors], 1;2;3;4;5)

Returns (example): <img src=tooltip:actors\Daisy Ridley>;<img src=tooltip:actors\Adam Driver>;<img src=tooltip:actors\John Boyega>;<img src=tooltip:actors\Oscar Isaac>;<img src=tooltip:actors\Mark Hamill>
(You could use also "[L1]>/  " to add those spaces but maybe it just add unnecessary complexity here were we illustrate functionaliy of ListMix)
Logged
Pages: [1] 2   Go Up