Using TAG in actions/combining actions for different tags


#1

I get the impression that using TAG is a shortcut in actions to updating many tags at the same time. Is there a way to add exclusions so that certain tags are not affected without going down the route of specifying every tag you do want to affect?

For example, if I want to use capitalisation on every tag except artist because the case of the artist is originally correct and any manipulation would cause their name to be incorrect, can this be done?

I want to try and avoid situations like this example of removing and replacing square brackets in particular tags/filenames:

[#77]
T=5
F=ALBUM
1=$replace(%ALBUM%,'[','(',']',')')
! Replace square brackets=

[#78]
T=5
F=TITLE
1=$replace(%TITLE%,'[','(',']',')')
! Replace square brackets=

[#79]
T=5
F=_FILENAME
1=$replace(%TRACK% %TITLE%,'[','(',']',')')

Change to UPPERCASE all occurrences of any word in a list found in several fields
#2

Still hoping that there is a way.


#3

You cannot define an exception. You can only define a list (which is a fairly strange approach):
Instead of using the prefab actions for case conversion, format value, replace etc. you use an action of the type "Guess value".
The basic approach with this action is that you first join all fields and treat them with the function that you want to apply multiple times and then you split them again, e.g.:
Guess value
Source: $replace('%title% === %ALBUM%','[','(',']',')')
Target: %title% === %album%
The === is just a helper string that has to be unique in the source and the target string.
This construction would join actions 77 and 78 from your example.


#4

Thanks for that. So to clarify, the === would not appear in the final result and is only there for code execution?

I think this could save me quite a few lines if this works like I think.


#5

yes. The === is a sequence of characters that should not appear in ordinary text and therefore can be used as separator.
If, on the other hand, some writes a text with === in it, it will fail ... I haven't come across such a text yet.


#6

Thank you. I think I can use this to condense the multiple lines for replace in this script:


#7

I think I read somewhere that it is recommended to replace a space within any regex with something else to make it clear that it is intended to be a space, can you please tell me what that would be? I can't remember or find anything related.

Is it \s?? For example:

[#6]
T=2
! Remove Album=
F=ALBUM
1= (Album)
2=
3=0

to

[#6]
T=2
! Remove Album=
F=ALBUM
1=\s?(Album)
2=
3=0

If so, is this correct as an example of what you said to replace the following?

[#6]
T=2
! Remove Album=
F=ALBUM
1= (Album)
2=
3=0

[#7]
T=2
! Remove Album=
F=_DIRECTORY
1= (Album)
2=
3=0

[#8]
T=2
! Remove Album=
F=_FILENAME
1= (Album)
2=
3=0

Guess Values
Source format:
$replace('%ALBUM% === %_DIRECTORY% === %_FILENAME%','\s?\(Album\)')
Guessing pattern:
%ALBUM% === %_DIRECTORY% === %_FILENAME%

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

Also, in an mp3 file, exactly which fields are affected by actions involving _TAG?


Combining 'replace with' [empty] in multiple fields action
#8

I have tried multiple variations but cannot get this to work.

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

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

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

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

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

Couldn't get it to work in the example you gave either, albeit slightly modified. It executed the code but literally changed the true album and title to literal %ALBUM% and %TITLE%.

[#0]
T=7
F=$replace('%ALBUM% \u003d\u003d\u003d %TITLE%','[','(',']',')')
1=%ALBUM% \u003d\u003d\u003d %TITLE%

[#1]
T=5
! Replace square brackets with round=
F=_DIRECTORY
1=$replace(A:\\Music\\Record\\%artist%\\%album%,'[','(',']',')')

[#2]
T=5
! Replace square brackets with round=
F=_FILENAME
1=$replace(%TRACK% %TITLE%,'[','(',']',')')

What am I doing wrong?


#9

I do not think that you have to escape the brackets in an ordinary replace action.


#10

Thanks for your reply. Removing the slashes makes no difference, it still does not work.

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

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

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

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

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

Can you see anything else wrong with this?


#11

I've been constantly modifying it trying to make it work but just can't find the problem or understand why there is one.


#12

I would test the $replace() statements in Convert>Tag-Tag first
An when you have the correct syntax then use that template for the actions.
I think that you are sometimes missing the replace string, or the number of commas is not right.


#13

Thanks for the reply. I have checked it a gazillion times. To me it looks like each instance includes replace and the correct number of commas (one).

This is the same code unedited, extracted directly from the action file.

$REPLACE('%ALBUM% === %_DIRECTORY% === %_FILENAME%',' (ALBUM)')
%ALBUM% === %_DIRECTORY% === %_FILENAME%

A:\Music\Record\INXS\Kick (Album)\1 Guns in the Sky.mp3
  "" ->
  "Kick (Album) === Kick (Album) === 1 Guns in the Sky"

In this example I am trying to remove " (Album)" from the ALBUM, _DIRECTORY AND _FILENAME. What is the problem?


#14

Just thinking out loud but I wonder if perhaps the following could be a workaround in general for these scenarios:

  1. Formatting the part of the tag that would be affected by the global action in a way that's reversible later in the action
  2. Running the desired formatting on all the tags
  3. Reverting the modifications in the tag you wanted 'excluded'

As an example of modifying the 'excluded' tag's content, using your square brackets replacement in the OP, you could perhaps replace all square brackets in the tag you wanted to 'exclude' with a special Unicode character you know won't be used for anything else, then at the end of the action replacing that Unicode character with the original square brackets.


#15

Hello Lauren, thank you for your reply. I'm not sure why I would remove the square brackets and then put them back, given the desired result is to replace them with round brackets?

My main concern right now is trying to process as many specific tags as possible with the same action rule like in my last post. I just don't understand why it isn't working.


#16

Using your square brackets example, it was a workaround concept for excluding the action from affecting certain tags by changing the tags you want to exclude with different characters so the action doesn't affect them when run, saving the need to copy the replace action formatting for every tag you do want to change.

To visualize let's say the tag you wanted to exclude was Artist, but format all other tags with a square to round bracket replacement.

Original: Example Artist [123]

  1. Formatting using Unicode replacement characters to exclude from later formatting action when run:
    Example Artist ⬔123⬕

  2. Action that changes square brackets to round brackets is run and doesn't affect the Artist tag since the characters were replaced.

  3. A replace format is run to turn the Unicode back to the original characters in the Artist tag:
    Example Artist [123]

Would be trickier for things like excluding certain types of capitalization however.


#17

Thanks for your reply, that could be useful in certain scenarios. I will go through some of my actions and see if that can be applied.

Do you know how I can get this Guess Values, replace example working in my previous post please?


#18

I'm not familiar with the method described by ohrenkino but I'm sure you'll get some further replies with help :slight_smile:


#19

ohrenkino describes the functionality in another post back in December 2017.

The trick is to use an action of the type "Guess value" for the list of fields that you want to treat in one go and use a delimiter of your choice. Also, the bulk function has to be applied to the source.
An example: you want to remove the "The" from ALBUMARTIST and ARTIST:
Action: "Guess value"
Source: $replace('%albumartist%===%artist%,The ,)
Target Pattern: %albumartist%===%artist%
The === can be replaced by more or less any unique character.

I still haven't been able to make it work in my example though.


#20

I understand now. Tested using a slightly modified version of that example and it worked for me (I tested with square to round brackets formatting).

I removed the first ' single quote after the first bracket of the $replace(, making it:

Source format: $replace(%title%===%album%===%artist%,'[','(',']',')')
Guessing pattern: %title%===%album%===%artist%

Found that wrapping the first %title%===%album%===%artist% within the replace function (as seen in ohrenkino's first reply to the topic) in single quotes formatted the fields instead as literal %title% etc.