- 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
+ """aliases + name"""
+ return self.__aliases | {self.__name,}
+
+ @property
+ @serialize
+ def names_sz(self):
+ return self.names
+
+
+class Album(Meta):
+ """Album object"""
+
+ @mbidfilter
+ def __init__(self, name=None, mbid=None, **kwargs):
+ if kwargs.get('musicbrainz_albumid', False):
+ mbid = kwargs.get('musicbrainz_albumid')
+ super().__init__(name=name, mbid=mbid, **kwargs)
+
+ @property
+ def album(self):
+ return self.name
+
+
+class Artist(Meta):
+ """Artist object deriving from :class:`Meta`.
+
+ :param str name: Artist name
+ :param str mbid: Musicbrainz artist ID
+ :param str artist: Overrides "name" argument
+ :param str albumartist: use "name" if not set
+ :param str musicbrainz_artistid: Overrides "mbid" argument
+
+ :Example:
+
+ >>> 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)