Does this work correctly on tracks featuring time like AM or PM or ft (featuring)? I want to make sure AM & PM are always upper case and ft or feat are lower case. Same goes for the letters in 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, 10th and so on staying lower case.
Also, how do I stop it replacing normal brackets with square brackets and stop it changing the case from upper to lower for the first letter after an open bracket?
It is nearly impossible to achieve that.
No computer can see a difference for AM between
a) I AM the best
b) I see you at 9 AM
If the two letters ft or 4 letters feat are always surrounded by a space, then you can use an action to write them lower case (and avoid wrong lower case at the beginning of the title or as part of another word like left or feather)
Would be just a litte bit better, because there are still cases like
c) Meeting at nine AM
But - of course - you can try to get solved 80% of your cases automatically and fix the other 20% manually.
I'm not sure where you got the above script. Maybe an export of several actions?
You can try to find an existing "regular expression" or "replace action" similar to this examples:
Nice point.
I found this article on A.M. and P.M. by the Washington University.
So it may be worth a try to get the correct spelling first (with dots inbetween) and then it should be easy to get the right case. https://brians.wsu.edu/2016/05/16/am-pm/
Probably a moot point now, but using a combination of string functions, we can test if there's a number preceding the AM. Also, assume A.M | A.M. (upper or lower case) are times and should be changed to AM if that's your naming convention)
These should help
$ifgreater(a,b,x,y), [nested]
$isdigit(x),
$strstr(x,y),
$mid(x,i,n),
$sub(x,y)
I'll write it in pseudo code and if anyone wants it, we can do regular MP3TAG code.
Test: Is there AM in the string
NO = EXIT
YES=
...Get position of AM - $strstr(TITLE,AM)
...IF position is MORE than 2 (>2) characters from left, THEN
......Come back 2 positions and test if that (trimmed) is a number.
......If NUMBER, Capitalise, ELSE
......IF position IS 2 characters from left, THEN
.........Come back 1 positions and test if that is a number.
............If NUMBER, Capitalise, ELSE
END
The reason you test if the position of AM is greater than 1 is the string may start with AM. I'm sure there's more simple regex code to do this but I'm still learning regex.
I would not do it automatically at all but filter for files that might contain AM or PM preceeded with a number
Flter: `%title% MATCHES "\d+ AM"
and then replace all "am"s with AM.
Even if you check for the digit in front ...
Paul Hardcastle has a track called "A.M." - no digit but capitals
The Gorillaz have a track "Andromeda" with D.R.A.M - no digit but capitals
With digits I found "2 Ameisen und ein Elefant"
and by U2 "One [Apollo 440 Ambient Mix]"
but in general, the number in front is OK - and as this makes the string more or less unmistakable to understand as a time refernce, be it in captitaIs or with dots in between, I wonder whether the whole effort is really necessary.
And in none of the titles I found anything that desperately needed a particular case or spelling to get it right or remove a double meaning.
On the other hand I found several 10,000 files that feature the first person singular of "to be" - and in these an "AM" instead of "am" would come as a surprise.
In addition to @ohrenkino's examples I would like to add the "artist intent". There are so many possibilities how an artist want to see his song title.
Just a random selection of "official" song title names from MusicBrainz looking similar to 9 AM
All these titles are from different artists and different releases:
IMHO the time you save with such an autoatic run is more than eaten up by removing all the wrongly transformed exceptions. I would perform such bulk modifications only on a set of files for which I have the control that they match the intended conditions 100%.