INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 4 5 6 7 [8] 9   Go Down

Author Topic: Expression functions [HELP WANTED]  (Read 62746 times)

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #350 on: July 29, 2021, 12:23:30 pm »

Could you give some examples of what you want to do before or after play?

And would the expression run on the playing file?

Would the expression run on every play, or only certain ones?

Keeping me thinking :)
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #351 on: July 29, 2021, 01:24:47 pm »

Coming next build:
NEW: Added the SetField(...) expression function.
NEW: Added an expression to be evaluated after playback to Options > Library & Folders.

Now you can set after every play!
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #352 on: July 29, 2021, 03:27:32 pm »

Could you give some examples of what you want to do before or after play?
Mostly setting custom fields, like customizing the Play count or increasing the Rating if a file gets played a lot.

Quote
And would the expression run on the playing file?
Yes.

Quote
Would the expression run on every play, or only certain ones?
All plays.

Quote
Keeping me thinking :)
Thanks for looking into it :)
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #353 on: July 29, 2021, 03:31:38 pm »

Coming next build:
NEW: Added the SetField(...) expression function.
NEW: Added an expression to be evaluated after playback to Options > Library & Folders.

Now you can set after every play!

Awesome  ;D

I would still prefer a generic Trigger/Event mechanism as described above, that you could extend with more triggers over time.
The OnFieldChanged trigger is particularly useful, for instance to add some logic that looks at the new value of field A and decides if/how to update field B based on that. To reduce the number of times it executes, it would need to be a per-field definition and it would only trigger if NewValue != OldValue.

The Exec() function would allow running external commands when something happens; for instance, to update the "now playing" on some 3rd party apps that don't have any other way, or change the screen display mode, or loading some external DSP config, starting some lightshow hardware, etc.
Logged

InflatableMouse

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3978
Re: Expression functions [HELP WANTED]
« Reply #354 on: July 29, 2021, 04:05:09 pm »

Coming next build:
NEW: Added the SetField(...) expression function.
NEW: Added an expression to be evaluated after playback to Options > Library & Folders.

Now you can set after every play!

Great to hear, thank you!

I would still prefer a generic Trigger/Event mechanism as described above ...(snip!)

I would love to see this too, especially combined with the setfield(). The question Zybex asked me, "where would you type the SetField() expression? How would it change the workflow?" had me thinking, its something I hadn't really thought about to be honest. Having to create a field for the sole purpose of doing some expression magic on other fields seems odd and counter intuitive. A trigger function would solve that when it can load the triggered expression from a file or something, it wouldn't have to sit in a field with no other purpose (it wont display anything by itself so you'd have an empty collumn in your view).

Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10925
Re: Expression functions [HELP WANTED]
« Reply #355 on: July 29, 2021, 04:16:40 pm »

I would still prefer a generic Trigger/Event mechanism as described above, that you could extend with more triggers over time.

We thought about something like this before, using an actual scripting language (maybe something lightweight like Lua, or maybe Python), because expressions are a huge crutch for something like this and are really not suited to actual logic. But its a big project with a very small user base. So maybe it'll happen sometime, or maybe not.

OnFieldChanged in particular would have to be taken with a loooot of care since field changes in some fashion can happen quite in bulk, quite often, as a result of many different processes, be rather performance sensitive .. etc. Its not a callback I would realistically suggest to make use of so lightly.
Logged
~ nevcairiel
~ Author of LAV Filters

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #356 on: August 02, 2021, 12:35:47 pm »

ListFilter(list, mode, minValue, maxValue) - Filter a list, returning only values between a given range

Mode:
0 - numeric
1 - string, case insensitive
2 - string, case sensitive

- MinValue/MaxValue can be blank (no minimum or maximum)
- Both can be empty as well for mode 0 - calling ListFilter(list, 0) returns only the numeric items in the list. For modes 1/2 however it doesn't make much sense, but perhaps it could return only the non-numeric values.

Usecase: https://yabb.jriver.com/interact/index.php/topic,130222.msg903386.html#msg903386

Edit: moved 'mode' to the 2nd arg.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #357 on: August 03, 2021, 02:12:19 pm »

Would ListFilter filter strings so you could return everything between Abba and Creedence?

And when it's numeric would the min and max be numbers?

It almost seems like ListFilterString and ListFilterNumber might be cleaner in that case.

And ListFilter in numeric mode with no filters would just return the numbers?  If a string was "a 1 b" what would it do?

Thanks.
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #358 on: August 03, 2021, 02:55:02 pm »

Would ListFilter filter strings so you could return everything between Abba and Creedence?
Yes (inclusive both ends, or add modes for inclusive/exclusive; or for min <= X < max (makes sense if you think about it)

Quote
And when it's numeric would the min and max be numbers?
Yes.

Quote
It almost seems like ListFilterString and ListFilterNumber might be cleaner in that case.
Up to you. I like a single function with modes though, more in line with the other functions.

Quote
And ListFilter in numeric mode with no filters would just return the numbers?  If a string was "a 1 b" what would it do?
Right. In your example it would not return anything because the string is alphanumeric.
ListFilter("a 1 b 6 2", 0)           => returns "" (value is not a number, not a list)
ListFilter("a;1;b;6;2", 0)           => returns "1;6;2"
ListFilter("a;1;b;6;2", 0, 2, 10)    => returns "6;2"

Quote
Thanks.
Thank you :)
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9133
Re: Expression functions [HELP WANTED]
« Reply #359 on: August 03, 2021, 03:15:13 pm »

and those above would work with raw date data because they are, in effect, just numbers, right?
The convertdate() expressions for min/max values would still be required to get those numeric values?

and... existing list order wouldn't matter either, right?

ListFilter("9;8;1;3;5;7;10;4;6;2", 0, 2, 10) would return: "9;8;3;5;7;10;4;6;2"

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #360 on: August 03, 2021, 03:19:07 pm »

Yes, raw dates are just numbers. Which reminds me, it needs to work with decimals/floats too.
Yes, you would need convertdate() to get the min/max values corresponding to given dates... or we could have a mode 2 which filters a list of formatted dates ;)
Yes, order doesn't matter and should be preserved.
Yes, your example is correct (assuming the default is to include min/max values, ie, a<=X<=b)
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9133
Re: Expression functions [HELP WANTED]
« Reply #361 on: August 03, 2021, 03:34:19 pm »

