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

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

Moderators: Peke, Gurus

dreadlyone
Posts: 48
Joined: Mon Jan 07, 2008 2:06 pm

Post by dreadlyone »

Ahh, ok, thanks for the info.
spacefish
Posts: 1427
Joined: Mon Jan 14, 2008 7:21 am
Location: Denmark

Post by spacefish »

OMG What a great script! I had a bunch of tracks I wanted to batch remove the leading zero from the track number thinking I'd never use the case fixer. Was I wrong! What a powerful tool. Thanks so much. :)
Image
MM Gold 3.0.3.1183 : Vista HP SP1 (x86) : Zen Stone (2GB)
Zekton: An original MM3 skin by Eyal.
Scripts in Use: Add/Remove PlayStat | Auto Album DJ | AutoRateAccurate | Backup
Case & Leading Zero Fixer | Classification & Genre Changer | Clean Scripts.ini | Clear
Field | Custom Report | Discogs Auto-Tag Web Search | Forget Crossfade | Invert
Selection/Select None | Last 100... | Lyricator | Lyrics to Instrumental | MonkeyRok
MusicBrainz Tagger | My Custom Nodes | Now Playing Art Node | Play History & Stats
Right Click for Reports | Right Click for Scripts | Right Click for Web | Stop After Current
WebNodes
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Post by nynaevelan »

SP: I see your signature is starting to fill up.... :P

Nyn
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
spacefish
Posts: 1427
Joined: Mon Jan 14, 2008 7:21 am
Location: Denmark

Post by spacefish »

Hehe, yes it is. :wink:
Image
MM Gold 3.0.3.1183 : Vista HP SP1 (x86) : Zen Stone (2GB)
Zekton: An original MM3 skin by Eyal.
Scripts in Use: Add/Remove PlayStat | Auto Album DJ | AutoRateAccurate | Backup
Case & Leading Zero Fixer | Classification & Genre Changer | Clean Scripts.ini | Clear
Field | Custom Report | Discogs Auto-Tag Web Search | Forget Crossfade | Invert
Selection/Select None | Last 100... | Lyricator | Lyrics to Instrumental | MonkeyRok
MusicBrainz Tagger | My Custom Nodes | Now Playing Art Node | Play History & Stats
Right Click for Reports | Right Click for Scripts | Right Click for Web | Stop After Current
WebNodes
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Thanks spacefish! :D
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
nethog
Posts: 41
Joined: Tue Nov 15, 2005 8:54 pm
Location: Maryville, TN - USA

Post by nethog »

spacefish wrote:OMG What a great script! I had a bunch of tracks I wanted to batch remove the leading zero from the track number thinking I'd never use the case fixer. Was I wrong! What a powerful tool. Thanks so much. :)
I just picked this script up and have to add my accolades as well. A finely crafted and useful script, indeed!

Thank you for your efforts.
genegraham
Posts: 19
Joined: Wed Nov 22, 2006 1:09 am

Installation Error

Post by genegraham »

Bex,

I'd love to use this script, but when I try to install it I get stopped by a dialog box that says, "Installation Error."

I'm running Vista, and MM3 version 3.0.3.1140.

Any ideas?

Thanks!
drjboulder
Posts: 1119
Joined: Mon Apr 09, 2007 12:03 am
Location: Boulder, Colorado, USA

Re: Installation Error

Post by drjboulder »

genegraham wrote:Bex,

I'd love to use this script, but when I try to install it I get stopped by a dialog box that says, "Installation Error."

I'm running Vista, and MM3 version 3.0.3.1140.

Any ideas?

Thanks!
Have you tried running the Monkey as administrator while installing?
Not logged in as admin, but by opening the Monkey by right clicking on the Monkey's .exe and choosing "Run As Administrator". The Double click the .MMIP file for this script.
D Rock
Image
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...
genegraham
Posts: 19
Joined: Wed Nov 22, 2006 1:09 am

Re: Installation Error

Post by genegraham »

drjboulder wrote:
genegraham wrote:Bex,

I'd love to use this script, but when I try to install it I get stopped by a dialog box that says, "Installation Error."

I'm running Vista, and MM3 version 3.0.3.1140.

Any ideas?

Thanks!
Have you tried running the Monkey as administrator while installing?
Not logged in as admin, but by opening the Monkey by right clicking on the Monkey's .exe and choosing "Run As Administrator". The Double click the .MMIP file for this script.
Thanks drjboulder! That did the trick!
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

Very nice indeed Bex. :)

Might want to look at this at some time

I had to add "Liv" to Forced-Case Words to stop it changing

Liv Tyler
to
LIV Tyler

And this

