Use name for albumartist if albumartist is not provided.
: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 albumartist: use "name" if not set
: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')
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)
+ if not kwargs.get('albumartist', False):
+ kwargs['albumartist'] = name
+ super().__init__(name=name, mbid=mbid,
+ albumartist=kwargs.get('albumartist'))
+
class MetaContainer(Set):
return
track = tracks[0]
album = Album(name=track.album, mbid=track.musicbrainz_albumid)
- artist = Artist(name=track.artist, mbid=track.musicbrainz_artistid)
self.log.info('Found album in library: %s (by "%s")',
- album, artist)
+ album, track.Artist.albumartist)
if self.sdb.get_bl_album(album, add=False):
self.log.info('Already in blocklist')
return
artist = {'artist': SEPARATOR.join(['Original Name', 'Featuring Nane', 'Featureā¦']),
'albumartist': 'Name',
'musicbrainz_artistid': VALID,
- 'musicbrainz_albumartistid': VALID.replace('11', '22'),
}
art = Artist(**artist)
- self.assertTrue(art.name == 'Name')
- self.assertTrue(art.mbid == VALID.replace('11', '22'))
- artist.pop('musicbrainz_albumartistid')
- art = Artist(**artist)
+ self.assertEqual(art.name, 'Original Name')
self.assertTrue(art.mbid == VALID)
+ self.assertEqual(art.albumartist, artist['albumartist'])
artist.pop('albumartist')
art = Artist(**artist)
- self.assertTrue(art.name == 'Original Name', art.name)
+ self.assertTrue(art.name, 'Original Name')
+ self.assertTrue(art.albumartist, 'Original Name')
def test_empty_name(self):
for args in [
def test_albumartist(self):
trk = Track(albumartist='album_artist', artist='track_artist')
- self.assertEqual(trk.Artist.name, 'album_artist')
+ self.assertEqual(trk.Artist.name, 'track_artist')
trk = Track(artist='track_artist')
self.assertEqual(trk.Artist.name, 'track_artist')
+ self.assertEqual(trk.Artist.albumartist, 'track_artist')
def test_genres(self):
trk = Track(**{'artist': 'Devolt', 'genre': ['Rock, Stoner ', ' Punk; Heavy', 'doom']})