This allows access to the socket FD for polling if it can be written
to/read from. This is useful with, for example, the idle command. Simply
call send_idle(), poll the socket FD with select/poll/etc to check if it's
ready for reading, and if it is, call fetch_idle() to see what changed.
Note that select et al. call fileno() on any objects you pass to them, so
you can simply pass the MPDClient instance itself to these functions
instead of the FD returned by fileno().
self._sock.close()
self._reset()
+ def fileno(self):
+ if not self._sock:
+ raise ConnectionError("Not connected")
+ return self._sock.fileno()
+
def command_list_ok_begin(self):
if self._command_list is not None:
raise CommandListError("Already in command list")