Wrap first call of MPD._reset_cache in try/catch, but I don't understand
why...
During first connection, player cache is populated with MPD._reset_cache
Even though the connection to MPD succeed, we can receive a socket.timeout if
the proxy is not reachable (MPD server in satellite mode request another
MPD server for music library requests, for instance during _reset_cache).
The issue here is the OSError (socket.timeout) is not raised as it
should be, ie. wrapped in PlayerError within MPD.__getattr__.
MPD._reset_cache is calling list('artist'), which is actually going
through MPD.__getattr__, but when OSError is raised is is not
wrapped in PlayerError.
Launching mpd-sima against an MPD server on the same host but with a
database proxy over the network can trigger this socket.timeout:
* Start MPD
* Shutdown internet link
* Start mpd-sima
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):