Media Player - MPD: handle more exceptions (#2045)

This commit is contained in:
happyleavesaoc 2016-05-11 21:53:56 -07:00 committed by Paulus Schoutsen
parent f9d97c4356
commit c341ae0a39

View file

@ -89,7 +89,13 @@ class MpdDevice(MediaPlayerDevice):
try:
self.status = self.client.status()
self.currentsong = self.client.currentsong()
except mpd.ConnectionError:
except (mpd.ConnectionError, BrokenPipeError, ValueError):
# Cleanly disconnect in case connection is not in valid state
try:
self.client.disconnect()
except mpd.ConnectionError:
pass
self.client.connect(self.server, self.port)
if self.password is not None: