While playing music today, I noticed a bug in display of album names. They were displayed without capitalisation changes. The problem is in md_pp_capitalize(). It creates a local variable called mdalbum instead of modifying md.album.
Here are two patches: one to fix that bug, and another to apply on top of that, instead of the first one I sent a couple of hours ago. Both against svn version 282.
Index: src/metadata.py =================================================================== --- src/metadata.py (revision 282) +++ src/metadata.py (working copy) @@ -557,7 +557,7 @@ if md.artist: md.artist = string.capwords(md.artist) if md.album: - mdalbum = string.capwords(md.album) + md.album = string.capwords(md.album)
def md_pp_strip_leading_article(md): # strip leading "The " in artist names, often used inconsistently
Index: src/metadata.py =================================================================== --- src/metadata.py (revision 282) +++ src/metadata.py (working copy) @@ -552,13 +552,25 @@ ##############################################################################
def md_pp_capitalize(md): + def capwords(s): + words = string.split(s) + cwords = [] + for word in words: + if word[0] in string.letters: + cwords.append(string.capitalize(word)) + elif len(word) > 1 and word[1] in string.letters: + cwords.append(word[0] + string.capitalize(word[1:])) + else: + cwords.append(string.capitalize(word)) + return string.join(cwords) if md.title: - md.title = string.capwords(md.title) + md.title = capwords(md.title) if md.artist: - md.artist = string.capwords(md.artist) + md.artist = capwords(md.artist) if md.album: - md.album = string.capwords(md.album) + md.album = capwords(md.album)
+ def md_pp_strip_leading_article(md): # strip leading "The " in artist names, often used inconsistently if md.artist and md.artist.startswith("The ") and len(md.artist)>4: