- 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):
+ 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: Overrides "name" and "artist" argument
+ :param str musicbrainz_artistid: Overrides "mbid" argument
+ :param str musicbrainz_albumartistid: Overrides "musicbrainz_artistid" argument
+
+ :Example:
+
+ >>> trk = {'artist':'Art Name',
+ >>> 'albumartist': 'Alb Art Name', # optional
+ >>> 'musicbrainz_artistid': '<UUID4>', # optional
+ >>> 'musicbrainz_albumartistid': '<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').split(SEPARATOR)[0]
+ if kwargs.get('musicbrainz_artistid', False):
+ mbid = kwargs.get('musicbrainz_artistid').split(SEPARATOR)[0]
+ if (kwargs.get('albumartist', False) and
+ kwargs.get('albumartist') != 'Various Artists'):
+ name = kwargs.get('albumartist').split(SEPARATOR)[0]
+ if (kwargs.get('musicbrainz_albumartistid', False) and
+ kwargs.get('musicbrainz_albumartistid') != '89ad4ac3-39f7-470e-963a-56509c546377'):
+ mbid = kwargs.get('musicbrainz_albumartistid').split(SEPARATOR)[0]
+ super().__init__(name=name, mbid=mbid)
+
+class MetaContainer(Set):
+
+ def __init__(self, iterable):
+ self.elements = lst = []
+ for value in iterable:
+ if value not in lst:
+ lst.append(value)