X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sima%2Flib%2Fmeta.py;h=949b5562a791385c534babb097f0e1430d256e3a;hb=c868199ed4fc9845d9aae60db515a27759df15e7;hp=a3efbf55fe68805e133b9ff32cdcc562791cf231;hpb=7d24f8a6f0bb74de07c3e6d333a2948d9186be1b;p=mpd-sima.git diff --git a/sima/lib/meta.py b/sima/lib/meta.py index a3efbf5..949b556 100644 --- a/sima/lib/meta.py +++ b/sima/lib/meta.py @@ -64,6 +64,8 @@ class Meta: else: return id(self) + def __bool__(self): # empty name not possible for a valid obj + return bool(self.name) class Album(Meta): __hash__ = Meta.__hash__ @@ -89,15 +91,15 @@ class Album(Meta): class Artist(Meta): def __init__(self, **kwargs): - self._aliases = [] + self._aliases = set() super().__init__(**kwargs) def append(self, name): - self._aliases.append(name) + self._aliases.update({name,}) @property def names(self): - return self._aliases + [self.name] + return self._aliases | {self.name,} def __add__(self, other): if isinstance(other, Artist): @@ -109,4 +111,3 @@ class Artist(Meta): raise NotSameArtist('different mbids: {0} and {1}'.format(self, other)) # vim: ai ts=4 sw=4 sts=4 expandtab -