def initialize(self):
     if self.initialized is not None:
         return self.initialized
     """
     if config.version == 'UNKNOWN':
         logger.warn('无法获取程序版本,请通过 git clone 下载源代码')
         logger.warn('为避免产生统计偏差,已禁用汇报功能')
         self.noop = True
         self.initialized = False
         return Tru
     try:
         logger.info('载入企鹅数据资源...')
         stageapi = penguin_client.StageApi(self.client)
         itemsapi = penguin_client.ItemApi(self.client)
         stages = stageapi.get_all_stages_using_get1()
         items = itemsapi.get_all_items_using_get1()
         for s in stages:
             self.stage_map[s.code] = s
         for i in items:
             self.item_map[i.name] = i
         import imgreco.item
         recognizer_data = imgreco.item.load_data()
         unrecognized_items = (set(self.item_map.keys())) - (set(imgreco.item.all_known_items()) | set(EXTRA_KNOWN_ITEMS))
         if unrecognized_items:
             logger.warn('企鹅数据中存在未识别的物品:%s', ', '.join(unrecognized_items))
             logger.warn('为避免产生统计偏差,已禁用汇报功能')
             self.noop = True
         self.initialized = True
     except:
         logger.error('载入企鹅数据资源出错', exc_info=True)
         self.initialized = False
     return self.initialized
Exemplo n.º 2
0
 def initialize(self):
     if self.initialized is not None:
         return self.initialized
     try:
         logger.info('载入企鹅数据资源...')
         stageapi = penguin_client.StageApi(self.client)
         itemsapi = penguin_client.ItemApi(self.client)
         stages = stageapi.get_all_stages_using_get1()
         items = itemsapi.get_all_items_using_get1()
         for s in stages:
             self.stage_map[s.code] = s
         for i in items:
             self.item_map[i.name] = i
         self.initialized = True
     except:
         logger.error('载入企鹅数据资源出错', exc_info=True)
         self.initialized = False
     return self.initialized