It is probably a lot of extra processing effort but..
I would like to see and option for "the" in the little words list to ignore it if it is preceeded by
& The
and The
(Number) i.e. 2008 The

I ended up taking it out of he little word list to make these instances look nicer :)
spacefish
Posts: 1427
Joined: Mon Jan 14, 2008 7:21 am
Location: Denmark

Post by spacefish »

MoDementia wrote:I would like to see and option for "the" in the little words list to ignore it if it is preceeded by
& The
and The
(Number) i.e. 2008 The
That's a good point and exactly how I like my items capitalized in those instances. Would be a great addition!
Image
MM Gold 3.0.3.1183 : Vista HP SP1 (x86) : Zen Stone (2GB)
Zekton: An original MM3 skin by Eyal.
Scripts in Use: Add/Remove PlayStat | Auto Album DJ | AutoRateAccurate | Backup
Case & Leading Zero Fixer | Classification & Genre Changer | Clean Scripts.ini | Clear
Field | Custom Report | Discogs Auto-Tag Web Search | Forget Crossfade | Invert
Selection/Select None | Last 100... | Lyricator | Lyrics to Instrumental | MonkeyRok
MusicBrainz Tagger | My Custom Nodes | Now Playing Art Node | Play History & Stats
Right Click for Reports | Right Click for Scripts | Right Click for Web | Stop After Current
WebNodes
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Thanks!

But this is really Risser's script especially the part of the code which handles the case thing. I haven't changed that part at all. In fact I haven't yet figured out exactly how it works so I'm not sure on how to accomplish your request.

Feel free to investigate it and change it so it fit your needs. If so please share your findings. :D
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
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

This seems to be working for
& The
and The
(Number) i.e. 2008 The

Thinking about adding
of The

Changes were made to these 2 functions.
Search for variable prevWord to customise it further

Code: Select all

Function fixUp(s, prevChars, nextChar,prevWord)
  Dim forceIndex, littleIndex, i
  Dim capMe, allCaps, foreignPref
  Dim upcased, littleUpped, forceUpped
  
  littleWordList = LittleWords 'Split(SDB.IniFile.stringValue("CaseModify","littleWordString")," ")
  forceCapList = ForceCasedWords 'Split(SDB.IniFile.stringValue("CaseModify","forceCapString")," ")
  forceIndex = -1
  littleIndex = -1
  capMe = false
  allCaps = false
  upcased = UCase(s)
  foreignPref = isForeignPref.test(s)
 
  For i = 1 to UBound(forceCapList)
    forceUpped = UCase(forceCapList(i))
    If forceUpped = upcased Or forceUpped = upcased & nextChar Then
      forceIndex = i
      Exit For
    End If
  Next 'i
  For i = 1 to UBound(littleWordList)
    littleUpped = UCase(littleWordList(i))
    If littleUpped = "THE" and (prevWord = "&" or prevWord = "AND" or IsNumeric(prevWord)) Then
    Else
      If littleUpped = upcased Or littleUpped = upcased & nextChar Then
        littleIndex = i
        Exit For
      End If
    End If
  Next 'i
  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

Function updateCase(s)
  Dim currentWord, result, fixed, theChar, lastNonWordChars, prevWord
  Dim forceIndex
  Dim i
  currentWord = ""
  prevWord = ""
  result = ""
  lastNonWordChars = ""

  For i = 1 to Len(s)
    theChar = Mid(s,i,1)
    If alphaNum.test(theChar) Then
      currentWord = currentWord & theChar
    Else
      If currentWord <> "" Then
        fixed = fixUp(currentWord,lastNonWordChars,theChar,prevWord)
        If Right(fixed,1) = theChar Then 'handle stuff like w/
          fixed = Left(fixed,Len(fixed)-1)
          lastNonWordChars = ""
        Else
          lastNonWordChars = theChar
        End If
        result = result & fixed
        prevWord = Ucase(fixed)
        currentWord = ""
      Else
        lastNonWordChars = lastNonWordChars & theChar
        If theChar = "&" Then
        prevWord = theChar
        End If
      End If
      result = result & theChar
    End If
  Next 'i
  If Len(currentWord) > 0 Then
    result = result & fixUp(currentWord,lastNonWordChars,"",prevWord)
  End If
  updateCase = result
End Function
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

I can't think why this would be the case but any "Little words" that are the last word are left as script case

e.g. "Come on, Come On" with on as a little word

If you would like to stop this change this line

Code: Select all

    ElseIf prevChars = "" Or (nextChar = "" And Not foreignPref) Then
to

Code: Select all

    ElseIf prevChars = "" Then ' Or (nextChar = "" And Not foreignPref) Then
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia »

Yeah found out why Liv needed to be forced

Liv = roman numeral 54 or something :)
Post Reply