- @property
- def names(self):
- return self._aliases | {self.name,}
-
- def __add__(self, other):
- if isinstance(other, Artist):
- if self.mbid == other.mbid:
- res = Artist(**self.__dict__)
- res._aliases.extend(other.names)
- return res
+ >>> trk = {'artist':'Art Name',
+ >>> 'albumartist': 'Alb Art Name', # optional
+ >>> 'musicbrainz_artistid': '<UUID4>', # optional
+ >>> }
+ >>> artobj0 = Artist(**trk)
+ >>> artobj1 = Artist(name='Tool')
+ """
+
+ @mbidfilter
+ def __init__(self, name=None, mbid=None, **kwargs):
+ if kwargs.get('artist', False):
+ name = kwargs.get('artist')
+ if kwargs.get('musicbrainz_artistid', False):
+ mbid = kwargs.get('musicbrainz_artistid')
+ if name and not kwargs.get('albumartist', False):
+ kwargs['albumartist'] = name.split(SEPARATOR)[0]
+ super().__init__(name=name, mbid=mbid,
+ albumartist=kwargs.get('albumartist'))
+
+
+class MetaContainer(Set):
+
+ def __init__(self, iterable):
+ self.elements = lst = []
+ for value in iterable:
+ if value not in lst:
+ lst.append(value)