]> kaliko git repositories - mpd-sima.git/commitdiff
MPD client: Update name and aliases in case of discrepancy
authorkaliko <kaliko@azylum.org>
Thu, 17 Dec 2020 14:50:18 +0000 (15:50 +0100)
committerkaliko <kaliko@azylum.org>
Thu, 17 Dec 2020 14:59:30 +0000 (15:59 +0100)
When MPD library returns an artist name different from the name used in
the query, an alias is add in addition to name update.

sima/mpdclient.py

index 0c2e0b2223c8b59d59108eda4e3c40c3a5ee7bab..a0229496681f44a1fac95371b33a325a75426e15 100644 (file)
@@ -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