if track and cls.database.get_bl_album(elem, add_not=True):
# filter album as well in track mode
# (artist have already been)
- cls.log.debug('Blacklisted alb. "{0.album}"'.format(elem))
+ cls.log.debug('Blacklisted alb. "%s"', elem)
continue
results.append(elem)
return results
super().__getattr__('add')(payload.file)
elif isinstance(payload, list):
self.command_list_ok_begin()
- for tr in payload: # TODO: use send command here
+ for tr in payload:
self.add(tr)
- results = client.command_list_end()
+ self.command_list_end()
else:
self.log.error('Cannot add %s', payload)
tracks = set()
if artist.mbid:
tracks |= set(self.find('musicbrainz_artistid', artist.mbid))
- for name in artist.names:
+ for name in artist.names_sz:
tracks |= set(self.find('artist', name))
return list(tracks)
def _find_alb(self, album):
if not hasattr(album, 'artist'):
- PlayerError('Album object have no artist attribute')
+ raise PlayerError('Album object have no artist attribute')
albums = []
if self.use_mbid and album.mbid:
filt = f'(MUSICBRAINZ_ALBUMID == {album.mbid})'
albums = self.find(filt)
# Now look for album with no MusicBrainzIdentifier
if not albums and album.artist.mbid and self.use_mbid: # Use album artist MBID if possible
- filt = f"((MUSICBRAINZ_ARTISTID == '{album.artist.mbid}') AND (album == '{album!s}'))"
+ filt = f"((MUSICBRAINZ_ARTISTID == '{album.artist.mbid}') AND (album == '{album.name_sz}'))"
albums = self.find(filt)
if not albums: # Falls back to (album)?artist/album name
- filt = f"((albumartist == '{album.artist!s}') AND (album == '{album!s}'))"
+ filt = f"((albumartist == '{album.artist!s}') AND (album == '{album.name_sz}'))"
albums = self.find(filt)
return albums
# #### / find_tracks ##
fuzz, artist)
if found:
if artist.aliases:
- self.log.debug('Found: %s', '/'.join(list(artist.names)[:4]))
+ self.log.debug('Found aliases: %s', '/'.join(artist.names))
return artist
return None
TODO: Use MusicBrainzID here cf. #30 @gitlab
"""
albums = []
- for name in artist.names:
+ for name in artist.names_sz:
if artist.aliases:
self.log.debug('Searching album for aliase: "%s"', name)
kwalbart = {'albumartist': name, 'artist': name}
if 'Various Artists' in [tr.albumartist for tr in album_trks]:
self.log.debug('Discarding %s ("Various Artists" set)', album)
continue
- if name not in album_artists:
+ if album_artists and name not in album_artists:
self.log.debug('Discarding "%s", "%s" not set as albumartist', album, name)
continue
arts = {trk.artist for trk in album_trks}