sampsyo/beets — pull request #102 by samdoshi (2013-02-26 13:08:01+00:00)
Title: Add support for artist aliases (fixes GC-354)

### Use MusicBrainz artist aliases to import files with artist names in an appriorate locale

Fixes GC-354: https://code.google.com/p/beets/issues/detail?id=354

This is my attempt at fixing GC-354, it requires the HEAD of the master branch of [alastair/python-musicbrainz-ngs](https://github.com/alastair/python-musicbrainz-ngs) to work in order to retrieve [MusicBrainz aliases](http://musicbrainz.org/doc/Aliases). See [here](http://musicbrainz.org/ws/2/release/a6286a41-5b4f-47d4-825f-a52fac1d343f?inc=artists+aliases+artist-credits+labels) for an XML example of an `artist-credit` block that contains aliases.

As it stands, the body of the change is implemented via the `_flatten_artist_credit` function, which AFAIK is called whenever an `artist-credit` block needs to be consumed. The alias must at the very least have a locale set in order to be considered.

A config variable `artist_aliases` has been added which specifies the user's preferred locales in descending order, for example, from my own config file:

````yaml
import:
artist_aliases: en_GB en
````

See [Yazoo](http://musicbrainz.org/ws/2/artist/42922db2-2e80-44b8-9cdf-0b3a6634c124?inc=aliases) for an example of an alias that uses `language_country`.

### Todo:
- [ ] unit tests (in `test_mb.ArtistFlatteningTest`?)
- [ ] rename config variable?
- [ ] documentation (must mention locale formats, and how to edit MusicBrainz for adding missing translations)

If anyone wants to help with the unit tests or documentation I'd be grateful, I'd also be happy if someone wants to reimplement this entirely (I've got a 7 month old baby and my brain is addled), otherwise, assuming everyone is happy with the implementation, I will work my way through the todo items over the next few weeks.