add cli to refresh all games

This commit is contained in:
Maximilian Keßler 2023-12-26 17:23:53 +01:00
parent 78bdd8397c
commit a529a72388
Signed by: max
GPG Key ID: BCC5A619923C0BA5
2 changed files with 4 additions and 3 deletions

View File

@ -49,14 +49,14 @@ def subcommand_generate_config():
config.create_config()
def subcommand_fetch(target: str):
def subcommand_fetch(target: str, refresh: bool = False):
if target in ["all", "players"]:
fetch_players.fetch_players_interactive()
if target in ["all", "games"]:
games = fetch_games.fetch_games_for_all_players()
fetch_games.store_new_games(games)
if target in ["all", "game-details"]:
fetch_games.fetch_all_game_details()
fetch_games.fetch_all_game_details(refresh)
def subcommand_process_ratings():
@ -105,6 +105,7 @@ def get_parser() -> argparse.ArgumentParser:
fetch_parser = subparsers.add_parser('fetch', help='Fetch new data.')
fetch_parser.add_argument(dest='target', choices=['all', 'players', 'games', 'game-details'], default='all')
fetch_parser.add_argument('--refresh', action='store_true')
return parser

View File

@ -111,7 +111,7 @@ def fetch_games_for_all_players() -> List[GameInfo]:
"FROM user_accounts "
"LEFT OUTER JOIN downloads "
" ON user_accounts.normalized_username = downloads.normalized_username",
(config_manager.get_config().starting_game_id,)
(config_manager.get_config().starting_game_id - 1,)
)
# This will be a mapping of game id -> JSON data that we get from hanab.live, where we will collect all the