mpd.py: support commands with underscores
authorJ. Alexander Treuman <jat@spatialrift.net>
Mon, 13 Dec 2010 23:04:00 +0000 (18:04 -0500)
committerJ. Alexander Treuman <jat@spatialrift.net>
Mon, 13 Dec 2010 23:04:00 +0000 (18:04 -0500)
mpd.py

diff --git a/mpd.py b/mpd.py
index d40b5fa..5973a39 100644 (file)
--- a/mpd.py
+++ b/mpd.py
@@ -157,10 +157,11 @@ class MPDClient(object):
         else:
             command = attr
             wrapper = self._execute
-        command = command.replace("_", " ")
         if command not in self._commands:
-            raise AttributeError("'%s' object has no attribute '%s'" %
-                                 (self.__class__.__name__, attr))
+            command = command.replace("_", " ")
+            if command not in self._commands:
+                raise AttributeError("'%s' object has no attribute '%s'" %
+                                     (self.__class__.__name__, attr))
         return lambda *args: wrapper(command, args)
 
     def _send(self, command, args):