You have to enclose the parts that you want to address with $x in parenthesis.
If you want to find out if a string is part of another string, use $strstr(), e.g. $strstr(%title%,"cover")
So one could do something like an of the type Action "Format value" for ORIGARTIST
Format string: $ifgreater($strstr(%title%,cover),0,$regexp(%title%,.* (.*) cover,$1),)
Could be an action of the type "Format value" for TITLE
Format string: $ifgreater($strstr(%title%,cover),0,%title%[ %origartist% cover],%title%)
The numbering wizard cannot be called in an action.
You need a separate action following the case adjustment that deals with all the exceptions like the Roman numerals and probably all the "McCoys" and others.
Is an action of the type "Format value" for _FILENAME where you enter the field variables as format string.
Please note that you can use the square brackets to hide string parts that may not be filled, e.g. [ CD $num(%discnumber%,1)\]
you gave me so many info, thank you!
I wrote I'm trying to reach a "workflow" and not a "single click magic wand" action.
"Capitalization" action reached 18 rows, I will go with this "Original Artist" action.
With latest regexp information I gave a look at my "Case" group-action and found that I have two actions, one to trim all leading spaces from _TAG and one for trailing spaces.
Now I found that there is a $trim function but I can't find the right action to trim all _TAG. I thought to use "Format value" but can't specify _TAG.
Yes, you have to specify each field. I think that _TAG is the whole tag data with probably only one leading and one trailing space - if at all.
You can perform functions that deal with data in a string, though, but not with field boundaries.
In my understanding the tag is the whole piece of metadata which is attached to a file. E.g. the V1 tag can be found at the end of a file, the V2 tag can be found (mostly) at the beginning.
The tag itself is then structured into fields.
You will find a similar naming convention in the help in the overview of supported tag fields.
I think you may be wrong as MP3tag supports _ALL, _TAG and _FILENAME and, from Actions and batch-operations tutorial, it looks like _TAG stands "for every single tag" expect filename, otherwise the example that Dano wrote is useless.
Don't you think?
The examples perform actions of the type "Replace with regular expression" which is an action that can be used for more or less any string or all characters. The same applies to actions of the type "Case conversion".
But these are actions. The question arose from
where the problem is that this scripting function produces a string without leading or trailing spaces - and the syntax requires that you either enter a string constant (which would be pointless as while entering, you could leave out the superfluous blanks) or a variable that can produce a (single) string where spaces at the beginning or end can be trimmed.
I was trying to argue that _TAG would still produce just one long single string with just one beginning and one end but no separation into fields.
But I may be wrong.
To apply scripting functions use actions of the type "Format value".
I think you agree with me that if _TAG is just one big string that examples (that remove leading and trailing spaces) are at least misleading. I would like to know how many users thought that _TAG stands for "every single tag", so I just did a test :
Edited title, artist and album tags adding spaces at the beginning and at the end and run the following action group
Extra spaces (leading and trailing) are removed from every tag. I think this prove that _TAG means "every tag".
Said that, do I need two separate actions or can I use the | (pipe) character?
I wrote the following to add "(original artist cover)" to title just if title doesn't contains " cover)" and length of origartist is>0:
Still no. You asked about the scripting function $trim() which requires a single string.
The example is replacing with a regular expression inside a complete string and simply tests "do I find spaces in front of a an end-of-field marker (a binary 0) and if so remove the spaces?" A pattern can be found multple times inside the single _TAG string and then be treated.
The example did not use the much more comfortable function $trim() which cuts both, the leading and trailing spaces, for _TAG.
This has hardly anything to do with the MP3tag scripting functions.
Please check out the help
Have a closer look at $eql() and $grtr().
You can check your expressions in the function Convert>Tag-Tag
Now I see your point and I thank you for your patience.
MP3tag uses something like awk does, where you can change RS (record separator, normally a newline) so it should be able to trim leading and trailing spaces from every "record" of one, big string.
So functions like $trim() rely on "standard/real" strings and some other can handle "big string with different record separator".
Just to recap initial problem:
Now I can extract original artist if title is "Title (OrigArtist Cover)": $ifgreater($strstr($lower(%title%),' cover)'),0,$regexp(%title%,'.* \((.*) [Cc]over\)$',$1),)
If title doesn't show it is a cover and there is an OrigArtist tag, set title accordingly: $if($and($eql($strstr($lower(%title%),' cover)'),0),$grtr($len(%origartist%),0)),%title% (%origartist% Cover),%title%)
Now I'll work on disc numbers and do the _filename thing.
Rename file with "%track% %title%" if single disc, otherwise use "%disc%-%track% %title": $ifgreater($regexp(%discnumber%,'.*/(.*)',$1),1,$num(%discnumber%,1)-$num(%track%,2) %title%,$num(%track%,2) %title%)