sampsyo/beets — pull request #706 by marlemion (2014-04-18 11:17:42+00:00)
Title: Added new funneling logic to lastgenre plugin

As an outcome to this discussion: https://github.com/sampsyo/beets/issues/389#issuecomment-39866928
I have ended up modifying the lastgenre plugin. The logic should be the following:

Fetch all tags from the pylast.Album info.
For each tag check whether it is in the whitelist.
If yes, append it to the taglist.
If not, canonicalize it down and do a check for each layer of the canonicalization if it is in the whitelist.
If yes, append it to the taglist and break to check the ext item of the tags from pylast.Album.
If no, funnel further down until an allowed tag is hit or the funneling reached the ground.

For this, I had to remove the check _is_allowed from _string_to_genre. The canonicalization code has also been moved from there to the tag checking.

As a result, I had to add the _is_allowed check to the Filter of the original genre.

I'd like to emphasize that I am _not_ a coder. I can barely script a little bit. So please be nice to me. :)