diff --git a/get_data.py b/get_data.py index 5d51f8f..bd88076 100644 --- a/get_data.py +++ b/get_data.py @@ -848,38 +848,38 @@ def Json_Team_Generation(who, data, stop_event): player_season_stat = [] player_career_stat = [] coach_stat = [] - with ThreadPoolExecutor() as pool: + with ThreadPoolExecutor(max_workers=1) as pool: player_season_stat_temp = [ pool.submit(Player_Stat_Season, player_id, data["season"]) for player_id in player_ids ] - player_career_stat_temp = [ - pool.submit(Player_Stat_Career, player_id) - for player_id in player_ids - ] - coach_stat_temp = [ - pool.submit( - Coach_Stat, coach_id, data["season"], data[f"{who}_id"] - ) - for coach_id in coach_ids - ] - player_futures = [ - pool.submit(Player_all_game, pid) for pid in player_ids - ] - all_players_games = [] - for fut in as_completed(player_futures): - try: - all_players_games.append(fut.result()) - except Exception as e: - logger.exception(f"Ошибка при обработке игрока: {e}") + # player_career_stat_temp = [ + # pool.submit(Player_Stat_Career, player_id) + # for player_id in player_ids + # ] + # coach_stat_temp = [ + # pool.submit( + # Coach_Stat, coach_id, data["season"], data[f"{who}_id"] + # ) + # for coach_id in coach_ids + # ] + # player_futures = [ + # pool.submit(Player_all_game, pid) for pid in player_ids + # ] + # all_players_games = [] + # for fut in as_completed(player_futures): + # try: + # all_players_games.append(fut.result()) + # except Exception as e: + # logger.exception(f"Ошибка при обработке игрока: {e}") - player_season_stat += [ - res.result() for res in player_season_stat_temp - ] - player_career_stat += [ - res.result() for res in player_career_stat_temp - ] - coach_stat += [res.result() for res in coach_stat_temp] + # player_season_stat += [ + # res.result() for res in player_season_stat_temp + # ] + # player_career_stat += [ + # res.result() for res in player_career_stat_temp + # ] + # coach_stat += [res.result() for res in coach_stat_temp] initialized = True # print(coach_stat) @@ -1637,8 +1637,8 @@ def Json_Team_Generation(who, data, stop_event): x.get("startRole", 99), 99 ), # 99 — по умолчанию ) - rewrite_file(who, sorted_team) # type: ignore - rewrite_file(f"{who}_copy", sorted_team) # type: ignore + rewrite_file(who, sorted_team) + rewrite_file(f"{who}_copy", sorted_team) # print(sorted_team) top_sorted_team = sorted( filter(lambda x: x["startRole"] in ["Player", ""], sorted_team), @@ -2709,7 +2709,7 @@ def get_season_and_schedule() -> dict | None: if season_data and "vtb" in URL else ( season_data.get("items", [{}])[0].get("season") - if season_data and "pro.russiabasket" in URL + if season_data and "russiabasket" in URL else None ) ) @@ -3045,7 +3045,7 @@ def main(): URL = ( "https://basket.sportoteka.org/" if "uba" in LEAGUE.lower() - else "https://pro.russiabasket.org/" + else "https://ref.russiabasket.org/" #pro - основа, ref - резерв # else "https://vtb-league.org/" )