Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.
Also make sure you've read the Forum Guidelines before posting in this forum.
![]() ![]() |
Mar 9 2011, 14:03
Post
#1
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Howdy. I've stumbled across this Action script that formats all fields to title case. It works very well, except that I would like it to ignore words that are upper-case. For instance, words (or acronyms without periods) like UFO are converted to Ufo. I've left a message for the script's author but have not yet had a reply, so I thought I'd ask the geniuses over here.
So, any ideas? Also, I'm wondering what similar scripts others here are using, so alternative suggestions are welcome. Thanks! ---------------------------------------------------------------------------------- Update: What began as a humble effort to format my mp3 tags to title case has become a bit of an odyssey. With perseverance and a lot of help from the wonderful people that frequent this forum, I have assembled a script that is intended as a comprehensive solution to the problem of standardising, grammatically speaking, all text fields of a digital music collection - including filenames and parent directories. Presenting... Grammartron: Smart Case and Grammar Restorer Features include...*
Notes
Acknowledgements This script would not have been possible without the help of certain people. Special thanks goes to Liquid Parallax, whose work formed the basis for this script; Doug Mackie, whose awesome script I have shamelessly plagiarised; Dano, author of the core title case action and whose skill with regular expressions is second to none; DetlevD, who helped with Roman numerals; Zoofield, whose script (word contractions) I also ripped off. *For the complete list of functions, please refer to the descriptions contained within the source code by opening the files in a text editor. This post has been edited by yog-sothoth: May 15 2011, 08:49
Attached File(s)
|
|
|
|
Mar 9 2011, 14:24
Post
#2
|
|
![]() Member Group: Full Members Posts: 4129 Joined: 26-May 06 From: Wuppertal, Germany, Planet Earth Member No.: 3194 Mp3tag Version: 2.54 |
... I would like it to ignore words that are upper case. ... To save already upcased letters from title casing you can use the function $caps2. DD.20110309.1430.CET -------------------- * Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥ |
|
|
|
Mar 9 2011, 14:31
Post
#3
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
|
|
|
|
Mar 9 2011, 16:20
Post
#4
|
|
|
Member Group: Full Members Posts: 35 Joined: 27-April 09 From: New Jersey, USA Member No.: 9952 Mp3tag Version: 2.51 |
... I'm wondering what similar scripts others here are using, so alternative suggestions are welcome. Here are my two title-case MTA files: Title Case Action Files (Mackie) They add a series of corrections after running Mp3tag's Mixed Case function. Included are editable lists of abbreviations and acronyms that should be upper-case. If you open the MTA files in Notepad, you will see comments that describe each element in the action. Note that my tag field actions cover just three fields and are slightly different for each field. That is by design but of course you can edit them as needed. My regards and thanks to the posters here (including DetlevD) for the examples and explanations that I drew upon when creating these files. Doug Mackie |
|
|
|
Mar 9 2011, 18:57
Post
#5
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Here are my two title-case MTA files: Title Case Action Files (Mackie) They add a series of corrections after running Mp3tag's Mixed Case function. Included are editable lists of abbreviations and acronyms that should be upper-case. If you open the MTA files in Notepad, you will see comments that describe each element in the action. Note that my tag field actions cover just three fields and are slightly different for each field. That is by design but of course you can edit them as needed. My regards and thanks to the posters here (including DetlevD) for the examples and explanations that I drew upon when creating these files. Doug Mackie Thanks, I'll give it a go. With regards to my other query, would you have an idea of how to achieve this, either using your script or the one I provided? Cheers. |
|
|
|
Mar 9 2011, 20:16
Post
#6
|
|
|
Member Group: Full Members Posts: 35 Joined: 27-April 09 From: New Jersey, USA Member No.: 9952 Mp3tag Version: 2.51 |
Yog-Sothoth, you are quite welcome.
Your action starts with the supplied Mixed Case function, as does mine. At that point, your abbreviations have already lost capitalization after the first letter. That is why in my script I added a list of abbreviations to correct the errors. If you were writing a title-case script from scratch (i.e., not using Mixed Case), then $caps2() would be exactly what you want. My guess is that is what DetlevD meant, but of course we should let him speak for himself. I did not attempt to write my script from scratch because it was much easier to let Florian's built-in Mixed Case function do the heavy-lifting, so to speak, and then to apply corrections afterwards. Doug Mackie |
|
|
|
Mar 9 2011, 22:21
Post
#7
|
|
![]() Member Group: Full Members Posts: 4129 Joined: 26-May 06 From: Wuppertal, Germany, Planet Earth Member No.: 3194 Mp3tag Version: 2.54 |
Here are my two title-case MTA files: Title Case Action Files (Mackie) ... Doug, your collection of 'cleaning and repair tools' looks very impressive, thank you for sharing it! DD.20110309.2225.CET -------------------- * Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥ |
|
|
|
Mar 9 2011, 22:56
Post
#8
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Cheers Doug, those scripts are very good. Thanks for your time.
|
|
|
|
Mar 14 2011, 18:21
Post
#9
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Ok, I've done a little digging and found a solution. All credit to Stevest.
Action: Replace with regular expression Field: _ALL Regular expression: ^(.*)$ Replace matches with: $caps2($1) [ ] case-sensitive comparison I just replaced the Mixed Case action with this. EDIT: THERE IS A PROBLEM WITH THIS SCRIPT. READ ON BEFORE IMPLEMENTING! This post has been edited by yog-sothoth: Mar 16 2011, 21:19 |
|
|
|
Mar 14 2011, 19:07
Post
#10
|
|
![]() Member Group: Full Members Posts: 4129 Joined: 26-May 06 From: Wuppertal, Germany, Planet Earth Member No.: 3194 Mp3tag Version: 2.54 |
... I just replaced the Mixed Case action with this. Works like a charm. What I said above in post#2. DD.20110314.1908.CET -------------------- * Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥ |
|
|
|
Mar 14 2011, 19:10
Post
#11
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
|
|
|
|
Mar 14 2011, 19:11
Post
#12
|
|
![]() Member Group: Full Members Posts: 4129 Joined: 26-May 06 From: Wuppertal, Germany, Planet Earth Member No.: 3194 Mp3tag Version: 2.54 |
Sorry, co-credit to DetlevD too. Thanks. DD.20110314.1912.CET -------------------- * Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥ |
|
|
|
Mar 16 2011, 21:17
Post
#13
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
Update: There is a bug in the aforementioned action. If a comma is present anywhere in the field, all characters after the comma are truncated. For example, the title "Harp concerto in B-flat major, op. 4 Nr. 6: 1: Andante-Allegro" becomes "Harp ConCerto in B-Flat MaJor" after conversion. If I remove the comma beforehand, it converts to "Harp Concerto in B-flat Major Op. 4 Nr. 6: 1: Andante-Allegro", which is normal.
Humph, I guess I'm back to square one again. BTW, this is the offending action, just to avoid confusion: Action: Replace with regular expression Field: _ALL Regular expression: ^(.*)$ Replace matches with: $caps2($1) [ ] case-sensitive comparison This post has been edited by yog-sothoth: Mar 16 2011, 21:17 |
|
|
|
Mar 16 2011, 22:20
Post
#14
|
|
|
Member Group: Full Members Posts: 35 Joined: 27-April 09 From: New Jersey, USA Member No.: 9952 Mp3tag Version: 2.51 |
Update: There is a bug in the aforementioned action. If a comma is present anywhere in the field, all characters after the comma are truncated. I can confirm the comma problem but I can't explain it. Perhaps someone else can. However, that action has other problems. It preserves upper-case errors in the source text, which must then be fixed by hand. More important, unlike "Mixed Case", "Replace with Regular Expression" lacks the option for custom word boundary markers. So you must then add actions to correct the resulting errors after punctuation, brackets, and so on. Perhaps the regular expression could be rewritten to minimize the effects of this limitation, but it would be a challenge. The number of abbreviations and acronyms in my titles is limited, so in my scripts I prefer a "Mixed Case" action followed by lists with corrections. There are no problems with commas. |
|
|
|
Mar 16 2011, 22:53
Post
#15
|
|
|
Member Group: Full Members Posts: 64 Joined: 8-November 10 From: UK Member No.: 13190 Mp3tag Version: 2.48 |
It preserves upper-case errors in the source text, which must then be fixed by hand. More important, unlike "Mixed Case", "Replace with Regular Expression" lacks the option for custom word boundary markers. So you must then add actions to correct the resulting errors after punctuation, brackets, and so on. Unless I've misinterpreted you, I believe the other scripts in the action group (see first post) should correct these problems. I could be wrong on that though, so please tell me if you think I'm mistaken. The number of abbreviations and acronyms in my titles is limited, so in my scripts I prefer a "Mixed Case" action followed by lists with corrections. There are no problems with commas. Granted, but I'm not so fortunate. I have quite a large collection (around 70k tracks), a great deal of which has upper-case words that would be incorrectly formatted with the mixed case action. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 25th May 2013 - 11:37 |