Author Topic: MusicBee functions for virtual tags cheatsheet  (Read 49297 times)

hiccup

  • Hero Member
  • *****
  • Posts: 9107
This suggests that these functions can have more than two criteria, i.e. you can use something like:
Code
$If($Or($Contains(<Title>,the)="T",$Contains(<Title>,an)="T"),$Contains(<Title>,you)="T"),yep,nope)
However on trying this, things go a little doolally: Although the template editor does not flag an error and you can save this formula, the output is incorrect and, on returning to the virtual tag formula, it has become messed up.
The opening and closing brackets in that formula don't match.
This should work?:
Code
$If($Or($Contains(<Title>,the)="T",$Contains(<Title>,an)="T",$Contains(<Title>,you)="T"),yep,nope)

tjinc

  • Sr. Member
  • ****
  • Posts: 823
Sorry, that was careless copy and paste from me.
However I do still see the issue.

Weirdly, on copying your code, saving and then returning to the editor the code has been altered to:
Code
$If($Or($Contains(<Title>,the)="T",$Contains(<Title>,an)="T,"$Contains(<Title>,you)=T),yep,nope)

hiccup

  • Hero Member
  • *****
  • Posts: 9107
Weirdly, on copying your code, saving and then returning to the editor the code has been altered to:
Code
$If($Or($Contains(<Title>,the)="T",$Contains(<Title>,an)="T,"$Contains(<Title>,you)=T),yep,nope)
Yes, I see that too now.
Strange, MusicBee seems to trip over additional conditions.
I'm not sure if it used to work in the past, or if it is intended to work to begin with.
I'll post this in Bugs to see what's what.


tjinc

  • Sr. Member
  • ****
  • Posts: 823
Thanks for following this up hiccup.

From Steven's response it would seem that both these functions ($And, $Or) will only allow for two criteria. Not the end of the world as there are other ways of achieving the same result.

tjinc

  • Sr. Member
  • ****
  • Posts: 823
A couple of 'time and date' functions I have stumbled across recently (provided by the AT&RT plugin) that don't appear to be documented here:

$Seconds(duration)
converts a duration to its value in seconds

$DurationFromSeconds(value-in-seconds)
converts a value in seconds to a duration (d.hh:mm:ss)

hiccup

  • Hero Member
  • *****
  • Posts: 9107
A couple of 'time and date' functions I have stumbled across recently (provided by the AT&RT plugin) that don't appear to be documented here:
Thanks for reporting tjinc.

I also still need to update it concerning the updated way the capitalisation functions work these days.
But editing the gigantulous BBcode that is behind these post is no fun at all.
I'll do it when I have gathered some courage. (and when I am not enjoying a Sunday afternoon beer)
Last Edit: November 03, 2024, 02:20:09 PM by hiccup

karbock

  • Sr. Member
  • ****
  • Posts: 549
In the original post, under "boolean", the syntax example for Not should be:

$If($Not(<field1>=<field2>),true-value,false-value)
$If($Not(boolean_condition),true-value,false-value)

Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34974
In the latest v3.6 patch i have added tab formatting so multiple values can be displayed in a virtual tag aligned as columns eg.
Code
<title>{tab: 100}<artist>{tab:180}<album>
where n is the number of pixels from the left hand side (not number of pixels since last tab)

boroda

  • Hero Member
  • *****
  • Posts: 5171
$MulDuration(<Time>,<Play Count>)

Where duration can be either defined as literal (eg. 00/00/0001 means 1 year, 5:00 means 5 mins, 00/01/0000 10:05:15 means 1 day 10 hours 5 mins 15 secs, etc.)
or it can be obtained by subtracting two dates or two times. (or two datetimes in general)


hiccup, i was initially wrong about format of duration literals. i've corrected this mistake in my documentation (plugin help file and readme on add-on page), but forgot to remind you to do the same. correct duration format is: dddddd.hh:mm:ss

hours, mins. and secs. must have leading zeros. numbers of days must not, only actual  number of days, e.g. 120.02:12:05 means 120 days 2 hours 12 mins. and 5 secs.

-----------

maybe there are more places in your cheatsheet, where duration format description is wrong, not sure.
Last Edit: March 01, 2025, 11:16:30 AM by boroda

hiccup

  • Hero Member
  • *****
  • Posts: 9107
hours, mins. and secs. must have leading zeros. numbers of days must not, only actual  number of days, e.g. 120.02:12:05 means 12 days 2 hours 12 mins. and 5 secs.
Thanks, I will update it. (probably this weekend)

