sampsyo/beets — pull request #92 by pscn (2013-02-04 21:20:56+00:00)
Title: lastgenre improvements (possibly ;))

Here is my take on the lastgenre plugin. Commit messages are messed up (I'm not used to git and branching and upstream merging... Sorry for that).

1. I made the item.genre independent from album.genre. So setting album.genre will not set item.genre. This feels natural to me, but I'm not sure about further implications of this.
2. I added track as source config option to the lastgenre plugin.
3. I added a new config option force. If this is set to False (default), the genre is kept as-is (if in the whitelist!). If set to True the genre is re-downloaded from last.fm. I'm not sure if we want this as config option or just use the -f command line option for this.
3. The lastgenre plugin now has it's own command line options. -v (verbose, -v on beet level was a little to verbose), -f (set the force config to True), -s source (set source to source (not validated ATM, damn forgot a fallback source).

So, what does it do?

As I explained in another comment, my expectation for genre fetching from last.fm are like this:
* lookup track genre
* if track genre is empty lookup album genre
* if album genre is empty lookup artist genre
* if artist genre is empty use the old value
* if the old value is empty use the fallback

If source is set to track, the list ist started from top. If set to album, it jumps to the "if track genre is empty". If set to ... You get the picture ;)

This is for item.genre. For album.genre there is no "lookup track genre" and "lookup artist genre" is not performed for "Various Artists".

Oh my, a lot of text and probably very incomprehensibly. So here is a little output.

**Single artist release**

Track based:
`# beet lastgenre -f -v -s track "One Foot in the Grave"
LastGenre: Album(Beck - One Foot in the Grave) > Lo-Fi(album)
LastGenre: Item(Beck - Outcome) > Indie Folk(track)
LastGenre: Item(Beck - Fourteen Rivers, Fourteen Floods) > Blues(track)
LastGenre: Item(Beck - See Water) > Singer-Songwriter(track)
LastGenre: Item(Beck - Sleeping Bag) > Lo-Fi(track)
[ ... ]`

Album based:
`#beet lastgenre -f -v -s album "One Foot in the Grave"
LastGenre: Album(Beck - One Foot in the Grave) > Lo-Fi(album)
LastGenre: Item(Beck - Outcome) > Lo-Fi(album)
LastGenre: Item(Beck - Sleeping Bag) > Lo-Fi(album)
[...more Lo-Fi...]`

Artist based:
`#beet lastgenre -f -v -s artist "One Foot in the Grave"
LastGenre: Album(Beck - One Foot in the Grave) > Rock(artist)
LastGenre: Item(Beck - Outcome) > Rock(artist)
LastGenre: Item(Beck - Sleeping Bag) > Rock(artist)
[...more Rock...]`

**Various artists release**
Track based:
`beet lastgenre -v -f -s track "Sounds of the Seventies"LastGenre: Album(Various Artists - Sounds of the Seventies: 1970) > None(None)
LastGenre: Item(Joe Cocker - The Letter) > Classic Rock(track)
LastGenre: Item(The Jackson 5 - ABC) > Motown(track)
LastGenre: Item(Sly & The Family Stone - Thank You (Falletin Me Be Mice Elf Again)) > Funk(artist)
[...]`

Album based:
`beet lastgenre -v -f -s album "Sounds of the Seventies"
LastGenre: Album(Various Artists - Sounds of the Seventies: 1970) > None(None)
LastGenre: Item(Joe Cocker - The Letter) > Classic Rock(artist)
LastGenre: Item(The Jackson 5 - ABC) > Soul(artist)
[...]`

Artist based:
`beet lastgenre -v -f -s artist "Sounds of the Seventies"
LastGenre: Album(Various Artists - Sounds of the Seventies: 1970) > None(None)
LastGenre: Item(Joe Cocker - The Letter) > Classic Rock(artist)
LastGenre: Item(The Jackson 5 - ABC) > Soul(artist)
[...]`

That's it.