From: kaliko Date: Thu, 17 Dec 2020 14:50:18 +0000 (+0100) Subject: MPD client: Update name and aliases in case of discrepancy X-Git-Tag: 0.16.1~14 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=5cbeb934dbc769c924787f900d3db1a6508a2d09;p=mpd-sima.git MPD client: Update name and aliases in case of discrepancy When MPD library returns an artist name different from the name used in the query, an alias is add in addition to name update. --- diff --git a/sima/mpdclient.py b/sima/mpdclient.py index 0c2e0b2..a022949 100644 --- a/sima/mpdclient.py +++ b/sima/mpdclient.py @@ -390,8 +390,11 @@ class MPD(MPDClient): if len(library) > 1: self.log.debug('I got "%s" searching for %r', library, artist) elif len(library) == 1 and library[0] != artist.name: + new_alias = artist.name self.log.info('Update artist name %s->%s', artist, library[0]) + self.log.debug('Also add alias for %s: %s', artist, new_alias) artist = Artist(name=library[0], mbid=artist.mbid) + artist.add_alias(new_alias) # Fetches remaining artists for potential match artists = self._cache['nombid_artists'] else: # not using MusicBrainzIDs