mirror of
https://github.com/fergalmoran/picard.git
synced 2026-03-05 04:54:00 +00:00
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
This commit is contained in:
@@ -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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user