]> kaliko git repositories - python-musicpd.git/commitdiff
adding idle and noidle commands
authorJ. Alexander Treuman <jat@spatialrift.net>
Mon, 1 Jun 2009 22:16:54 +0000 (18:16 -0400)
committerJ. Alexander Treuman <jat@spatialrift.net>
Mon, 1 Jun 2009 22:16:54 +0000 (18:16 -0400)
Note that these commands aren't very usable in their current form.  idle()
blocks while waiting for events, and will thus hang if none are received.
Calling noidle() from another thread will cause idle() to return, but
python-mpd isn't considered re-entrant, so sharing instances between
threads isn't recommended.

doc/commands.txt
mpd.py

index df8058a43869371845038b4b224594961bf0b42d..85a85891248ce81a6026ecd4b1916e85f31b98d4 100644 (file)
@@ -1,6 +1,8 @@
 == Status Commands
 clearerror                         -> getnone
 currentsong                        -> getobject
+idle             <str>             -> getlist
+noidle                             -> None
 status                             -> getobject
 stats                              -> getobject
 
diff --git a/mpd.py b/mpd.py
index 3a5d8675ba195f617bd8c0e37880da071e4c8bf2..ade41a63f168262a7a382b8def45ebc41c7fd373 100644 (file)
--- a/mpd.py
+++ b/mpd.py
@@ -54,6 +54,8 @@ class MPDClient(object):
             # Status Commands
             "clearerror":       self._getnone,
             "currentsong":      self._getobject,
+            "idle":             self._getlist,
+            "noidle":           None,
             "status":           self._getobject,
             "stats":            self._getobject,
             # Playback Option Commands