beetbox / beets

music library manager and MusicBrainz tagger
http://beets.io/
MIT License
12.94k stars 1.82k forks source link

%title: Capitalize letters after some punctuation #3298

Open nopoz opened 5 years ago

nopoz commented 5 years ago

Using the %title Title Case function in the path, it looks like characters that are preceded by a non-alpha are not changed.

For example:

The Album Title Childish Gambino - 2016 - “awaken, My Love!” where %title{$album%aunique{}} is defined in the default path. The "a" in awaken is preceded by a quote character.

Another example, the track name 08 - Bow Shock (interlude).mp3 where $track - %title{$title} is defined.

Not sure if this is a known issue or not? Any workarounds if known?

Thanks!

Snippet from my config.yaml if it's helpful:

paths:
    default: $albumartist - $original_year - %title{$album%aunique{}} %upper{$albumtype_EP}%title{$albumtype_Single}%if{$multidisc,(Disc $disc)}/$track - %title{$title}
    singleton: Non-Album/$artist - $title
    comp: \#VA/$album%aunique{} - $original_year/$track - $artist - $title

plugins: lastgenre fetchart replaygain scrub discogs ftintitle beatport smartplaylist inline

item_fields:
    albumtype_EP: u'(' + albumtype + u')' if albumtype == 'ep' else ''
    albumtype_Single: u'(' + albumtype + u')' if albumtype == 'single' else ''
    multidisc: 1 if disctotal > 1 else 0
jackwilsdon commented 5 years ago

It looks like we actually changed the behaviour of title from doing what you asked here to doing what it does now in #3033 and #3059, as previously it would convert strings such as "Don't" to "Don'T". I'm not sure what the right thing to do here is, as reading this it seems like we should maybe consider switching back to the old functionality but maintain a whitelist or blacklist of characters that should/shouldn't appear before characters that are going to be capitalised.

arcresu commented 5 years ago

Maybe we can learn from this project: https://github.com/ppannuto/python-titlecase (at least the test cases could be useful inspiration).

sampsyo commented 5 years ago

Interesting find! It's clear that our title-case function could be improved, but I don't think we should switch back to the old version (just .title()), since it's also imperfect. I'm marking this as a feature request to make title-casing more robust and standard.

ColeBennett commented 5 years ago

Created a pull request for this issue: https://github.com/beetbox/beets/pull/3411