better osc message cmds

This commit is contained in:
Stefan Kögl 2014-03-08 15:08:25 +01:00
parent 1c6b7157e8
commit 099cb06741
1 changed files with 12 additions and 15 deletions

View File

@ -113,21 +113,18 @@ class OSC2CamServer(SimpleOSCServer):
def dispatchMessage(self, osc_address, typetags, args, packet, client_address): def dispatchMessage(self, osc_address, typetags, args, packet, client_address):
""" dispatches parsed osc messages to the ip cam command methods""" """ dispatches parsed osc messages to the ip cam command methods"""
rule = re.compile("^/(.*?)/(\d+)/(.*?)$")
res = rule.match(osc_address) cam_id = args.pop(0)
if res: if osc_address == "/moveCam":
_, cam_id, command = res.groups() self.move_cam(cam_id, args)
cam_id = int(cam_id) elif osc_address == "/setCamPreset":
if command == "moveCam": self.set_cam_preset(cam_id, args)
self.move_cam(cam_id, args) elif osc_address == "/useCamPreset":
elif command == "setCamPreset": self.use_cam_preset(cam_id, args)
self.set_cam_preset(cam_id, args) elif osc_address == "/zoomCam":
elif command == "useCamPreset": self.zoom_cam(cam_id, args)
self.use_cam_preset(cam_id, args) elif osc_address == "/toggleNightView":
elif command == "zoomCam": self.toggle_night_view(cam_id, args)
self.zoom_cam(cam_id, args)
elif command == "toggleNightView":
self.toggle_night_view(cam_id, args)
def main(): def main():