diff --git a/analyze_wotb_replays.py b/analyze_wotb_replays.py index c0bcabf..8ddd7e1 100644 --- a/analyze_wotb_replays.py +++ b/analyze_wotb_replays.py @@ -550,6 +550,16 @@ async def main(argv): except (KeyError, configparser.NoSectionError) as err: bu.error(exception=err) + try: + if 'ANALYZER' in config.sections(): + configAnalyzer = config['ANALYZER'] + histogram_fields_str = configAnalyzer.get('histogram_buckets', None) + if histogram_fields_str != None: + set_histogram_buckets(json.loads(histogram_fields_str)) + + except (KeyError, configparser.NoSectionError) as err: + bu.error(exception=err) + try: if 'WG' in config.sections(): configWG = config['WG'] @@ -690,6 +700,17 @@ async def main(argv): if wi != None: await wi.close() return None + +def set_histogram_buckets(json: dict): + global histogram_fields + try: + for field in json.keys(): + histogram_fields[field][1] = json[field] + except (KeyError, Exception) as err: + bu.error(exception=err) + return histogram_fields + + def process_player_dist(results: list, player_stats: dict, stat_id_map: dict): """Process player distribution""" hist_stats = dict() diff --git a/blitzstats.ini.default b/blitzstats.ini.default index 8793231..bb2c576 100644 --- a/blitzstats.ini.default +++ b/blitzstats.ini.default @@ -1,3 +1,6 @@ +## Configuration file for blitz-tools +## Rename it 'blitzstats.ini' and place it to the same directory with the scripts + [OPTIONS] ## You may set your preferred commandline param defaults here #opt_analyzer_extended = False @@ -5,17 +8,22 @@ #opt_analyzer_stat_func = player [WG] - -## Find your WG account_id : https://developers.wargaming.net/reference/all/wotb/account/list/ -# wg_id = 0 - ## wg_account format: nick@server, where server is either 'eu', 'ru', 'na', 'asia' or 'china'. ## China is not supported since WG API stats are not available there # wg_account = your_nick@eu +## Find your WG account_id : https://developers.wargaming.net/reference/all/wotb/account/list/ +## set either wg_account OR wg_id +# wg_id = 0 + ## WG API limits requests / sec to 10 for mobile apps. ## You can register your "own" server app and ## upgrade the rate limit to 20 requests / sec. ## Check https://developers.wargaming.net/documentation/guide/getting-started/ # wg_app_id = XXXXXXXXXXX +[ANALYZER] +## Define histogram buckets. Valid JSON required. The last field is the maximum, therefore very large. +# histogram_buckets = { "wins" : [ 0, 0.40, 0.5, 0.60, 0.70, 1], +# "damage_dealt" : [ 0, 500, 1000, 1500, 2000, 1000000], +# "battles" : [ 0, 1000, 5000, 10000, 15e3, 1e6 ] }