コード例 #1
0
 def start_bcs_collect_data(self):
     logger.info("Sync with Bridgemate Control Software")
     current_round = self.scheduler.get_current_round()
     bws_path = get_project_file_path(self.project_name, str(current_round) + '.bws')
     
     self.bcs = BCSManager(bws_path)
     self.bcs.open()
コード例 #2
0
    def __init__(self, project_name):
        config_path = get_project_file_path(project_name, 'config.json')
        super(ProjectConfig, self).__init__(config_path)

        # first init
        if not "project_name" in self.keys():
            self.project_name = project_name
            self.setup('TM', 0, 8, "CustomScheduler", {"match":[], "round_count":0, "current_round":0}, [], 1, 8, 1, 'A')
コード例 #3
0
 def get_bcs_data(self):
     # Sync data
     if self.is_bcs_alive():
         current_round = self.scheduler.get_current_round()
         bws_path = get_project_file_path(self.project_name, str(current_round) + '.bws')
         bws = BWS(bws_path)
         data_ary = bws.get_recevied_date()
         logger.info("Get Data")
         for data in data_ary:
             logger.info("Data: %s" % str(data))
         bcs_config_path = get_project_file_path(self.project_name, "round"+str(current_round) + '.json')
         bcs_config = BCSConfig(bcs_config_path)
         bcs_config.load_from_bcsdata_array(data_ary)
         bcs_config.write()
         return data_ary
     else:
         return None
コード例 #4
0
 def init_bws_file(self):
     logger.info("Init .bws file")
     self.scheduler.set_match(self.config.scheduler_metadata["match"])
     self.config.write()
     current_round = self.scheduler.get_current_round()
     print self.scheduler.get_match_by_round(current_round)
     bws_path = get_project_file_path(self.project_name, str(current_round) + '.bws')
     bws = BWS(bws_path)
     bws.fill_section(current_round=current_round,
                     board_start=self.config.start_board_number,
                     board_end=self.config.start_board_number+self.config.board_count - 1,
                     section_id=self.config.section_id,
                     section_letter=self.config.section_letter,
                     matches=self.scheduler.get_match_by_round(current_round))
コード例 #5
0
def init_logger(project_name):
    global __logger__

    __logger__ = logging.getLogger(project_name)
    __logger__.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(asctime)s %(levelname)s [%(module)s - %(funcName)s] %(message)s @%(filename)s(%(lineno)d)')

    # Set console to INFO level
    console = logging.StreamHandler()
    console.setLevel(logging.INFO)
    console.setFormatter(formatter)
    __logger__.addHandler(console)


    # Set .log file to DEBUG level
    logfile = logging.FileHandler( get_project_file_path(project_name, 'log.txt') )
    logfile.setLevel(logging.DEBUG)
    logfile.setFormatter(formatter)
    __logger__.addHandler(logfile)

    return __logger__