add cli to refresh all games
This commit is contained in:
parent
78bdd8397c
commit
a529a72388
2 changed files with 4 additions and 3 deletions
|
@ -49,14 +49,14 @@ def subcommand_generate_config():
|
||||||
config.create_config()
|
config.create_config()
|
||||||
|
|
||||||
|
|
||||||
def subcommand_fetch(target: str):
|
def subcommand_fetch(target: str, refresh: bool = False):
|
||||||
if target in ["all", "players"]:
|
if target in ["all", "players"]:
|
||||||
fetch_players.fetch_players_interactive()
|
fetch_players.fetch_players_interactive()
|
||||||
if target in ["all", "games"]:
|
if target in ["all", "games"]:
|
||||||
games = fetch_games.fetch_games_for_all_players()
|
games = fetch_games.fetch_games_for_all_players()
|
||||||
fetch_games.store_new_games(games)
|
fetch_games.store_new_games(games)
|
||||||
if target in ["all", "game-details"]:
|
if target in ["all", "game-details"]:
|
||||||
fetch_games.fetch_all_game_details()
|
fetch_games.fetch_all_game_details(refresh)
|
||||||
|
|
||||||
|
|
||||||
def subcommand_process_ratings():
|
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 = 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(dest='target', choices=['all', 'players', 'games', 'game-details'], default='all')
|
||||||
|
fetch_parser.add_argument('--refresh', action='store_true')
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ def fetch_games_for_all_players() -> List[GameInfo]:
|
||||||
"FROM user_accounts "
|
"FROM user_accounts "
|
||||||
"LEFT OUTER JOIN downloads "
|
"LEFT OUTER JOIN downloads "
|
||||||
" ON user_accounts.normalized_username = downloads.normalized_username",
|
" 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
|
# This will be a mapping of game id -> JSON data that we get from hanab.live, where we will collect all the
|
||||||
|
|
Loading…
Reference in a new issue