Nice to feel that even though I'm sitting up the back, I am paying attention ;)

In a couple of months time once the data has built up, this could get very interesting.
It's so good, I'll think about writing up a wiki page for it if it all pans out as expected.

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #362 on: August 04, 2021, 08:07:02 am »

Coming to the beta channel later today:
NEW: Added the ListFilter(...) expression function.

Just a note that parsing letters as a number array will just resolve to zero instead of not a number.  Our number array doesn't really understand not a number values, so it'll just be zero.

Thanks for the suggestion :)
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #363 on: August 04, 2021, 01:03:07 pm »

Cool, thanks :)
letters=0 is fine, it's how it works for most (all?) other functions anyway.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9133
Re: Expression functions [HELP WANTED]
« Reply #364 on: August 05, 2021, 01:05:53 am »

'tis working well. Thanks to you both.

I was poking around with it, seeing how it dealt with as many variations as I could think of, which threw up this question...
listfilter(1;2;3;4;5;a;b;c;d;e;6;7;8;9;10;A;B;C;D;E;1A;A1,0,1,3)
returns 1;2;3;1

Is that trailing "1" correct? I suppose, strictly speaking, it is, but, the list item is 1A.
It's only a test case. I have no real world items to test on, and don't really know what I expected, but know I didn't expect that :)
listfilter(1;2;3;4;5;a;b;c;d;e;6;7;8;9;10;A;B;C;D;E;1A;A1,1,A,B) returns A;B;A1 which seems fine to me.

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #365 on: August 05, 2021, 03:11:10 am »

Right, I would expect 1A to be ignored. Looks like the function uses sscanf() to extract values, which also works on mixed strings like that. It should first validate if it's a pure number with some sort of isFloat() check.

I found a few other issues with ListFilter(), here's the full list so far:

1. (Marko's finding) Mixed strings starting with a number are accepted, should be ignored in numeric mode:
listfilter(1;2;3A, 0) = "1; 2; 3"    (expected "1;2")

2. it's returning a list with spaces between items - most/all other functions now don't do that
listfilter(1;2;3, 0)  = "1; 2; 3"     (expected "1;2;3")

3. Because strings are evaluated as zero, it returns 0 for non-numeric items if the minValue is not present or includes 0:
listfilter(1;2;A;3, 0) = 1;2;0;3    (expected the zero to be absent)

4. String filtering is not case-sensitive (I think it should not be, or there should be a mode for it):
listfilter(Action;Test;Ball, 1, a, f) = <blank>   (expected "Action;Ball")

5. String filtering uses a non-standard comparison (char by char?), returning more items than expected:
listfilter(Action;Test;Ball, 1, A, B) = "Action;Ball"   (expected only "Action", because "Ball">"B")

Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10925
Re: Expression functions [HELP WANTED]
« Reply #366 on: August 05, 2021, 03:19:23 am »

I think #5 is easier to understand that way for anyone not super technically inclined. "I want everything from A to B" seems like a trivial question, without knowing the intricacies of string comparisons.
Thoughts? What kind of use-case would the other method favor?
Logged
~ nevcairiel
~ Author of LAV Filters

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9133
Re: Expression functions [HELP WANTED]
« Reply #367 on: August 05, 2021, 06:48:45 am »

I definately prefer the #5 way as it is at the moment.
Before posting this morning, I was doing some testing using my image keywords field. Specifically, testing using some strings rather than just letters...
listfilter([Keywords], 1, Ac, Br)  would skip Aardvark, returning everything from Acorn to Bridges. All made perfect sense to me :P :D

#4
When I added this to the wiki this morning, I reported that it was case sensitive. It's doing something odd for sure...

listfilter(Action;Test;Ball, 1, A, f) ---> Action;Test;Ball
listfilter(Action;Test;Ball, 1, A, F) ---> Action;Ball
listfilter(Action;Test;Ball, 1, a, F) ---> <Blank>
listfilter(Action;Test;Ball, 1, a, f) ---> <Blank>

Examples 2 & 4 return, for me, expected results that show case sensitivity in operation.
The returns from examples 1 & 3 don't make any sense to me, and again, I didn't know what to expect before I pressed OK. Often the understanding comes from "I wonder what it'll do if I do that...", just not in this case :)

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #368 on: August 05, 2021, 07:27:02 am »

Sorry, I meant to say that it IS case sensitive and I think it should not be, or should have 2 modes to select.
The examples you tried are OK - the uppercase letters come before the lowercase ones in the ASCII table, so their value is lower. So 'A' < 'a' for a computer, and Zebra < banana. This is why I think we need a case-insensitive mode.

Regarding #5, I'm overruled and that's fine.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #369 on: August 05, 2021, 07:42:11 am »

ListFilter(...) is using case-sensitive string comparisons now, but I can't think why you'd ever want that.  So I'll switch it for the next build.
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #370 on: August 05, 2021, 07:46:31 am »

I also got this one for the next build:
Changed: Removed the space from the ListFilter(...) delimiter.

Thanks for testing.
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #371 on: August 05, 2021, 01:50:33 pm »

Logged
Matt Ashland, JRiver Media Center

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #372 on: September 01, 2021, 11:10:53 am »

I can tell you the feature I'd like to see and that would also fill your requirement... I've been thinking about this for a while. It could be an MC29 major feature :)

Action Triggers:
- User-defined expressions that get executed when MC does some action on a file
- The expressions could be defined in a XML file, or a specific UI could be added to MC to manage them
- Triggers: BeforePlay, AfterPlay, AfterImport, AfterFieldUpdate, OnViewChange, AfterStartup, BeforeExit, ... (more triggers could be added over time)
- multiple expressions could be defined for same trigger
- A SetField() function would be available on these triggers; this would allow changing fields when the trigger event occurred
- An Exec() function would also be nice to start some external process on these triggers (including MCC commands)
- "AfterFieldUpdate" would take an arg to specify which field would trigger it; user could define triggers for different fields
- Some special vars could provide the [PreviousValue], [NewValue] and [FieldName] on the AfterFieldUpdate trigger
- Using a SetField() on an AfterFieldUpdate event could trigger another expression on a different field... so MC would need to prevent update loops.

Any comment Matt?  :)

Yes, please to all of the above.

Corrected that for you  8) ::) ;D

On a more serious note, I thought about suggesting macro's that could run with a hotkey or on a schedule or something. Your action triggers are much better though!

Its a really cool idea!

Why not both? ;)

And if we really wanted to get ambitious for MC29 (ok, maybe 30), then we start clamouring for a full UI that allows for users to share Actions that can be applied on a per-file basis using MCs search language rules and run either automatically from an Action Trigger or a user-defined hotkey. :D
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #373 on: September 29, 2021, 07:58:06 am »

Bump for any more ideas.  Thanks.
Logged
Matt Ashland, JRiver Media Center

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #374 on: September 29, 2021, 12:09:56 pm »

A couple of things I've been really wishing for:

FieldQuery: Some way to perform AND lookups. For example FieldQuery(Series;Season, [Series];1, Date, 1, 2) is an expression I was hoping would return the dates from all files from the same series, but from season 1. Since this does an OR, the results are not what I'm looking for. Not sure if there's another way to do this or not.

I'd really love someway to do a lookup of another file's fields by referencing a filename or filekey. Something like FieldLookup(filekey, fieldname)

And I'd like to again throw my vote in for something like the after-playback expression but for imports. All of the Action Triggers zybex mentions above, really, but I have a specific need for after-import.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #375 on: September 29, 2021, 12:19:05 pm »

Quote
I'd really love someway to do a lookup of another file's fields by referencing a filename or filekey. Something like FieldLookup(filekey, fieldname)

Perhaps as a 3rd argument to Field() ? If FileKey is not given, then it's the current file:
Field(name, mode, fileKey)

Logged

leezer3

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1587
Re: Expression functions [HELP WANTED]
« Reply #376 on: September 29, 2021, 12:21:09 pm »

Something simple that would be *really* useful here:
The RemoveLeft, RemoveRight etc. functions require a field name.

Change it so that if no field name is supplied, they operate on the current field.
At present, the following: =RemoveLeft(10)
will replace all contents of the field with 10. Similar occurs if we've got a misplaced bracket or something, it just dumps random text into the field, presumably something to do with where it is in the expression tree?
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #377 on: September 29, 2021, 12:28:05 pm »

Perhaps as a 3rd argument to Field() ? If FileKey is not given, then it's the current file:
Field(name, mode, fileKey)


Works for me!
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #378 on: September 29, 2021, 01:21:41 pm »

Change it so that if no field name is supplied, they operate on the current field.
At present, the following: =RemoveLeft(10)

This is likely not possible. As an alternative, what about adding a special field called [this] ?
=removeLeft([this], 10)

If there's no current field in the execution context, [this] would be empty or not replaced (invalid usage).
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #379 on: September 29, 2021, 01:36:56 pm »

Something simple that would be *really* useful here:
The RemoveLeft, RemoveRight etc. functions require a field name.

Change it so that if no field name is supplied, they operate on the current field.
At present, the following: =RemoveLeft(10)
will replace all contents of the field with 10. Similar occurs if we've got a misplaced bracket or something, it just dumps random text into the field, presumably something to do with where it is in the expression tree?

I know about a current file, but not a current field.  Could you explain what you mean?

Thanks.
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #380 on: September 29, 2021, 01:37:20 pm »

Also, I'm working on this today:
Changed: Made the Field expression function take an optional third parameter to specify a file key (defaults to empty which evaluates the current file).
Changed: The brackets for fields also support the new third parameter.
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #381 on: September 29, 2021, 01:40:08 pm »

I know about a current file, but not a current field.  Could you explain what you mean?

Thanks.

when an expression is entered on the Tag Editor (or Details View grid) and starts with = , the current field is the field the user is editing.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #382 on: September 29, 2021, 01:49:57 pm »

I'm working on this too for the next build:
NEW: When setting a field to an expression, a "this" variable is saved so doing something like =RemoveLeft([this], 3) will work.

Thanks for the suggestion :)
Logged
Matt Ashland, JRiver Media Center

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #383 on: September 29, 2021, 01:51:39 pm »

What happens if you already have a field called [this]?
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #384 on: September 29, 2021, 01:52:36 pm »

Also, I'm working on this today:
Changed: Made the Field expression function take an optional third parameter to specify a file key (defaults to empty which evaluates the current file).

First, YAY!!!

Second, what does this mean?

Quote
Changed: The brackets for fields also support the new third parameter.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #385 on: September 29, 2021, 01:52:59 pm »

What happens if you already have a field called [this]?

If you have a field called "this" all heck will break loose!  Honestly I think the expression engine would load the "this" field before a user "this" field, so it's probably fine!
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #386 on: September 29, 2021, 01:53:47 pm »

