Hello,
I found pytone while searching for text-mode music players, and Wow!, I'm very impressed.
One small thing niggled me, and that was the way that capitalisation of names would create names like
Scary Monsters (and Super Creeps) Only The Bones (will Show)
Note the words "and" and "will" without leading capitals. This might be expected for some of the joining words like "and", but it only happens to words immediately preceded by punctuation.
Here's a patch against svn version 282 to change that behaviour for words preceded by punctuation. It won't handle words preceded by two punctuation characters, but I haven't found any of these in my collection.
The titles above become
Scary Monsters (And Super Creeps) Only The Bones (Will Show)
which seems more consistent to me.
I wasn't sure where the local version of capwords should go, so making it an inner function seemed to be a good way of not polluting any name spaces.
I hope this is useful.
Russell
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: - mdalbum = string.capwords(md.album) + mdalbum = 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: