mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-24 19:49:52 +02:00
Renaming of config file params, clean-up
This commit is contained in:
1 parent
ff81e7d1f9
commit
45756a451f
3 files changed
+13
-18
No files matched your search
@@ -483,9 +483,10 @@ async def main(argv):
|
|||||||
# WG account id of the uploader:
|
# WG account id of the uploader:
|
||||||
# # Find it here: https://developers.wargaming.net/reference/all/wotb/account/list/
|
# # Find it here: https://developers.wargaming.net/reference/all/wotb/account/list/
|
||||||
OPT_DB = configOptions.getboolean('opt_DB', False)
|
OPT_DB = configOptions.getboolean('opt_DB', False)
|
||||||
OPT_EXTENDED = configOptions.getboolean('opt_extended', False)
|
OPT_EXTENDED = configOptions.getboolean('opt_analyzer_extended', False)
|
||||||
OPT_HIST = configOptions.getboolean('opt_hist', False)
|
OPT_HIST = configOptions.getboolean('opt_analyzer_hist', False)
|
||||||
OPT_STAT_FUNC = configOptions.get('opt_stat_func', fallback='tank_tier')
|
OPT_STAT_FUNC = configOptions.get('opt_analyzer_stat_func', fallback='player')
|
||||||
|
OPT_WORKERS_N = configOptions.getint('opt_analyzer_workers', 10)
|
||||||
|
|
||||||
configWG = config['WG']
|
configWG = config['WG']
|
||||||
WG_ID = configWG.getint('wg_id', None)
|
WG_ID = configWG.getint('wg_id', None)
|
||||||
@@ -504,8 +505,6 @@ async def main(argv):
|
|||||||
DB_CERT = configDB.get('db_ssl_cert_file', None)
|
DB_CERT = configDB.get('db_ssl_cert_file', None)
|
||||||
DB_CA = configDB.get('db_ssl_ca_file', None)
|
DB_CA = configDB.get('db_ssl_ca_file', None)
|
||||||
|
|
||||||
TASK_N = 7
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Analyze Blitz replay JSONs from WoTinspector.com')
|
parser = argparse.ArgumentParser(description='Analyze Blitz replay JSONs from WoTinspector.com')
|
||||||
parser.add_argument('--output', default='plain', choices=['json', 'plain', 'db'], help='Select output mode: JSON, plain text or database')
|
parser.add_argument('--output', default='plain', choices=['json', 'plain', 'db'], help='Select output mode: JSON, plain text or database')
|
||||||
parser.add_argument('-id', dest='account_id', type=int, default=WG_ID, help='WG account_id to analyze')
|
parser.add_argument('-id', dest='account_id', type=int, default=WG_ID, help='WG account_id to analyze')
|
||||||
@@ -569,7 +568,7 @@ async def main(argv):
|
|||||||
scanner_task = asyncio.create_task(mk_replayQ(replayQ, args, db))
|
scanner_task = asyncio.create_task(mk_replayQ(replayQ, args, db))
|
||||||
bu.debug('Replay scanner started')
|
bu.debug('Replay scanner started')
|
||||||
# Start tasks to process the Queue
|
# Start tasks to process the Queue
|
||||||
for i in range(TASK_N):
|
for i in range(OPT_WORKERS_N):
|
||||||
reader_tasks.append(asyncio.create_task(replay_reader(replayQ, i, args)))
|
reader_tasks.append(asyncio.create_task(replay_reader(replayQ, i, args)))
|
||||||
bu.debug('ReplayReader ' + str(i) + ' started')
|
bu.debug('ReplayReader ' + str(i) + ' started')
|
||||||
|
|
||||||
@@ -589,7 +588,7 @@ async def main(argv):
|
|||||||
results.extend(res[0])
|
results.extend(res[0])
|
||||||
players.update(res[1])
|
players.update(res[1])
|
||||||
|
|
||||||
(player_stats, stat_id_map) = await process_player_stats(players, TASK_N, args, db)
|
(player_stats, stat_id_map) = await process_player_stats(players, OPT_WORKERS_N, args, db)
|
||||||
bu.verbose('')
|
bu.verbose('')
|
||||||
bu.debug('Number of player stats: ' + str(len(player_stats)))
|
bu.debug('Number of player stats: ' + str(len(player_stats)))
|
||||||
teamresults = calc_team_stats(results, player_stats, stat_id_map, args)
|
teamresults = calc_team_stats(results, player_stats, stat_id_map, args)
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
[OPTIONS]
|
[OPTIONS]
|
||||||
## You may set your preferred commandline param defaults here
|
## You may set your preferred commandline param defaults here
|
||||||
#opt_extended = False
|
#opt_analyzer_extended = False
|
||||||
#opt_hist = False
|
#opt_analyzer_hist = False
|
||||||
#opt_stat_func = tank_tier
|
#opt_analyzer_stat_func = player
|
||||||
|
|
||||||
[WG]
|
[WG]
|
||||||
## Find your WG account_id : https://developers.wargaming.net/reference/all/wotb/account/list/
|
## Find your WG account_id : https://developers.wargaming.net/reference/all/wotb/account/list/
|
||||||
#wg_id = 0
|
#wg_id = 0
|
||||||
## WG API limits requests / sec to 10 for client apps
|
## WG API limits requests / sec to 10 for client apps
|
||||||
## Check https://developers.wargaming.net/documentation/guide/getting-started/
|
## Check https://developers.wargaming.net/documentation/guide/getting-started/
|
||||||
#wg_rate_limit = 10
|
|
||||||
#wg_app_id = XXXXXXXXXXX
|
#wg_app_id = XXXXXXXXXXX
|
||||||
|
|
||||||
@@ -14,7 +14,6 @@ FILE_CONFIG = 'blitzstats.ini'
|
|||||||
DEBUG = False
|
DEBUG = False
|
||||||
VERBOSE = False
|
VERBOSE = False
|
||||||
SLEEP = 2
|
SLEEP = 2
|
||||||
N_WORKERS = 5
|
|
||||||
MAX_RETRIES = 3
|
MAX_RETRIES = 3
|
||||||
REPLAY_N = 0
|
REPLAY_N = 0
|
||||||
SKIPPED_N = 0
|
SKIPPED_N = 0
|
||||||
@@ -33,6 +32,9 @@ async def main(argv):
|
|||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(FILE_CONFIG)
|
config.read(FILE_CONFIG)
|
||||||
|
|
||||||
|
configOptions = config['OPTIONS']
|
||||||
|
OPT_WORKERS_N = configOptions.getint('opt_uploader_workers', 5)
|
||||||
|
|
||||||
configWG = config['WG']
|
configWG = config['WG']
|
||||||
# WG account id of the uploader:
|
# WG account id of the uploader:
|
||||||
# # Find it here: https://developers.wargaming.net/reference/all/wotb/account/list/
|
# # Find it here: https://developers.wargaming.net/reference/all/wotb/account/list/
|
||||||
@@ -41,15 +43,12 @@ async def main(argv):
|
|||||||
WG_RATE_LIMIT = configWG.getint('wg_rate_limit', 10)
|
WG_RATE_LIMIT = configWG.getint('wg_rate_limit', 10)
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Post replays(s) to WoTinspector.com and retrieve battle data')
|
parser = argparse.ArgumentParser(description='Post replays(s) to WoTinspector.com and retrieve battle data')
|
||||||
#parser.add_argument('--output', default='file', choices=['file', 'files', 'db'] , help='Select output mode: single/multiple files or database')
|
|
||||||
parser.add_argument('-id', dest='accountID', type=int, default=WG_ID, help='WG account_id')
|
parser.add_argument('-id', dest='accountID', type=int, default=WG_ID, help='WG account_id')
|
||||||
parser.add_argument('-a', '--account', dest='account', type=str, default=None, help='Uploader\'s WG account name. Format: ACCOUNT_NAME@SERVER')
|
parser.add_argument('-a', '--account', dest='account', type=str, default=None, help='Uploader\'s WG account name. Format: ACCOUNT_NAME@SERVER')
|
||||||
parser.add_argument('-t','--title', type=str, default=None, help='Title for replays. Use NN for continous numbering. Default is filename-based numbering')
|
parser.add_argument('-t','--title', type=str, default=None, help='Title for replays. Use NN for continous numbering. Default is filename-based numbering')
|
||||||
parser.add_argument('-p', '--private', dest="private", action='store_true', default=False, help='Set replays private on WoTinspector.com')
|
parser.add_argument('-p', '--private', dest="private", action='store_true', default=False, help='Set replays private on WoTinspector.com')
|
||||||
parser.add_argument('--tasks', dest='N_tasks', type=int, default=N_WORKERS, help='Number of worker threads')
|
|
||||||
parser.add_argument('--tankopedia', type=str, default='tanks.json', help='JSON file to read Tankopedia from. Default: "tanks.json"')
|
parser.add_argument('--tankopedia', type=str, default='tanks.json', help='JSON file to read Tankopedia from. Default: "tanks.json"')
|
||||||
parser.add_argument('--mapfile', type=str, default='maps.json', help='JSON file to read Blitz map names from. Default: "maps.json"')
|
parser.add_argument('--mapfile', type=str, default='maps.json', help='JSON file to read Blitz map names from. Default: "maps.json"')
|
||||||
# parser.add_argument('--db', action='store_true', default=USE_DB, help='Use DB - You are unlikely to have it')
|
|
||||||
parser.add_argument('-d', '--debug', action='store_true', default=False, help='Debug mode')
|
parser.add_argument('-d', '--debug', action='store_true', default=False, help='Debug mode')
|
||||||
parser.add_argument('-v', '--verbose', action='store_true', default=False, help='Verbose mode')
|
parser.add_argument('-v', '--verbose', action='store_true', default=False, help='Verbose mode')
|
||||||
parser.add_argument('-s', '--silent', action='store_true', default=False, help='Silent mode')
|
parser.add_argument('-s', '--silent', action='store_true', default=False, help='Silent mode')
|
||||||
@@ -76,8 +75,7 @@ async def main(argv):
|
|||||||
# Make replay Queue
|
# Make replay Queue
|
||||||
tasks.append(asyncio.create_task(mkReplayQ(queue, args.files, args.title)))
|
tasks.append(asyncio.create_task(mkReplayQ(queue, args.files, args.title)))
|
||||||
# Start tasks to process the Queue
|
# Start tasks to process the Queue
|
||||||
for i in range(args.N_tasks):
|
for i in range(OPT_WORKERS_N):
|
||||||
#tasks.append(asyncio.create_task(replayWorker(queue, db, i, args.accountID, args.private)))
|
|
||||||
tasks.append(asyncio.create_task(replayWorker(queue, i, args.accountID, args.private)))
|
tasks.append(asyncio.create_task(replayWorker(queue, i, args.accountID, args.private)))
|
||||||
bu.debug('Task ' + str(i) + ' started')
|
bu.debug('Task ' + str(i) + ' started')
|
||||||
|
|
||||||
@@ -164,7 +162,6 @@ async def replayWorker(queue: asyncio.Queue, workerID: int, account_id: int, pri
|
|||||||
|
|
||||||
#bu.debug(msg_str + replay_json_fn)
|
#bu.debug(msg_str + replay_json_fn)
|
||||||
try:
|
try:
|
||||||
#if os.path.exists(replay_json_fn) and os.path.isfile(replay_json_fn):
|
|
||||||
if os.path.isfile(replay_json_fn):
|
if os.path.isfile(replay_json_fn):
|
||||||
async with aiofiles.open(replay_json_fn) as fp:
|
async with aiofiles.open(replay_json_fn) as fp:
|
||||||
replay_json = json.loads(await fp.read())
|
replay_json = json.loads(await fp.read())
|
||||||
|
|||||||
Reference in new issue
Block a user