diff --git a/beetsplug/lastgenre/__init__.py b/beetsplug/lastgenre/__init__.py index 950d0c71b..eba6c6cab 100644 --- a/beetsplug/lastgenre/__init__.py +++ b/beetsplug/lastgenre/__init__.py @@ -41,6 +41,13 @@ PYLAST_EXCEPTIONS = ( ) +def deduplicate(seq): + """Remove duplicates from sequence wile preserving order. + """ + seen = set() + return [x for x in seq if x not in seen and not seen.add(x)] + + # Core genre identification routine. def _tags_for(obj, min_weight=None): @@ -198,13 +205,7 @@ class LastGenrePlugin(plugins.BeetsPlugin): break tags = tags_all - def remove_duplicates(seq): - """Remove duplicates from sequence wile preserving order""" - seen = set() - seen_add = seen.add - return [x for x in seq if x not in seen and not seen_add(x)] - - tags = remove_duplicates(tags) + tags = deduplicate(tags) # c14n only adds allowed genres but we may have had forbidden genres in # the original tags list diff --git a/docs/changelog.rst b/docs/changelog.rst index fe227700a..fceededc0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -50,7 +50,9 @@ Little improvements and fixes: * :doc:`/plugins/fetchart`: When loading art from the filesystem, we now prioritize covers with more keywords in them. This means that ``cover-front.jpg`` will now be taken before ``cover-back.jpg`` because it - contains two keywords rather than one. + contains two keywords rather than one. Thanks to Fabrice Laporte. +* :doc:`/plugins/lastgenre`: Remove duplicates from canonicalized genre lists. + Thanks again to Fabrice Laporte. 1.3.6 (May 10, 2014)