diff --git a/beets/library.py b/beets/library.py index f8d226dbe..74b669c03 100644 --- a/beets/library.py +++ b/beets/library.py @@ -1421,7 +1421,7 @@ class DefaultTemplateFunctions(object): # Find matching albums to disambiguate with. subqueries = [] for key in keys: - value = getattr(album, key) + value = album.get(key, '') subqueries.append(dbcore.MatchQuery(key, value)) albums = self.lib.albums(dbcore.AndQuery(subqueries)) @@ -1434,7 +1434,7 @@ class DefaultTemplateFunctions(object): # Find the first disambiguator that distinguishes the albums. for disambiguator in disam: # Get the value for each album for the current field. - disam_values = set([getattr(a, disambiguator) for a in albums]) + disam_values = set([a.get(disambiguator, '') for a in albums]) # If the set of unique values is equal to the number of # albums in the disambiguation set, we're done -- this is diff --git a/docs/changelog.rst b/docs/changelog.rst index 534a7d100..adc70a6bc 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -92,6 +92,8 @@ Fixes: did. :bug:`1657` * :doc:`/plugins/scrub`: Also in ``auto`` mode, album art is now correctly restored. :bug:`1657` +* Possibly allow flexible attributes to be used with the ``%aunique`` template + function. :bug:`1775` .. _Emby Server: http://emby.media