Author Topic: Help needed with the virtual tag functions  (Read 2715 times)

DQ

  • Jr. Member
  • **
  • Posts: 20
Hello

I'm trying to create a virtual tag that combines the album artist with the album name (for reorganizing my files). But sometimes the name of the artist is already in the album name (e.g. 'Shania Twain - Greatest hits') and in that case I don't want to repeat the name. So I've been trying to create a tag that checks if the name of the album starts with the name in the 'album artist' field.
So at first I tried $left(<Album>,$len(<Album Artist>)) but that resulted in a FAIL @ " Artist>)).
After some testing I came to the conclusion that the $left function doesn't accept another function as second parameter.
So I tried with $RxMatch(<Album>,"^<Album Artist>") but that never gave a match. And when I try $RxMatch(<Album>,"^"<Album Artist>) I get another FAIL @ "m Artist>.
And if I do a $RxReplace(<Album>,^<Album Artist>,"MATCH") (just to test), it adds 'MATCH' in front of every title so it seams to match everything.
So now I'm wondering: Am I doing something wrong or does MusicBee just doesn't accept other functions or fields for the second, third... parameter?
If so, are there any plans to change that?
In the mean time, does somebody know a workaround. Basically I want
'Shania Twain' + 'Shania Twain - Greatest hits' to give ''Shania Twain - Greatest hits'
and
'Bryan Adams' + 'The best of me' to give 'Bryan Adams - The best of me'

Is there somewhere where I can find a complete list of functions? I've found this page on the forum but it is a little outdated and in MusicBee itself there also seem functions to be missing from the dropdown (e.g. $and and $or)
Any help is appreciated.

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
Welcome to the forum DQ.

Without having digested the full content of your post/question, your solution may be found in the second part of the sentence that can be found on the wiki page that you referenced:
"Basic criteria takes the form of <Tag>=Value or <Tag1>=<Tag2>."

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
Basically I want
'Shania Twain' + 'Shania Twain - Greatest hits' to give ''Shania Twain - Greatest hits'
and
'Bryan Adams' + 'The best of me' to give 'Bryan Adams - The best of me'

Code
$If($Contains(<Album>,<Album Artist>),T,F)
Just change "T" and "F" to the output you desire.

DQ

  • Jr. Member
  • **
  • Posts: 20
Hello Hiccup and Boom Boom

Thanks for the welcome. I've already seen and learned a lot of posts from the both of you.

@Hiccup: I know about the $if, but the problem is in creating the criterium. If the $left() would accept the $len() as second argument, my problem would be solved.
But it appears this is not supported.

@Boom Boom. That would not give me exactly what I want because 'ABBA' + 'The best of ABBA' would not give me 'ABBA - The best of ABBA'. I only want to suppress the name if it is already in the beginning of the album name.

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
I'm sorry, I didn't read your original post very well, and my reply was useless.

So at first I tried $left(<Album>,$len(<Album Artist>)) but that resulted in a FAIL @ " Artist>)).
After some testing I came to the conclusion that the $left function doesn't accept another function as second parameter.

I see that you are right about that not working.
Perhaps you could create a wish post for this to be possible?

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
@Boom Boom. That would not give me exactly what I want because 'ABBA' + 'The best of ABBA' would not give me 'ABBA - The best of ABBA'. I only want to suppress the name if it is already in the beginning of the album name.

You could probably avoid that with a small modification:

Code
$If($Contains(<Album>,<Album Artist>" ")="T",<Album>,<Album Artist> - <Album>)
Does this work?

The Incredible Boom Boom

  • Sr. Member
  • ****
  • Posts: 1269
@Boom Boom. That would not give me exactly what I want because 'ABBA' + 'The best of ABBA' would not give me 'ABBA - The best of ABBA'. I only want to suppress the name if it is already in the beginning of the album name.

You could probably avoid that with a small modification:

Code
$If($Contains(<Album>,<Album Artist>" ")="T",<Album>,<Album Artist> - <Album>)

Or...
Code
$If($Left($Replace(<Album>,<Album Artist>,~~~),3)="~~~",T,F)

But, I agree that...

So at first I tried $left(<Album>,$len(<Album Artist>)) but that resulted in a FAIL @ " Artist>)).
After some testing I came to the conclusion that the $left function doesn't accept another function as second parameter.

I see that you are right about that not working.
Perhaps you could create a wish post for this to be possible?

...would be more ideal and I would +1 such a request.

DQ

  • Jr. Member
  • **
  • Posts: 20
Hello Boom Boom,
Great suggestion. I should have thought of that one myself. It gives me mostly what I want. Now I just have to twitch it for some edge cases (no album artist for example) or albums with artists like 'Mozart, Wolfgang Amadeus'
@Hiccup: Thanks for your suggestion too, unfortunately it fails on an album such as 'In 27 Pieces - The Hilary Hahn Encores'

P.S. I've introduced a wish for allowing things like $left(<Album>,$len(<Album Artist>))
P.S.2 Steven, If you ever read this: Take good care of members like these. What makes a great product even greater is the support.

hiccup

  • Sr. Member
  • ****
  • Posts: 7790
Nice teamwork everyone.

I was expecting you would want to have the album artist always mentioned at the beginning of the virtual tag, unless it was repeated back-to-back.
That would be useful for e.g. sorting purposes.

But as this shows, we all have our own particulars and preferences, and MusicBee is generous in making it possible to achieve them ;-)