X-Git-Url: https://git.realraum.at/?a=blobdiff_plain;f=update-web-status.py;h=a2e4bebb82359e8d556ef51492f2f88985c3249a;hb=d1d4f8e2439fbe19fca819e9b81ef1e0451dc4c5;hp=ef2535e14ffad2539882d07e705613b4f631f739;hpb=f7e232e0522447ef5719323b9a812fd2424cba8d;p=svn42.git
diff --git a/update-web-status.py b/update-web-status.py
index ef2535e..a2e4beb 100755
--- a/update-web-status.py
+++ b/update-web-status.py
@@ -31,6 +31,7 @@ class UWSConfig:
self.config_parser.set('web','cgiuri','https://www.realraum.at/cgi/status.cgi?pass=jako16&set=')
#~ self.config_parser.set('web','htmlopen','
Tür ist Offen')
#~ self.config_parser.set('web','htmlclosed','Tür ist Geschlossen')
+ self.config_parser.set('web','htmlbored','Panic! Present&Bored')
self.config_parser.set('web','htmlopen','Leute Anwesend')
self.config_parser.set('web','htmlclosed','Keiner Da')
self.config_parser.add_section('debug')
@@ -165,7 +166,10 @@ def displayOpen():
def displayClosed():
setRealraumHtmlStatus(uwscfg.web_htmlclosed)
-
+
+def displayPanic():
+ setRealraumHtmlStatus(uwscfg.web_htmlbored)
+
def exitHandler(signum, frame):
logging.info("Update-Web-Status stopping")
try:
@@ -191,7 +195,9 @@ else:
uwscfg = UWSConfig()
#socket.setdefaulttimeout(10.0) #affects all new Socket Connections (urllib as well)
-RE_STATUS = re.compile(r'Status: (people present|room empty)')
+#RE_STATUS = re.compile(r'Status: (\w+), idle')
+RE_PRESENCE = re.compile(r'Presence: (yes|no)')
+RE_BUTTON = re.compile(r'button\d?')
while True:
try:
if not os.path.exists(uwscfg.tracker_socket):
@@ -212,13 +218,19 @@ while True:
if line == "":
raise Exception("EOF on Socket, daemon seems to have quit")
- m = RE_STATUS.match(line)
+ m = RE_PRESENCE.match(line)
if not m is None:
status = m.group(1)
- if status == "people present":
+ if status == "yes":
displayOpen()
- if status == "room empty":
+ else:
displayClosed()
+ continue
+ m = RE_BUTTON.match(line)
+ if not m is None:
+ displayPanic()
+ continue
+
except Exception, ex:
logging.error("main: "+str(ex))
try: