- ret = self.idle('database', 'playlist', 'player', 'options')
- if self._skipped_track(curr):
- ret.append('skipped')
- if 'database' in ret:
- self._reset_cache()
- return ret
+ select_timeout = 5
+ while True:
+ self.send_idle('database', 'playlist', 'player', 'options')
+ _read, _, _ = select([self], [], [], select_timeout)
+ if _read: # tries to read response
+ ret = self.fetch_idle()
+ if self._skipped_track(curr):
+ ret.append('skipped')
+ if 'database' in ret:
+ self._reset_cache()
+ return ret
+ else:
+ try: # noidle cmd does not go through __getattr__, need to catch OSError then
+ self.noidle()
+ except OSError as err:
+ raise PlayerError(err)