X-Git-Url: http://git.kaliko.me/?p=python-musicpd.git;a=blobdiff_plain;f=README.rst;h=2bd88dce0ac714c31bee7c2fbfd5befcbaec3732;hp=a926514908ef9fe257a906815416c673f3f870c1;hb=3f041f016053b04b6d6800186a27a7c0700e475c;hpb=a0e88963aa60b475a13d831cb108ccb49c267dd3 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\_* and a *fetch\_* 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 ------------------