X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sima%2Fmpdclient.py;h=ebf39a787c6be6905a7bd2f1fdca023ed21a6a26;hb=b8d6a5b81d3ffd38943862d235142821899abb34;hp=4e6af68f37ec2614b71f3114da9746d56ae85af8;hpb=a978d2975c3201dbac0c9e43a08337a800438d2f;p=mpd-sima.git diff --git a/sima/mpdclient.py b/sima/mpdclient.py index 4e6af68..ebf39a7 100644 --- a/sima/mpdclient.py +++ b/sima/mpdclient.py @@ -115,9 +115,12 @@ class MPD(MPDClient): def __getattr__(self, cmd): """Wrapper around MPDClient calls for abstract overriding""" track_wrapped = {'currentsong', 'find', 'playlistinfo', } - if cmd in track_wrapped: - return tracks_wrapper(super().__getattr__(cmd)) - return super().__getattr__(cmd) + try: + if cmd in track_wrapped: + return tracks_wrapper(super().__getattr__(cmd)) + return super().__getattr__(cmd) + except OSError as err: + raise PlayerError(err) def disconnect(self): """Overriding explicitly MPDClient.disconnect()""" @@ -226,10 +229,7 @@ class MPD(MPDClient): * skipped current track skipped """ curr = self.current - try: - ret = self.idle('database', 'playlist', 'player', 'options') - except (PlayerError, OSError) as err: - raise PlayerError("Couldn't init idle: %s" % err) + ret = self.idle('database', 'playlist', 'player', 'options') if self._skipped_track(curr): ret.append('skipped') if 'database' in ret: