def _get_streameye_enabled(): global _streameye_enabled if _streameye_enabled is not None: return _streameye_enabled camera_ids = config.get_camera_ids(filter_valid=False) # filter_valid prevents infinte recursion if len(camera_ids) != 1: _streameye_enabled = False return False camera_config = config.get_camera(camera_ids[0], as_lines=True) # as_lines prevents infinte recursion camera_config = config._conf_to_dict(camera_config) if camera_config.get('@proto') != 'mjpeg': _streameye_enabled = False return False if '127.0.0.1:' not in camera_config.get('@url', ''): _streameye_enabled = False return False _streameye_enabled = True return True