Using TAG in actions/combining actions for different tags

Working code:

[#0]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (Album)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

[#1]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (Digital Album)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

[#2]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (EP)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

[#3]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (LP)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

[#4]
T=7
F=$REPLACE(%ALBUM% \u003d\u003d\u003d %_FILENAME%,' (Single)',)
1=%ALBUM% \u003d\u003d\u003d %_FILENAME%

I can see that. :slightly_smiling_face:
But user @sheepdisease was trying to apply your examples to "guess value", so the lesson was for him.
I was just trying to end the misery of this thread. :wink:

Amen!

1 Like

What I really want to do is combine the code used to change case of multiple tags with the combine code to ALBUMARTIST, ARTIST & ARTISTS so that I do not have to add duplicate words to multiple lists.

Guess values:
$replace(%ALBUMARTIST% === %ARTIST% === %ARTISTS%,'^(abba|adda|absrdst|acdc|ac dc|akdong musician|bkpr|blk jks|bts|chllngr|chvrches|chll pll|dfrnt|diiv|dmc|dnce|drwn|dtcv|dwntwn|dvsn|dvsr|exo-k|grmln|haim|htrk|hxlt|inxs|jmsn|jpnsgrls|kaytranada|kda|kshmr|ladybaby|lany|lee hi|lndn drgs|lnzndrf|lvthn|mgmt|mika|mnek|mndrmnek|ms mr|mstrkrft|n sync|nsync|partynextdoor|pwr bttm|pza|rdgldgrn|rkcb|rlyr|rÜfÜs du sol|rvivr|ry x|sbtrkt|shxcxchcxsh|sophie|stnnng|strfkr|swmrs|tnght|tr/st|tts|tstr|walk the moon|wzrd|u2|u-kiss|unkle|wstrn|xtrmst|zayn)$',$upper(%ALBUMARTIST% === %ARTIST% === %ARTISTS)

String:
%ALBUMARTIST% === %ARTIST% === %ARTISTS%

Is this correct? It doesn't seem to work in tag > tag or actual action use but I don't know why.

I've been working through the code. I can properly implement one list using the fields ALBUMARTIST, ARTIST, ARTISTS & TITLE but executing this correctly has not yet been achieved.

Guess values
$replace(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%,'^(abba|adda|absrdst|acdc|ac dc|akdong musician|bkpr|blk jks|bts|chllngr|chvrches|chll pll|dfrnt|diiv|dmc|dnce|drwn|dtcv|dwntwn|dvsn|dvsr|exo-k|grmln|haim|htrk|hxlt|inxs|jmsn|jpnsgrls|kaytranada|kda|kshmr|ladybaby|lany|lee hi|lndn drgs|lnzndrf|lvthn|mgmt|mika|mnek|mndrmnek|ms mr|mstrkrft|n sync|nsync|partynextdoor|pwr bttm|pza|rdgldgrn|rkcb|rlyr|rÜfÜs du sol|rvivr|ry x|sbtrkt|shxcxchcxsh|sophie|stnnng|strfkr|swmrs|tnght|tr/st|tts|tstr|walk the moon|wzrd|u2|u-kiss|unkle|wstrn|xtrmst|zayn)$,$upper(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%)

String:
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%

I am currently testing this code in convert tag > tag and it doesn't force uppercase on the band names mentioned, despite this being specified at the end $upper(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%).

As usual, I forced lowercase on everything first to test.

This is the preview:

A:\Music\Record\Inxs\kick\1 guns in the sky.mp3
  "Inxs === Inxs ===  === Guns in the Sky" ->
  "inxs === inxs ===  === guns in the sky"

A:\Music\Record\Inxs\kick\10 kick.mp3
  "Inxs === Inxs ===  === Kick" ->
  "inxs === inxs ===  === kick"

A:\Music\Record\Inxs\kick\11 calling all nations.mp3
  "Inxs === Inxs ===  === Calling All Nations" ->
  "inxs === inxs ===  === calling all nations"

A:\Music\Record\Inxs\kick\12 tiny daggers.mp3
  "Inxs === Inxs ===  === Tiny Daggers" ->
  "inxs === inxs ===  === tiny daggers"

A:\Music\Record\Inxs\kick\2 new sensation.mp3
  "Inxs === Inxs ===  === New Sensation" ->
  "inxs === inxs ===  === new sensation"

A:\Music\Record\Inxs\kick\3 devil inside.mp3
  "Inxs === Inxs ===  === Devil Inside" ->
  "inxs === inxs ===  === devil inside"

A:\Music\Record\Inxs\kick\4 need you tonight.mp3
  "Inxs === Inxs ===  === Need You Tonight" ->
  "inxs === inxs ===  === need you tonight"

A:\Music\Record\Inxs\kick\5 mediate.mp3
  "Inxs === Inxs ===  === Mediate" ->
  "inxs === inxs ===  === mediate"

A:\Music\Record\Inxs\kick\6 the loved one.mp3
  "Inxs === Inxs ===  === The Loved One" ->
  "inxs === inxs ===  === the loved one"

A:\Music\Record\Inxs\kick\7 wildlife.mp3
  "Inxs === Inxs ===  === Wildlife" ->
  "inxs === inxs ===  === wildlife"

A:\Music\Record\Inxs\kick\8 never tear us apart.mp3
  "Inxs === Inxs ===  === Never Tear Us Apart" ->
  "inxs === inxs ===  === never tear us apart"

A:\Music\Record\Inxs\kick\9 mystify.mp3
  "Inxs === Inxs ===  === Mystify" ->
  "inxs === inxs ===  === mystify"

Real testing of an action using the same code produces the same outcome of essentially what you would expect from '$caps' which I find very strange.

How I expect this works:

Action:
$replace

Search for the following fields:
(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%,

Within those fields, find any instance of the words (^$ start and end for exact matches in case made up of several words):
'^(abba|adda|absrdst|acdc|ac dc|akdong musician|bkpr|blk jks|bts|chllngr|chvrches|chll pll|dfrnt|diiv|dmc|dnce|drwn|dtcv|dwntwn|dvsn|dvsr|exo-k|grmln|haim|htrk|hxlt|inxs|jmsn|jpnsgrls|kaytranada|kda|kshmr|ladybaby|lany|lee hi|lndn drgs|lnzndrf|lvthn|mgmt|mika|mnek|mndrmnek|ms mr|mstrkrft|n sync|nsync|partynextdoor|pwr bttm|pza|rdgldgrn|rkcb|rlyr|rÜfÜs du sol|rvivr|ry x|sbtrkt|shxcxchcxsh|sophie|stnnng|strfkr|swmrs|tnght|tr/st|tts|tstr|walk the moon|wzrd|u2|u-kiss|unkle|wstrn|xtrmst|zayn)$,

Any word listed above found in any of these fields should be forced to UPPER case:
$upper(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%)

If my understanding is correct, then I am not sure why this isn't functioning correctly.

You already got the answer to this absolutely invalid syntax example in

This code has been updated since you responded originally. I have removed any reference to filename or directory. I have explained that I have tested it using convert, as I did in my original reply to you.

%ARTISTS% is a field added by Itunes if I recall correctly. Would that cause a problem if a particular file doesn't contain that field?

So what exactly is wrong with this?

that is what is wrong with it.

The original code proposed was:

Guess value:
Source: $replace('%title% === %ALBUM%','[','(',']',')')
Target: %title% === %album%

Corrected by @LaurenBacall
Guess value:
Source: $replace(%title% === %ALBUM%','[','(',']',')')
Target: %title% === %album%

I have tried to adapt this for other actions.

So which part is incompatible with Guess value in the adaptation I have published? Is a regular replace a problem vs regex replace for guess value? Which parts constitute what?

It has nothing to do with "Guess value" but the way that you fill the $-function.
Guess value is more or less the function Convert>Filename-Tag only that you do not have to use the filename but can use any string that you want.
So, what happens is:
You compose a string from fields like ARTIST, ALBUMARTIST, TITLE, ALBUM.
You then apply the function like $upper(), $caps(), $replace() etc. to this string.
And finally, in the target string you define how the string should be split again.
And to make the splitting as easy as possible, the original string got unique separators, I like the ===.
My original code for $replace() was correct, as it had the string to be scanned through and then pairs of search terms and replace terms, in this case brackets.
This is the correct syntax for $replace().
$replace() does not use ^, $, | etc. as the meta-characters, it uses them as literals.
So I wonder which artist of yours is called ^(abba....)$
You have to decide now which function you want to use: $replace() or $regexp()

1 Like

Thank you for explaining this properly, this does make sense. Particularly the part about ^(abba....)$.

So I don't have a choice in this, if I want exact matches then I have to use $regexp. With that in mind, I have been experimenting in convert as I am not sure how to make the suggested code work.

Field:
$REGEXP('%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%','^(ABBA|ADDA|ABSRDST|ACDC|AC DC|AKDONG MUSICIAN|BKPR|BLK JKS|BTS|CHLLNGR|CHVRCHES|CHLL PLL|DFRNT|DIIV|DMC|DNCE|DRWN|DTCV|DWNTWN|DVSN|DVSR|EXO-K|GRMLN|HAIM|HTRK|HXLT|INXS|JMSN|JPNSGRLS|KAYTRANADA|KDA|KSHMR|LADYBABY|LANY|LEE HI|LNDN DRGS|LNZNDRF|LVTHN|MGMT|MIKA|MNEK|MNDRMNEK|MS MR|MSTRKRFT|N SYNC|NSYNC|PARTYNEXTDOOR|PWR BTTM|PZA|RDGLDGRN|RKCB|RLYR|RÜFÜS DU SOL|RVIVR|RY X|SBTRKT|SHXCXCHCXSH|SOPHIE|STNNNG|STRFKR|SWMRS|TNGHT|TR/ST|TTS|TSTR|WALK THE MOON|WZRD|U2|U-KISS|UNKLE|WSTRN|XTRMST|ZAYN)$','$UPPER(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%)

Format string:
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%

No effect.

Field:
$REGEXP(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%,'^ABBA|ADDA|ABSRDST|ACDC|AC DC|AKDONG MUSICIAN|BKPR|BLK JKS|BTS|CHLLNGR|CHVRCHES|CHLL PLL|DFRNT|DIIV|DMC|DNCE|DRWN|DTCV|DWNTWN|DVSN|DVSR|EXO-K|GRMLN|HAIM|HTRK|HXLT|INXS|JMSN|JPNSGRLS|KAYTRANADA|KDA|KSHMR|LADYBABY|LANY|LEE HI|LNDN DRGS|LNZNDRF|LVTHN|MGMT|MIKA|MNEK|MNDRMNEK|MS MR|MSTRKRFT|N SYNC|NSYNC|PARTYNEXTDOOR|PWR BTTM|PZA|RDGLDGRN|RKCB|RLYR|RÜFÜS DU SOL|RVIVR|RY X|SBTRKT|SHXCXCHCXSH|SOPHIE|STNNNG|STRFKR|SWMRS|TNGHT|TR/ST|TTS|TSTR|WALK THE MOON|WZRD|U2|U-KISS|UNKLE|WSTRN|XTRMST|ZAYN$,$UPPER(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%)

Format string:
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%

No effect.

Field:
$REGEXP(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%,^ABBA|ADDA|ABSRDST|ACDC|AC DC|AKDONG MUSICIAN|BKPR|BLK JKS|BTS|CHLLNGR|CHVRCHES|CHLL PLL|DFRNT|DIIV|DMC|DNCE|DRWN|DTCV|DWNTWN|DVSN|DVSR|EXO-K|GRMLN|HAIM|HTRK|HXLT|INXS|JMSN|JPNSGRLS|KAYTRANADA|KDA|KSHMR|LADYBABY|LANY|LEE HI|LNDN DRGS|LNZNDRF|LVTHN|MGMT|MIKA|MNEK|MNDRMNEK|MS MR|MSTRKRFT|N SYNC|NSYNC|PARTYNEXTDOOR|PWR BTTM|PZA|RDGLDGRN|RKCB|RLYR|RÜFÜS DU SOL|RVIVR|RY X|SBTRKT|SHXCXCHCXSH|SOPHIE|STNNNG|STRFKR|SWMRS|TNGHT|TR/ST|TTS|TSTR|WALK THE MOON|WZRD|U2|U-KISS|UNKLE|WSTRN|XTRMST|ZAYN$,$UPPER(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%)

Format string:
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%

No effect.

Field:
$REGEXP(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%,^abba|adda|absrdst|acdc|ac dc|akdong musician|bkpr|blk jks|bts|chllngr|chvrches|chll pll|dfrnt|diiv|dmc|dnce|drwn|dtcv|dwntwn|dvsn|dvsr|exo-k|grmln|haim|htrk|hxlt|inxs|jmsn|jpnsgrls|kaytranada|kda|kshmr|ladybaby|lany|lee hi|lndn drgs|lnzndrf|lvthn|mgmt|mika|mnek|mndrmnek|ms mr|mstrkrft|n sync|nsync|partynextdoor|pwr bttm|pza|rdgldgrn|rkcb|rlyr|rÜfÜs du sol|rvivr|ry x|sbtrkt|shxcxchcxsh|sophie|stnnng|strfkr|swmrs|tnght|tr/st|tts|tstr|walk the moon|wzrd|u2|u-kiss|unkle|wstrn|xtrmst|zayn$,'$upper(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%))

Format string:
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%

No effect.

$REGEXP('%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%','^(ABBA|ADDA|ABSRDST|ACDC|AC DC|AKDONG MUSICIAN|BKPR|BLK JKS|BTS|CHLLNGR|CHVRCHES|CHLL PLL|DFRNT|DIIV|DMC|DNCE|DRWN|DTCV|DWNTWN|DVSN|DVSR|EXO-K|GRMLN|HAIM|HTRK|HXLT|INXS|JMSN|JPNSGRLS|KAYTRANADA|KDA|KSHMR|LADYBABY|LANY|LEE HI|LNDN DRGS|LNZNDRF|LVTHN|MGMT|MIKA|MNEK|MNDRMNEK|MS MR|MSTRKRFT|N SYNC|NSYNC|PARTYNEXTDOOR|PWR BTTM|PZA|RDGLDGRN|RKCB|RLYR|RÜFÜS DU SOL|RVIVR|RY X|SBTRKT|SHXCXCHCXSH|SOPHIE|STNNNG|STRFKR|SWMRS|TNGHT|TR/ST|TTS|TSTR|WALK THE MOON|WZRD|U2|U-KISS|UNKLE|WSTRN|XTRMST|ZAYN)$','$UPPER(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%)'

Format string:
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%

No effect.

By the way, the difference in case in the examples is based on extracting the code from convert (forced uppercase) or the mta file (original case).

So I am not sure how to amend this...

Can't you try to get the syntax right for just a single case, e.g. look for a single track where you find Abba or abba and then test your $regexp() on that example?
Your instruction does not make any sense at all.
You take as source:
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%
Then you look for a list of upper or lower case strings (with varying syntax errors)
and the result then is again the original string,
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%
only this time in upper case (where I am not sure if it should not be \u instead of $upper()
So nothing has changed ever since you started the regular expression.
You would have to reference the hit in a regular expression with $1 .. $9 (depending on the parts that you defined). in this case it should be
\u$1
Please test if you need to enclose everything from ^ to $ in parenthesis to get an addressable part.
From a point of logic:
Where in a string composed of the contents of 4 fields and added === would you find "ABBA" as the only string - something that you indicate with ^ (as beginning of field) and $ (as end of field)? If you compose a string of 4 fields then the string may look like
Abba === abba === aBBa === Waterloo
There are no fields any more, it is just a string.
So limiting the items in the list to just the (old) field length will most likely never produce a hit.

So your testing was accurate: that what you have developed will have no effect.

1 Like

Thank you for your comprehensive reply.

This does not change case:

Field:
$REGEXP(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%,(INXS),\U$1(%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%)

Format string:
%ALBUMARTIST% === %ARTIST% === %ARTISTS% === %TITLE%

I struggle to understand how it is not logical to define a list which comprises of specific tag fields, and when these are found, change them to uppercase.

There must be a way using guess value, in the same way it was possible to convert brackets.

Are you saying that it will not produce any results because it is not likely to find a match of the artist in all four of those fields?

It simply does not make sense to use the same string as output that you have used as input.
$regexp() is a help for text patterns but not normally for text constants.
when I enter that strange string in the Converter test, It tells me "syntax error".
Which is no wonder as the result string expects text constants or $1..$9 references but no field variables - the variables would then be treated as literals.

So based on your experience and in your opinion, is it possible to search and match any of these fields (whether or not every single one matches in any particular example) and force uppercase on anything defined in the list within one guess value action?

As you know, to date I have had several different lists which refer to the same things but define matches within a particular field. This works but is not ideal.

I cannot think of another way because I have limited experience and knowledge of the subject. I hope you can figure it out.

Thank you as always.

@sheepdisease
This thread has wandered all over the place and I find it very difficult to follow.
It seems you have confused yourself (and me!) by trying to debug an action group that was created by combining solutions from others, without knowing the basics about actions, functions, and regular expressions.
But maybe I can restate what you want to do.

Is it this?:

  • Change to UPPER case all occurrences of any of the words on a list, in various fields including ALBUMARTIST, ARTIST, and ARTISTS.
  • The change should be applied wherever the word occurs in each field, not only the 1st occurrence.
  • And do this in a way that requires the existence and maintenance of only 1 list.
  • And do it with only 1 action.

I am trying to put words in your mouth.
But if this description is not accurate, you should make changes to it.
When you have an accurate description, start a new thread.

How To Ask Good Questions

2 Likes

@ryerman

This is spot on. From the get go my mission has been to look for any instance of a word in a list within one action and change each instance found in the fields mentioned to uppercase. Like you say, I have limited knowledge, experience or understanding (although I am trying my best) so managing this has been a challenge.

Thank you for taking the time to try and understand and clarify.

1 Like

No problem. Your new thread is nicely started. :smile:
I have some ideas and will respond soon.