Hey guys. I'm going to apologize in advance for asking about something which has likely been asked countless times before, but I'm having a very hard time finding the information I need.
Basically, I would like to run a "case conversion" which corrects filenames/tags to Mixed Case on slightly over 30k files. I found the stock Action for doing this in Mp3tag, but it has a few unwanted quirks. For instance, the filename "04 - W.A.S.P.mp3" is changed to "04 - W.a.s.p.mp3". Roman numerals are also affected in a similar manner. I'm sure this has been dealt with in the past.
I've tried searching for scripts that others have created, but the threads I'm finding usually contain a multitude of scripts from several users, none of which are fully explained. Since I have no programming knowledge, I have no idea what they actually do, and I'm not even sure I know how to implement them. Can someone point me in the right direction?
You have a couple of ways to do this and here are a those examples.
Begin Action Group Clean-Up 1.2 # Case Retain CAPS With Title Case ElsewhereAction #1Actiontype 5: Format valueField ______: _FILENAMEFormatstring:$caps2(%album%,' -(["'.-')End Action Group Clean-Up 1.2 # Case Retain CAPS With Title Case Elsewhere (1 Action)
Basically as you can see at the link below for further learning the $caps2 doesn't change what is already caps. Which is what you require. The second parameter '' -(["'.-'' is optional and specifies additional characters that triggers upper case. In this case they are -(["'.-. Before - notice there is a whitespace (blank character).
You are going to have to add other actions to the group (see here) for other tags like ARTIST etc using the format value method.
OR use Replace with regular expression where you can affect _ALL (all tags including filename)
Begin Action Group
_Script Test#TESTAction #1Actiontype 4: Replace with regular expressionField ______________: _ALLRegular expression _: (^|\s|\.|\(|\[)([a-z])Replace matches with: $1$caps2($2)[_] Case sensitive comparison
End Action Group _Script Test#TEST (1 Action)
See this post for a more detailed explanation of a similar action.
I've seen a few of these actions around but none have been fully reliable on a large collection. So your safest option is to use this. This goes up to the roman numerals for 25. I find this does my job just fine. You could of you wanted to add the big ones like 'L' and 'C' for 50 and 100.
Begin Action Group Clean-Up 1.2 # Case 'I' 'II' 'III' 'IV' 'V'
Thanks stevehero. I was hoping for something that does both the filename and the tags at the same time, but I'm not averse to using two separate actions if that's how it needs to be done. I gave your 2nd "_Script Test#TEST" example a try, and it still changed "04 - W.A.S.P.mp3" to "04 - W.a.s.p.mp3".
In the time between my post and your response, I came across this thread, and managed to successfully create the following action:
This actually works very well, but has a flaw. If a bracket is used and not closed, as in "04 - Chub (A Lub.mp3", the filename and title will be changed to [ SYNTAX ERROR IN FORMATTING STRING ]. The rest of the action scripts in that thread aren't really fully explained as far as what they do. It don't think I could dedicate enough time to figure out what those long character strings actually mean.
It can't possibly be. I tested it on the same file and it also works on the _FILENAME and also the TITLE.
'sdfhsidfis (9dfsdfsd (dfsdfs) sdfsdfds [sdfsfg ffff wtf (it works just fine [w.a.s.p.].mp3' (Don't mind how random) >>>>> Sdfhsidfis (9dfsdfsd (Dfsdfs) Sdfsdfds [Sdfsfg Ffff Wtf (It Works Just Fine [W.A.S.P.].Mp3
Begin Action Group _Script Test#TEST
Action #1Actiontype 4: Replace with regular expressionField ______________: _ALLRegular expression _: (^|\s|\.|\(|\[)([a-z])Replace matches with: $1$caps2($2)[_] Case sensitive comparisonAction #2Actiontype 4: Replace with regular expressionField ______________: _FILENAMERegular expression _: (\.\w{3,4}$)Replace matches with: $lower($1)[_] Case sensitive comparison
End Action Group _Script Test#TEST (2 Actions)
Its does change the .mp3 >>>>> .Mp3 but because of the way it affects the _FILENAME it alters it. You can fix this with an action in the same action group. I've attached the action so you can get a better understanding of action groups. As long as you have the actions in the order there here it will change the ext of the file to lowercase AFTER the other action #1 then #2 and so on. Make sure Action #2 only affects the _FILENAME. Works for files such as .mp3 and .flac
Actiontype 4: Replace with regular expressionField ______________: _FILENAMERegular expression _: (\.\w{3,4}$)Replace matches with: $lower($1)
Just pick out the bits that are easy to understand. . represents '.'
All characters except . | * ? + ( ) { } [ ] ^ $.
These characters are literals when preceded by a "".
So any of the characters above NEED a \ placed in front of them to work.
\w Any word character - all alphanumeric characters plus the underscore
{3,4} between 3/4 times (again a quantifier)
a{n,m} represents the letter "a" repeated between n and m timesIn this case the a is any word character represented by \w between 3/4 times matching things like .cats or .dogs :slight_smile:
But the important thing here is the $
$ anchors the position of the search at the END of the lineSo it only searches things like .mp3 and .flac because they are based at the end of the line/string
Finally the two things on the outside ( and ) capture wants inside there. And the return $lower($1) changes that to all lowercase.
Hope I've cleared somethings up for you. If not maybe someone else will pick up on it
Thanks again for your help stevehero. I gave it another shot when I got home today, and after a bit of frustration, (not entirely sure why) I got it working like a champ. I still need to do a bit more testing, but as of right now, it appears your scripts do exactly what I need. Thanks!
My next chore will be to find an action script which corrects any filenames that don't have the track number and/or correct spacing at the beginning (example of correct: 01 - Title.mp3 ). For now I'm very happy though.