def update_hltb(games): to_put = [] not_in_steam = [] for game in games: title = game['title'] title = title.lower() title = title.replace('amp;', '') title = utils.remove_specials(title) if title in specialcases.hltb_names: title = specialcases.hltb_names[title] curr_game = utils.find_item(title) if curr_game is not None: curr_game.hltburl = game['url'] curr_game.main = game['main'] curr_game.completion = game['completion'] to_put.append(curr_game) else: pass ndb.put_multi(to_put)
def get_games(): """Actually retrieves the games and adds them to the datastore""" stats = utils.retrieve_stats() total_games = 0 games = Games() all_games = games.get_all('us') current_stack = [] for game in all_games: if game.type == 'game': name = game.name.encode('ascii', 'ignore') store_url = create_store_url(game.appid) search_name = utils.remove_specials(name.lower().replace('amp;', '')) new_game = Games_DB(id=game.appid,appid=int(game.appid),game_name=name,image_url=game.header_image, store_url=store_url,price=game.price,search_name=search_name) if int(game.appid) not in mp_games: new_game.multiplayer_only = False else: new_game.multiplayer_only = True current_stack.append(new_game) if len(current_stack) > 250: ndb.put_multi(current_stack) current_stack = [] total_games += 1 stats.total_steam = total_games stats.games_last_updated = datetime.now() stats.put()
def get_games(): """Actually retrieves the games and adds them to the datastore""" stats = utils.retrieve_stats() total_games = 0 games = Games() all_games = games.get_all('us') current_stack = [] for game in all_games: if game.type == 'game': name = game.name.encode('ascii', 'ignore') store_url = create_store_url(game.appid) search_name = utils.remove_specials(name.lower().replace( 'amp;', '')) new_game = Games_DB(id=game.appid, appid=int(game.appid), game_name=name, image_url=game.header_image, store_url=store_url, price=game.price, search_name=search_name) if int(game.appid) not in mp_games: new_game.multiplayer_only = False else: new_game.multiplayer_only = True current_stack.append(new_game) if len(current_stack) > 250: ndb.put_multi(current_stack) current_stack = [] total_games += 1 stats.total_steam = total_games stats.games_last_updated = datetime.now() stats.put()