Populating a tag based on a word or string in another


I would like to know if there is a way to populate a tag based on a word or a string in another tag, either via regex or if statement.

eg. IF the ALBUM tag contains the word Soundtrack or the strings Best of or Greatest Hits, I would like to copy Soundtrack to the RELEASETYPE tag, or if ALBUM contains Best of or Greatest Hits populate RELEASETYPE with Best of / Greatest Hits Compilation Album, and if COMPILATION is checked, then populate RELEASETYPE with Various Artists Compilation, otherwise populate RELEASETYPE with Album.

You may create an action group with individual actions for each condition.
Use an action of the type "Format value" for the field RELEASETYPE with e.g. as
Format string: $if($eql(%compilation%,1),Various Artists Compilation,%releasetype%)

Or if a search string is only part of the total string:
Format string: "$ifgreater($strstr($upper(%album%),'BEST OF'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)

Could I use $if($eql(%compilation%,),Album,%releasetype%) to fill RELEASETYPE with Album, if %releasetype% is empty?

Have you tried it?

Ok, here is what I was able to do


$if($eql(%compilation%,1),Various Artists Compilation,%releasetype%)
$ifgreater($strstr($upper(%album%),'Best of'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)
$ifgreater($strstr($upper(%album%),'Greatest Hits'),0,'Best of / Greatest Hits Compilation Album',%releasetype%)

$ifgreater($strstr($upper(%album%),'Deluxe Edition'),0,'Deluxe Edition',%releaseedition%)
$ifgreater($strstr($upper(%album%),'Deluxe Version'),0,'Deluxe Version',%releaseedition%)

%album% (%releaseedition% %releasetype%)

The only thing I can't figure out is how to format: %album% [%releaseedition% %releasetype%]

These expression will hardly ever return a string as you compare an uppercase "BEST OF" with an ordinary "Best of" which will never match.
That is why I wrote

This applies to all expression where you use $upper().

Use Format value
Format string: %album% '['%releaseedition% %releasetype%']'

Is there any way to match the string case insensitive?

Well, you could transform both string parts with such a function:
$ifgreater($strstr($upper(%album%),$upper('Best of')),0,'Best of / Greatest Hits Compilation Album',%releasetype%)

But then again, you could write "Best of" in capitals straight away as "BEST OF" ... and that is what I did.

Never mind, I just removed the $upper test

I don't understand.
Like that you will get hits only for strings where the ALBUM contains the string "Best of". You will not get hits for "Best Of" and "best of" - the $upper() plus the comparison with an all-capitals string makes it a sort of case-insensitive comparison.

Is there a test I can use to append FEATARTIST or ALBUMFEATARTIST to ARTIST or ALBUMARTIST with feat. preceding the FEATARTIST/ALBUMFEATARTIST if the former is not null?

$if(%FEATARTIST%, ... then ..., ... else ...)

DD.20170113.1903.C ET

Yes, I understand if, then, else statements. But, what do I use for the then test... to test if it isn't empty?

The test will be done by the $if clause ...


... which means ...

If the tagfield FEATARTIST does exist by having some content in it, then append the content from FEATARTIST, else append nothing, to the tagfield ARTIST.

There is also an abbreviation ...

DD.20170113.1950.CET, DD.20170114.0545.CET

Is my understanding right that, if there is nothing explicitly entered in a tag, that that tag is not actually written to the file?

Yes, you are right.
One tagfield, which has no content, does not exist.
You can check this in the "Extended Tags..." view.


That worked perfectly, Thank you.

Now, to expand on that. Is there a way to test if there is a ' feat. ...' string in the TITLE and ALBUM, then move that string (not copy) minus the ' feat. ' part, to the FEATARTIST and ALBUMFEATARTIST tags?

There are many threads within the forum regarding the keyword "feat" or "featuring".
There is one to start reading ...

To find other threads ...