From: Kaliko Jack <kaliko@azylum.org>
Date: Tue, 17 Jun 2014 14:37:14 +0000 (+0200)
Subject: Document send_*/fetch_* and idle commands
X-Git-Tag: v0.4.1~1
X-Git-Url: http://git.kaliko.me/?a=commitdiff_plain;h=3f041f016053b04b6d6800186a27a7c0700e475c;p=python-musicpd.git

Document send_*/fetch_* and idle commands
---

diff --git a/README.rst b/README.rst
index a926514..2bd88dc 100644
--- a/README.rst
+++ b/README.rst
@@ -62,6 +62,25 @@ Commands may also return iterators instead of lists if `iterate` is set to
     for song in client.playlistinfo():
         print song['file']
 
+Each command have a *send\_<CMD>* and a *fetch\_<CMD>* variant, which allows to
+send a MPD command and then fetch the result later.
+This is useful for the idle command::
+
+    >>> client.send_idle()
+    # do something else or use function like select()
+    # http://docs.python.org/howto/sockets.html#non-blocking-sockets
+    # ex. select([client], [], [])
+    >>> events = client.fetch_idle()
+
+    # more complex use for example, with glib/gobject:
+    >>> def callback(source, condition):
+    >>>    changes = client.fetch_idle()
+    >>>    print changes
+    >>>    return False  # removes the IO watcher
+
+    >>> client.send_idle()
+    >>> gobject.io_add_watch(client, gobject.IO_IN, callback)
+    >>> gobject.MainLoop().run()
 
 Contacting authors
 ------------------