hiccup

  • Hero Member
  • *****
  • Posts: 9107
updated


A couple of 'time and date' functions I have stumbled across recently (provided by the AT&RT plugin) that don't appear to be documented here:
$Seconds
$DurationFromSeconds

Thanks tjinc, they have been added.



In the original post, under "boolean", the syntax example for Not should be:
$If($Not(<field1>=<field2>),true-value,false-value)
$If($Not(boolean_condition),true-value,false-value)

Thanks karbock. I don't think there was something technically wrong with how it was phrased, but your suggestion will surely be more helpful to users.


In the latest v3.6 patch i have added tab formatting so multiple values can be displayed in a virtual tag aligned as columns…

Added, including an example.



hiccup, i was initially wrong about format of duration literals. i've corrected this mistake in my documentation…
maybe there are more places in your cheatsheet, where duration format description is wrong, not sure.

I have changed it and have restructured things regarding date/time/duration a bit.
I'm not completely confident that it's all good now, so it would be good if you could take an eagle-eye look at it?


edit:
I forgot to mention that I also updated explanations and examples for the $SentenceCase and $TitleCase functions.
Last Edit: March 03, 2025, 10:48:40 PM by hiccup

boroda

  • Hero Member
  • *****
  • Posts: 5171
[/b]
hiccup, i was initially wrong about format of duration literals. i've corrected this mistake in my documentation…
maybe there are more places in your cheatsheet, where duration format description is wrong, not sure.

I have changed it and have restructured things regarding date/time/duration a bit.
I'm not completely confident that it's all good now, so it would be good if you could take an eagle-eye look at it?


edit:
I forgot to mention that I also updated explanations and examples for the $SentenceCase and $TitleCase functions.

thanks, will read updated cheatsheet right now.

boroda

  • Hero Member
  • *****
  • Posts: 5171
OK, @hiccup, i've read updated descriptions. you've correctly described AT&RT VT functions except for this one:


example:
$Seconds(<Time>)
(will e.g. output '210' for a track with a duration of 3:30 min/sec

(the tag containing the) 'duration' may contain yyyy/mm/dd and/or hh:mm:ss information

not "yyyy/mm/dd and/or hh:mm:ss" but "dddddd.hh.mm.ss" where the leftmost parts of duration are omitted if they are 0, and the leftmost leading zero may be omitted. it seems that you've correctly described duration literal format in all other places.

Also:

$AddDuration(duration1,duration2)

returns the sum of two durations.

here and in the most other date/time or duration function descriptions i would add result format, e.g.:

Quote
returns the sum of two durations as duration.

this may be obvious for this function, but not for some others.

And i would add examples for these functions for "Lirycs" tag (because <Lirycs> tag is unavailable in MB):

Quote
$TagContainsAnyString(<URL>,tag_name,string1|string2|etc.)

checks if a tag contains any of the strings separated by |
Returns 'T' or 'F' (true or false)

Example:

$TagContainsAnyString(<URL>,Lirycs,water|river)


$TagContainsAllStrings(<URL>,tag_name,string1|string2|etc.)

checks if a tag contains all the strings separated by |
Returns 'T' or 'F' (true or false)

Example:

$TagContainsAllStrings(<URL>,Lirycs,water|river)


Note that these functions require <URL> to be kept as is, and the name of the tag of your choice should not be surrounded by < >

hiccup

  • Hero Member
  • *****
  • Posts: 9107
OK, @hiccup, i've read updated descriptions.
Thanks boroda,
(I think) I have implemented all your suggestions.
(but you may want to check things to make sure)

Also, the structure has been modified a little bit, and some links that were broken have been fixed.

And:
A request to anyone that uses this cheat-sheet and found it did not explain things clearly enough, or it lacked some useful examples for certain functions:
Please report and share your suggestions for improvement?
Last Edit: March 07, 2025, 06:38:08 PM by hiccup

Pickles7853

  • Full Member
  • ***
  • Posts: 151
Nice job hiccup!
I have read and re-read this more times than I can count.  Usually looking for a specific function.
I did though run across a small typo.  Thought I should point it out so it could be corrected.
No need to reply back... thanks for all the hard work...

Quote
$TagContainsAllStrings(<URL>,tag_name,string1|string2|etc.)

checks if a tag contains all the strings separated by |
Returns 'T' or 'F' (true or false)

example:
$TagContainsAnyString(<URL>,Lyrics,water|river)
returns 'T' if the lyrics contains both 'water' and 'river'