From 013f05f2da5e4a1898d08fb5b23f3f437bf80f08 Mon Sep 17 00:00:00 2001 From: Philipp Wolfer Date: Wed, 7 Jan 2015 17:43:51 +0100 Subject: [PATCH] Improve folksonomy tag comparisson for ignored tags. Use full tag names and not substrings for comparisson so that e.g. ignoring "someothertag,hip hop rap" does not also ignore "rap". Also this change makes the comparisson case insensitive to match the behavior on MB.org. Fixes PICARD-335 --- picard/track.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/picard/track.py b/picard/track.py index 8f86610c4..0e660a0ab 100644 --- a/picard/track.py +++ b/picard/track.py @@ -144,10 +144,10 @@ class Track(DataObject, Item): # And generate the genre metadata tag maxtags = config.setting['max_tags'] minusage = config.setting['min_tag_usage'] - ignore_tags = config.setting['ignore_tags'] + ignore_tags = self._get_ignored_folksonomy_tags() genre = [] for usage, name in taglist[:maxtags]: - if name in ignore_tags: + if name.lower() in ignore_tags: continue if usage < minusage: break @@ -158,6 +158,13 @@ class Track(DataObject, Item): genre = [join_tags.join(genre)] self.metadata['genre'] = genre + def _get_ignored_folksonomy_tags(self): + tags = [] + ignore_tags = config.setting['ignore_tags'] + if ignore_tags: + tags = [s.strip().lower() for s in ignore_tags.split(',')] + return tags + class NonAlbumTrack(Track):