From 1e7c6ebcf73e7c7e679ceb6e252f65f3629c64a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Thu, 23 Nov 2023 00:06:00 +0100 Subject: [PATCH] Improve output --- config.py | 4 ++-- database.py | 2 +- fetch_games.py | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/config.py b/config.py index 8252eb4..ebaf39b 100644 --- a/config.py +++ b/config.py @@ -29,7 +29,7 @@ def read_db_config() -> DBConfig: Reads the DB connection parameters from the config file. """ config_path = get_db_config_path() - logger.verbose("DB Configuration read from file {}".format(config_path)) + logger.debug("DB Configuration read from file {}".format(config_path)) if config_path.exists(): with open(config_path, "r") as f: @@ -175,7 +175,7 @@ def get_config_path(): def read_config() -> Config: config_path = get_config_path() - logger.verbose("Hanabi League configuration read from file {}".format(config_path)) + logger.debug("Hanabi League configuration read from file {}".format(config_path)) if config_path.exists(): with open(config_path, "r") as f: config = yaml.safe_load(f) diff --git a/database.py b/database.py index b68021a..b30f951 100644 --- a/database.py +++ b/database.py @@ -149,7 +149,7 @@ def add_user_name_to_player(hanabi_username: str, player_name: str): conn_manager.get_connection().commit() -def add_player(player_name: str, user_name: str): +def add_player(user_name: str, player_name: str): add_player_name(player_name) add_user_name_to_player(user_name, player_name) diff --git a/fetch_games.py b/fetch_games.py index f39add5..6b61065 100644 --- a/fetch_games.py +++ b/fetch_games.py @@ -113,6 +113,8 @@ def fetch_games_for_all_players(): for game in player_games: games[game['id']] = game + logger.info("Found {} potential league game(s) to process.".format(len(games))) + allowed_variants = database.get_variant_ids() # This will hold the processed games that we will add to the database. @@ -123,6 +125,7 @@ def fetch_games_for_all_players(): if game_info is not None: good_games[game_id] = game_info + logger.verbose("Found {} valid league game(s).".format(len(good_games))) return good_games @@ -171,6 +174,7 @@ def store_new_games(games: Dict[int, GameInfo]): "DO UPDATE SET (normalized_username, latest_game_id) = (EXCLUDED.normalized_username, EXCLUDED.latest_game_id)", latest_game_ids.items() ) + logger.info("Added {} game(s) to database.".format(len(games))) # We only commit after performing all insertions. This guarantees that the download table is always in sync # with the actual games stored in the database. conn.commit()