diff options
-rw-r--r-- | gui/muxconfig.py | 32 | ||||
-rwxr-xr-x | gui/odr-dabmux-gui.py | 22 |
2 files changed, 27 insertions, 27 deletions
diff --git a/gui/muxconfig.py b/gui/muxconfig.py index 62f182f..3888a6c 100644 --- a/gui/muxconfig.py +++ b/gui/muxconfig.py @@ -28,7 +28,7 @@ class General(object): def __init__(self, pt): ptree = pt['general'] for fieldname in [ - "nbframes", + "nbframes", "statsserverport", "writescca", "tist", @@ -46,7 +46,7 @@ class Service(object): self.name = name for fieldname in [ - "id", + "id", "label", "shortlabel", "pty", @@ -61,7 +61,7 @@ class Subchannel(object): def __init__(self, name, ptree): self.name = name for fieldname in [ - "type", + "type", "inputfile", "zmq-buffer", "zmq-prebuffering", @@ -106,22 +106,22 @@ class ConfigurationHandler(object): #self.sock.connect("tcp://{}:{}".format(self._host, self._port)) def zRead(self, key): - self._ctx = zmq.Context() + self._ctx = zmq.Context() self.sock = zmq.Socket(self._ctx, zmq.REQ) self.sock.setsockopt(zmq.LINGER, 0) self.sock.connect("tcp://{}:{}".format(self._host, self._port)) - self.sock.send(key) - - # use poll for timeouts: - poller = zmq.Poller() - poller.register(self.sock, zmq.POLLIN) - if poller.poll(5*1000): # 5s timeout in milliseconds - recv = self.sock.recv() - self.sock.close() - self._ctx.term() - return recv - else: - raise IOError("Timeout processing ZMQ request") + self.sock.send(key) + + # use poll for timeouts: + poller = zmq.Poller() + poller.register(self.sock, zmq.POLLIN) + if poller.poll(5*1000): # 5s timeout in milliseconds + recv = self.sock.recv() + self.sock.close() + self._ctx.term() + return recv + else: + raise IOError("Timeout processing ZMQ request") def load(self): """Load the configuration from the multiplexer and save it locally""" diff --git a/gui/odr-dabmux-gui.py b/gui/odr-dabmux-gui.py index 5a3de76..85098f8 100755 --- a/gui/odr-dabmux-gui.py +++ b/gui/odr-dabmux-gui.py @@ -114,15 +114,15 @@ def send_static(filename): if __name__ == '__main__': - # Get configuration file in argument - parser = argparse.ArgumentParser(description='management server for ODR-DabMux') - parser.add_argument('--host', default='127.0.0.1', help='socket host (default: 127.0.0.1)',required=False) - parser.add_argument('--port', default='8000', help='socket port (default: 8000)',required=False) - parser.add_argument('--mhost', default='127.0.0.1', help='mux host (default: 127.0.0.1)',required=False) - parser.add_argument('--mport', default='12720', help='mux port (default: 12720)',required=False) - cli_args = parser.parse_args() - - conf = ConfigurationHandler(cli_args.mhost, cli_args.mport) - - run(host=cli_args.host, port=int(cli_args.port), debug=True, reloader=False) + # Get configuration file in argument + parser = argparse.ArgumentParser(description='management server for ODR-DabMux') + parser.add_argument('--host', default='127.0.0.1', help='socket host (default: 127.0.0.1)',required=False) + parser.add_argument('--port', default='8000', help='socket port (default: 8000)',required=False) + parser.add_argument('--mhost', default='127.0.0.1', help='mux host (default: 127.0.0.1)',required=False) + parser.add_argument('--mport', default='12720', help='mux port (default: 12720)',required=False) + cli_args = parser.parse_args() + + conf = ConfigurationHandler(cli_args.mhost, cli_args.mport) + + run(host=cli_args.host, port=int(cli_args.port), debug=True, reloader=False) |