diff --git a/beets/autotag/match.py b/beets/autotag/match.py index aa0c21dba..4232c719d 100644 --- a/beets/autotag/match.py +++ b/beets/autotag/match.py @@ -65,10 +65,10 @@ def current_metadata(items): fields = ['artist', 'album', 'albumartist', 'year', 'disctotal', 'mb_albumid', 'label', 'catalognum', 'country', 'media', 'albumdisambig'] - for key in fields: - values = [getattr(item, key) for item in items if item] - likelies[key], freq = plurality(values) - consensus[key] = (freq == len(values)) + for field in fields: + values = [item[field] for item in items if item] + likelies[field], freq = plurality(values) + consensus[field] = (freq == len(values)) # If there's an album artist consensus, use this for the artist. if consensus['albumartist'] and likelies['albumartist']: diff --git a/beetsplug/zero.py b/beetsplug/zero.py index 30f287aea..b9768431c 100644 --- a/beetsplug/zero.py +++ b/beetsplug/zero.py @@ -85,12 +85,11 @@ class ZeroPlugin(BeetsPlugin): return for field, patterns in self.patterns.items(): - try: - value = getattr(item, field) - except AttributeError: + if field not in item.keys(): log.error(u'[zero] no such field: {0}'.format(field)) continue + value = item[field] if self.match_patterns(value, patterns): log.debug(u'[zero] {0}: {1} -> None'.format(field, value)) - setattr(item, field, None) + item[field] = None