sampsyo/beets — pull request #1156 by djl (2014-12-20 22:15:50+00:00)
Title: lastgenre: Optionally replace unicode characters when performing lookups

It looks like there's a bug in lastgenre plugin that causes artists/albums with Unicode characters to be skipped:

$ beet lastgenre 'albumartist:Sleater‐Kinney'
genre for album Sleater‐Kinney - The Woods (None):
$

My quick fix for this was to patch the plugin to add a new `asciify` option which, if `True`, runs unidecode() over the arguments before passing them onto the underlying pylast library:

# post-patch
$ beet lastgenre 'albumartist:Sleater‐Kinney'
genre for album Sleater‐Kinney - The Woods (album): Rock
$

I'm not sure if this the best solution. There could be cases where substituting characters returns an entirely different result than the one you expect.

A more thorough approach would be to try once with regular characters then again with `asciify`-ed characters if nothing is found (maybe prompt the user to confirm the new results are correct?). It shouldn't be too difficult to add this later if it's required.