Improve output
This commit is contained in:
parent
93283c27f6
commit
1e7c6ebcf7
3 changed files with 7 additions and 3 deletions
|
@ -29,7 +29,7 @@ def read_db_config() -> DBConfig:
|
||||||
Reads the DB connection parameters from the config file.
|
Reads the DB connection parameters from the config file.
|
||||||
"""
|
"""
|
||||||
config_path = get_db_config_path()
|
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():
|
if config_path.exists():
|
||||||
with open(config_path, "r") as f:
|
with open(config_path, "r") as f:
|
||||||
|
@ -175,7 +175,7 @@ def get_config_path():
|
||||||
|
|
||||||
def read_config() -> Config:
|
def read_config() -> Config:
|
||||||
config_path = get_config_path()
|
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():
|
if config_path.exists():
|
||||||
with open(config_path, "r") as f:
|
with open(config_path, "r") as f:
|
||||||
config = yaml.safe_load(f)
|
config = yaml.safe_load(f)
|
||||||
|
|
|
@ -149,7 +149,7 @@ def add_user_name_to_player(hanabi_username: str, player_name: str):
|
||||||
conn_manager.get_connection().commit()
|
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_player_name(player_name)
|
||||||
add_user_name_to_player(user_name, player_name)
|
add_user_name_to_player(user_name, player_name)
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,8 @@ def fetch_games_for_all_players():
|
||||||
for game in player_games:
|
for game in player_games:
|
||||||
games[game['id']] = game
|
games[game['id']] = game
|
||||||
|
|
||||||
|
logger.info("Found {} potential league game(s) to process.".format(len(games)))
|
||||||
|
|
||||||
allowed_variants = database.get_variant_ids()
|
allowed_variants = database.get_variant_ids()
|
||||||
|
|
||||||
# This will hold the processed games that we will add to the database.
|
# 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:
|
if game_info is not None:
|
||||||
good_games[game_id] = game_info
|
good_games[game_id] = game_info
|
||||||
|
|
||||||
|
logger.verbose("Found {} valid league game(s).".format(len(good_games)))
|
||||||
return 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)",
|
"DO UPDATE SET (normalized_username, latest_game_id) = (EXCLUDED.normalized_username, EXCLUDED.latest_game_id)",
|
||||||
latest_game_ids.items()
|
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
|
# 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.
|
# with the actual games stored in the database.
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
Loading…
Reference in a new issue