X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fmpdclient.py;h=cced48c34e4df1f77ba1c962b4520246c6e43d5f;hb=db35ea171e147ed3d65bdab0e2f14caaf96582f9;hp=0e7988b10f49b705ce14daa15334b7d27f680816;hpb=3789dbc5bd98f86c3243bc478b4cd55532bac85c;p=mpd-sima.git diff --git a/sima/mpdclient.py b/sima/mpdclient.py index 0e7988b..cced48c 100644 --- a/sima/mpdclient.py +++ b/sima/mpdclient.py @@ -149,7 +149,7 @@ class MPD(MPDClient): # ConnectionError and ProtocolError are always fatal. Others may not # be, but we don't know how to handle them here, so treat them as if # they are instead of ignoring them. - except MPDError as err: + except PlayerError as err: raise PlayerError(f'Could not connect to "{host}:{port}": {err}') from err if password: try: @@ -189,7 +189,13 @@ class MPD(MPDClient): self.log.warning('Use of MusicBrainzIdentifier disabled!') self.log.info('Consider using MusicBrainzIdentifier for your music library') self.use_mbid = Meta.use_mbid = False - self._reset_cache() + # TODO: Why do I need to intercept OSError here? + # why is it not wrapped in PlayerError in __getattr__? + # (cf. commit message for more) + try: + self._reset_cache() + except OSError as err: + raise PlayerError(f'Error during cache init: {err}') from err # ######### / Overriding MPDClient ######### def _reset_cache(self): @@ -422,12 +428,6 @@ class MPD(MPDClient): if SimaStr(artist.name) == name and name != artist.name: self.log.debug('add alias for %s: %s', artist, name) artist.add_alias(name) - 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