error sound
[svn42.git] / play-sound-status.py
index d0ecf2a..535c449 100755 (executable)
@@ -197,6 +197,8 @@ def executeAction(action_name, args=[]):
     return runRemoteCommand(uwscfg.getValue(action_name+"_remote_host"), uwscfg.getValue(action_name+"_remote_shell"), args)
   elif action_type == "shellcmd":
     return runShellCommand(cmd=uwscfg.getValue(action_name+"_cmd"), ptimeout=uwscfg.getValue(action_name+"_timeout"), stdinput=uwscfg.getValue(action_name+"_stdinput"), args=args)
+  elif action_type == "nothing":
+    return True
   else:
     return executeAction(action_type,args)
   
@@ -207,7 +209,7 @@ def playThemeOf(user):
   if config is None:
     config=uwscfg.getValue("mapping_default")
   logging.debug("playThemeOf: action for user %s: %s" % (user,config))
-  executeAction(config)
+  executeAction(config,[])
 
 def popenTimeout1(cmd, pinput, returncode_ok=[0], ptimeout = 20.0, pcheckint = 0.25):
   logging.debug("popenTimeout1: starting: " + cmd)
@@ -292,7 +294,9 @@ else:
 #socket.setdefaulttimeout(10.0) #affects all new Socket Connections (urllib as well)
 RE_PRESENCE = re.compile(r'Presence: (yes|no)(?:, (opened|closed), (.+))?')
 RE_BUTTON = re.compile(r'PanicButton|button\d?')
-RE_REQUEST = re.compile(r'Request: (\w+) (?:(Card|Phone) )?(.+)')
+#RE_REQUEST = re.compile(r'Request: (\w+) (?:(Card|Phone) )?(.+)')
+RE_ERROR = re.compile(r'Error: (.+)')
+
 while True:
   try:
     if not os.path.exists(uwscfg.tracker_socket):
@@ -328,6 +332,11 @@ while True:
       if not m is None:
         playThemeOf(user="panic")
       continue
+
+      m = RE_ERROR.match(line)
+      if not m is None:
+        playThemeOf(user="error")
+      continue
                 
   except Exception, ex:
     logging.error("main: "+str(ex))