return bool(self.name)
class Album(Meta):
+ """Info:
+ If a class that overrides __eq__() needs to retain the implementation of
+ __hash__() from a parent class, the interpreter must be told this explicitly
+ by setting __hash__ = <ParentClass>.__hash__.
+ """
__hash__ = Meta.__hash__
def __init__(self, **kwargs):
'musicbrainz_artistid',
'musicbrainz_albumartistid']
# have tags been collapsed?
- self.collapse_tags_bool = False
self.collapsed_tags = list()
# Needed for multiple tags which returns a list instead of a string
self.collapse_tags()
if tag not in self.tags_to_collapse:
continue
if isinstance(value, list):
- self.collapse_tags_bool = True
self.collapsed_tags.append(tag)
self.__dict__.update({tag: ', '.join(set(value))})
name = self.artist
mbid = self.musicbrainz_artistid
if self.albumartist and self.albumartist != 'Various Artists':
- name = self.albumartist
+ name = self.albumartist.split(', ')[0]
if (self.musicbrainz_albumartistid and
self.musicbrainz_albumartistid != '89ad4ac3-39f7-470e-963a-56509c546377'):
- mbid = self.musicbrainz_albumartistid
+ mbid = self.musicbrainz_albumartistid.split(', ')[0]
return Artist(name=name, mbid=mbid)
# VIM MODLINE
'artist': 'Devolt',
'date': '2011-12-01',
'disc': '1/1',
- 'file': 'gberret.music/Devolt/2011-Grey/03-Devolt - Crazy.mp3',
+ 'file': 'music/Devolt/2011-Grey/03-Devolt - Crazy.mp3',
'last-modified': '2012-04-02T20:48:59Z',
'musicbrainz_albumartistid': 'd8e7e3e2-49ab-4f7c-b148-fc946d521f99',
'musicbrainz_albumid': 'ea2ef2cf-59e1-443a-817e-9066e3e0be4b',
def test_tagcollapse(self):
trk = Track(**DEVOLT)
- self.assertTrue(trk.collapse_tags_bool, 'Should have collapsed a tag')
+ self.assertTrue(trk.collapsed_tags, 'Should have collapsed a tag')
self.assertFalse(isinstance(trk.albumartist, list), 'Failed to collapse albumartist tag')
+ self.assertTrue(trk.get_artist().name in DEVOLT.get('albumartist'),
+ 'Failed to split multiple tag?')
def test_boolean_type(self):
self.assertFalse(bool(Track()))