示例#1
0
def cache_item_stats(self, session=None):
    if session is None:
        session = self.session()
    api = RLGarageAPI()
    api.cache_items()
    items = api.get_item_list(0, 10000, override=True)['items']
    category_map = {
        'car': 1,
        'wheels': 2,
        'boost': 3,
        'topper': 4,
        'antenna': 5,
        'skin': 6,
        'trail': 9,
        'goal_explosion': 10,
        'banner': 11,
        'engine_audio': 12,
    }
    ItemStatsWrapper.create_unpainted_stats(session=session, override=True)
    ItemStatsWrapper.create_unpainted_stats(session=session,
                                            counts=True,
                                            override=True)
    for value in category_map.values():
        ItemStatsWrapper.create_unpainted_stats(value,
                                                session=session,
                                                override=True)
    for key in category_map:
        ItemStatsWrapper.get_most_used_by_column(key,
                                                 session=session,
                                                 override=True)
    for item in items:
        id_ = item['ingameid']
        if id_ is None:
            continue
        print("Item", item)
        try:
            ItemStatsWrapper.get_item_usage_over_time(id_,
                                                      session=session,
                                                      override=True)
        except Exception as e:
            print("Error", e)
    session.close()
示例#2
0
def cache_items(self):
    api = RLGarageAPI()
    api.cache_items()