Package: exfalso Version: 1.0-1 Severity: normal Tags: Patch I'm not very happy with the included Title-Case function of exfalso/quodlibet. For example, (test) is not being title-cased properly, since the t isn't preceded by a space.
The included patch uses a smarter regexp to find word beginnings, that will TitleCase "(test)" and "'oobar", but won't change e.g. "Don't". This patch makes the titlecase function much more useful to me, however there are still some situations where it doesn't work right. Namely the locales support isn't working as expected, which causes capitalizations such as "FooäBar" to happen (i.e. despite setting re.L, it doesn't treat ä as word character??). It might just be missing a call like import locale locale.setlocale(locale.LC_ALL, whatever) at an appropriate place. I'm aware that whether or not "'oobar" should be capitalized is a matter of taste... but I guess we all agree that "(foobar)" should be. It currently isn't, and (live), (acoustic version) are common things found in mp3 titles, and you probably agree that (acoustic Version) looks very odd... -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.22-2-686 (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages exfalso depends on: ii libgtk2.0-0 2.12.1-1 The GTK+ graphical user interface ii libmpcdec3 1.2.2-1 Musepack (MPC) format library ii python 2.4.4-6 An interactive high-level object-o ii python-central 0.5.15 register and build utility for Pyt ii python-ctypes 1.0.2-2 Python package to create and manip ii python-gtk2 2.12.0-1 Python bindings for the GTK+ widge ii python-mutagen 1.11-1 audio metadata editing library ii python-pyvorbis 1.3-1.2 A Python interface to the Ogg Vorb exfalso recommends no packages. -- no debconf information
--- /usr/share/quodlibet/util/__init__.py~ 2007-06-13 23:06:29.000000000 +0200 +++ /usr/share/quodlibet/util/__init__.py 2007-10-27 01:11:31.000000000 +0200 @@ -343,19 +343,16 @@ except UnicodeError: return (s + " " + _("[Invalid Encoding]")).encode(charset, "replace") +_titlecasematcher = re.compile(r"\b(?<!\w')(\w)(\w*?)\b", re.L) def title(string): """Title-case a string using a less destructive method than str.title.""" if not string: return "" - new_string = string[0].capitalize() - cap = False - for s in string[1:]: - if s.isspace(): cap = True - elif cap and s.isalpha(): - cap = False - s = s.capitalize() - else: cap = False - new_string += s - return new_string + def _transform(match): + return match.group(1).upper() + match.group(2) + # all uppercase will need lowercasing first + if (string == string.upper()): + string = string.lower() + return _titlecasematcher.sub( _transform, string) def iscommand(s): """True if an executable file 's' exists in the user's path, or is a