Case & Leading Zero Fixer 1.4.2 (2008-04-15)

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

sonofjon
Posts: 20
Joined: Wed Jan 28, 2009 2:59 pm

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15) [MM3]

Post by sonofjon »

I have similar problems as MM3 Monkey.

Thanks for creating this wonderful script by the way!

I'd like to use Musicbrainz.org standard, and so in the case of parenthesized text I'd like to have "(live)" instead of "(Live)" and "(disc 1)" instead of "(Disc 1)". However, adding "(live)" or "(disc " to either "Little Words" or "Forced-Case Words" does not produce the wanted result. I obviously want keep "Live" and "Disc" capitalized in other type of text, for example in a song title like this: "The Way You Live". So I cant simply add "live" or "disc" to either lists. Any way to make this work?
sonofjon
Posts: 20
Joined: Wed Jan 28, 2009 2:59 pm

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15) [MM3]

Post by sonofjon »

Well, I found a workaround that partly solves my problem. Adding "live)" to the Forced-Case list gives the wanted results, e.g.

Transmission (Live) --> Transmission (live)

Still no way to get "(Disc 1)" to "(disc 1)" though since the "disc 1)" includes a space and therefore can't be input to the "Forced-Case list"...

Other examples: I'd like to move

"In Concert (Feat. Paul Desmond)" --> "In Concert (feat. Paul Desmond)"
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15) [MM3]

Post by Bex »

I'll have a look at these issues next time I update the script!
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Poisson

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15) [MM3]

Post by Poisson »

Greetings from Greece.

I followed this topic mainly because I could not work properly "Case Checker" with Greek strings.
The result of "Case Checker" was to make all letters capitals.
I strongly suspect that "Case Checker" works the same way in other languages too.

I looked into this and I think I managed something.

By changing code
vowels.pattern = "[AEIOUY" & ChrW(192) & "-" & ChrW(601) & "]"
to
vowels.pattern = "[AEIOUY" & ChrW(192) & "-" & ChrW(65276) & "]"

"case checker" actually worked in Greek strings!!!

What I understand is that all localized character sets use standard English character set (letters) up to character 192(????) and replace the rest characters according to the local language.

It would be interesting to see if that change works for other languages too.

Even after that change, "Case Checker" does not convert everything correctly yet.
There are some issues that have to do with Greek grammar and how UCase and LCase functions work in Visual Basic.
I also want to notice that functions LOWER and UPPER of Excel work fine with Greek strings!

I hope my notes are useful.

I also add some little Greek words that do not need to be capitalized.
littleWordString = "a|an|and|at|de|del|di|du|e|el|en|et|for|from|la|le|in" & _
"|n|'n|n'|'n'|o'|'o'|of|or|por|the|to|un|une|und|with|y" & _
"|και|κι|ο|η|το|του|τον|τους|των|οι|της|την|μας|με|τα|δεν|δε" & _
"|πια|μα"

Aris
Poisson

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15) [MM3]

Post by Poisson »

Function fixUp(s, prevChars, nextChar)
Dim forceIndex, littleIndex, i
Dim capMe, allCaps, foreignPref
Dim upcased, littleUpped, forceUpped
forceIndex = -1
littleIndex = -1
capMe = false
allCaps = false
upcased = UCase(s)
foreignPref = isForeignPref.test(s)

For i = 0 to UBound(forceCapList)
forceUpped = UCase(forceCapList(i))
If UCase(forceCapList(i)) = upcased Or forceUpped = upcased & nextChar Then
forceIndex = i
Exit For
End If
Next 'i
For i = 0 to UBound(littleWordList)
littleUpped = UCase(littleWordList(i))
If littleUpped = upcased Or littleUpped = upcased & nextChar Then
littleIndex = i
Exit For
End If
Next 'i
If Right(s,1) = "Σ" And (nextChar = " " or nextChar = "") Then
s = Left(s,Len(s)-1)&"ς"
End If

If forceIndex >= 0 Then
s = forceCapList(forceIndex)
Else
If Len(s) = 1 And nextChar = "." Then
' if it's a single character followed by a period (an initial), caps it
allCaps = True
ElseIf Not vowels.test(s) And Not cardinal.test(s) Then
' if it's all consonants, no vowels, and not a cardinal number, caps it
allCaps = True
ElseIf romanNumerals.test(s) And UCase(s) <> "MIX" And UCase(s) <> "MI" And UCase(s) <> "DI" Then
' if it's roman numerals (and not 'mix' or 'di' which are valid roman numerals), caps it
allCaps = True
ElseIf prevChars = "" Or (nextChar = "" And Not foreignPref) Then
'if it's the first or last word, cap it
capMe = True
ElseIf Not whiteSpace.test(prevChars) Or (nextChar <> "" And InStr(")}]",nextChar)) Then
' if it follows a punctuation mark (with or without spaces) or if it's before a close-bracket, cap it
capMe = True
ElseIf littleIndex < 0 And Not foreignPref Then
' if it's not on the 'little word' list, cap it
capMe = True
End If
If allCaps Then
s = UCase(s)
ElseIf capMe Then
s = uppercase(s)
Else
s = LCase(s)
End If
If isMc.Test(s) And Len(s) > 2 Then
' if it's Mc or O', cap the 3rd character (this assumes no names like McA)
s = Mid(s,1,2)&UCase(Mid(s,3,1))&LCase(Mid(s,4))
End If
If foreignPref Then
' if it's l', d' or dell', lowercase the first letter and uppercase the first letter after the apostrophe
Dim pos
pos = InStr(s,"'")
If pos < 1 Then
pos = InStr(s,"`")
End If
If pos > 0 And pos < Len(s) Then
s = Mid(s,1,pos)&UCase(Mid(s,pos+1,1))&LCase(Mid(s,pos+2))
End If
End If
End If
fixUp = s
End Function

This is a small modification for lowering greek letter "Σ" when in the end of a word.
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15) [MM3]

Post by Bex »

Thank you for your contribution, I'll try to implement your suggestions in the next version of the script so It works properly for the Greek alphabet.
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Poisson

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15) [MM3]

Post by Poisson »

I'm glad I was able to help.

I use the modified code of case checker for Greek strings for a week now and I have not noticed any errors or conflicts with English strings yet.

One more thing that needs attention is the following part of the code...

ElseIf prevChars = "" Or (nextChar = "" And Not foreignPref) Then
'if it's the first or last word, cap it


I don't fully understand how "foreignPref" works yet, but I try to realize why the last word of an English string should be caped, no matter what. If you try to use case checker with the string "I need to", it will also cap word "to" even though it is part of littleWordString. I know that not many songs with English titles end with the word "to", but with Greek song titles the case a string ends with little words that do not need to be capitalized is common. Therefore I have modified the code as follows:

ElseIf prevChars = "" Then
'if it's the first word, cap it


I'm still trying to find if that modification creates any unwanted conflicts.
MM3 monkey
Posts: 455
Joined: Mon Aug 27, 2007 2:34 am

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15) [MM3]

Post by MM3 monkey »

Sorry if mentioned b4 but ideally it would be good to have checkboxes so you could uncheck a track, so it doesn't get changed but you can go ahead and hit Enter for the rest. Ideally, just unselecting one or a few fields individually would be good too but no idea how (right-click menu?). I'm sure editing the field directly in your panel isn't possible, so I won't even suggest that.

(I wonder how high up your to-do list this script is? Please ignore my suggestions for now; I'm waiting to sort out all my cases and auto-organise till your next update.)
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15)

Post by Bex »

Yeah, it's on my to do list for this script. But I'm not sure if it'll be implemented or if I can solve the issue in some other way. We'll see waht happens when I get time to update the script
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
MM3 monkey
Posts: 455
Joined: Mon Aug 27, 2007 2:34 am

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15)

Post by MM3 monkey »

Thanks, good luck, take it easy.
bcbaca
Posts: 4
Joined: Sat Feb 16, 2008 3:41 pm

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15)

Post by bcbaca »

First off, great script! Thanks for the effort.

Apologies if this has already been covered.

MM 3.0.7.1191
Script version 1.4.2

I'm simply trying to change the case of common Little Words. I've noticed that some Little Words are ignored while they are in the list. In this example 'on' is recognized, but 'a', 'and' and 'the' are ignored.

Image

Any assistance would be appreciated. Thanks!
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15)

Post by Bex »

Then you don't have "on" in the little word list, do you?
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
bcbaca
Posts: 4
Joined: Sat Feb 16, 2008 3:41 pm

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15)

Post by bcbaca »

Bex wrote:Then you don't have "on" in the little word list, do you?
It's an exclusion list, not an inclusion list. Thanks Bex!
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15)

Post by Bex »

Yes, both lists are exclusion-lists. This script is actually originally written by Risser I just added some more features. In the option of the script you have an information button which displays Risser's original explanation of how these lists works.
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Mars74
Posts: 42
Joined: Sun Jan 11, 2009 6:29 am

Re: Case & Leading Zero Fixer 1.4.2 (2008-04-15)

Post by Mars74 »

Hi all,

First, great thanks Bex for this Script : very usefull & efficient.
One question : how can I manage to get P!nk as an artist nam ? If I add the word to the Forced-Case Words list, this has no effect, & I get P!NK through the script. Using the Little Words list is not an option as the script doesn't even let me register the word inn the list (it has a P).
Thanks again for wour wonderful script
Post Reply