Second, what does this mean?

This works:
[Name, 1, 543343]

You can call out the file key using brackets or the function.
Logged
Matt Ashland, JRiver Media Center

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #387 on: September 29, 2021, 01:55:16 pm »

I don't actually have a field called [this], but just curious what the impact would be.

Would something like =RemoveLeft([], 3) be safer? Where empty field name implies current field?
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #388 on: September 29, 2021, 01:55:45 pm »

This works:
[Name, 1, 543343]

You can call out the file key using brackets or the function.

AH! That's amazing!
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #389 on: September 29, 2021, 02:16:57 pm »

What happens if you already have a field called [this]?
Rename it to [that]  ;D
Logged

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Expression functions [HELP WANTED]
« Reply #390 on: September 30, 2021, 01:33:51 pm »

Food for thought. What if counter() can be change from counting items each time you pass over the field. Like 0 to be default, 1 it counts the items in a list or playlist without changing the number (ex. 1, 2, 3, 4, etc.) and 2 maybe to count as tens and 3 counting as hundreds. Changing this it will help in playlist chart where each a song change the position in the chart but not the number given to that song in playlist.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #391 on: September 30, 2021, 02:58:21 pm »

Food for thought. What if counter() can be change from counting items each time you pass over the field. Like 0 to be default, 1 it counts the items in a list or playlist without changing the number (ex. 1, 2, 3, 4, etc.) and 2 maybe to count as tens and 3 counting as hundreds. Changing this it will help in playlist chart where each a song change the position in the chart but not the number given to that song in playlist.

Counter already supports setting the start number and the increment.

Is there more it needs?

Counter(1000, 100) starts at 1000 and counts by 100.
Logged
Matt Ashland, JRiver Media Center

SkGe

  • Galactic Citizen
  • ****
  • Posts: 433
Re: Expression functions [HELP WANTED]
« Reply #392 on: September 30, 2021, 03:12:07 pm »

Well I didn't know that but reading more carefully it seems so, so yeah. But it is possible if counter() don't increase the number but have a fix one. If let say I have a playlist with 30 songs and I use the counter() in that playlist each time you cross over that song, the number change by design.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #393 on: September 30, 2021, 03:29:13 pm »

Sounds like you want a Sequence number.
There's this obscure function:
Code: [Select]
customData(#)
If you want increments of 10, just multiply it:
Code: [Select]
Math(10*customData(#))
This probably only works on playlists, not Views.
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #394 on: September 30, 2021, 04:30:10 pm »

Counter already supports setting the start number and the increment.

Is there more it needs?

Counter(1000, 100) starts at 1000 and counts by 100.

MOD?

Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #395 on: October 01, 2021, 08:56:04 am »

MOD?

101 mod 10 = 1

Is that what you mean?  A Mod(...) expression function?
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2591
Re: Expression functions [HELP WANTED]
« Reply #396 on: October 01, 2021, 09:09:14 am »

Math(101 % 10) does that.

I choose to believe that Doof meant MOD as "n. : a Highland meeting for Gaelic literary and musical competitions."  ;D
Logged

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #397 on: October 01, 2021, 09:55:15 am »

Sorry, I meant like a MOD parameter inside Counter() to get it to do stuff like count up to a certain number and then reset back to start. I'm not entirely sure I actually have a use for it though, to be honest.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42344
  • Shoes gone again!
Re: Expression functions [HELP WANTED]
« Reply #398 on: October 01, 2021, 10:07:35 am »

Sorry, I meant like a MOD parameter inside Counter() to get it to do stuff like count up to a certain number and then reset back to start. I'm not entirely sure I actually have a use for it though, to be honest.

It was easy, so next build:
Changed: Added an optional third parameter to the Counter expression function to set when to start over.
Logged
Matt Ashland, JRiver Media Center

Doof

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 5908
  • Farm Animal Stupid
Re: Expression functions [HELP WANTED]
« Reply #399 on: October 01, 2021, 10:59:00 am »

Lol, I think I'm having more fun experimenting with expressions than I am watching any of my content.

This reminds me of a question I've been meaning to ask. Does anybody actually use the more advanced Math functions like sin, cosin, atan, etc? If so, I'd be really curious to see what use people have found for them.
Logged
Pages: 1 ... 4 5 6 7 [8] 9   Go Up