mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-23 19:19:53 +02:00
Merge pull request #24 from Jylpah/staging
Config file: Histogram bucket support
This commit is contained in:
2 files changed
+33
-4
No files matched your search
@@ -550,6 +550,16 @@ async def main(argv):
|
|||||||
except (KeyError, configparser.NoSectionError) as err:
|
except (KeyError, configparser.NoSectionError) as err:
|
||||||
bu.error(exception=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:
|
try:
|
||||||
if 'WG' in config.sections():
|
if 'WG' in config.sections():
|
||||||
configWG = config['WG']
|
configWG = config['WG']
|
||||||
@@ -690,6 +700,17 @@ async def main(argv):
|
|||||||
if wi != None: await wi.close()
|
if wi != None: await wi.close()
|
||||||
return None
|
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):
|
def process_player_dist(results: list, player_stats: dict, stat_id_map: dict):
|
||||||
"""Process player distribution"""
|
"""Process player distribution"""
|
||||||
hist_stats = dict()
|
hist_stats = dict()
|
||||||
|
|||||||
+12
-4
@@ -1,3 +1,6 @@
|
|||||||
|
## Configuration file for blitz-tools
|
||||||
|
## Rename it 'blitzstats.ini' and place it to the same directory with the scripts
|
||||||
|
|
||||||
[OPTIONS]
|
[OPTIONS]
|
||||||
## You may set your preferred commandline param defaults here
|
## You may set your preferred commandline param defaults here
|
||||||
#opt_analyzer_extended = False
|
#opt_analyzer_extended = False
|
||||||
@@ -5,17 +8,22 @@
|
|||||||
#opt_analyzer_stat_func = player
|
#opt_analyzer_stat_func = player
|
||||||
|
|
||||||
[WG]
|
[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'.
|
## 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
|
## China is not supported since WG API stats are not available there
|
||||||
# wg_account = your_nick@eu
|
# 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.
|
## WG API limits requests / sec to 10 for mobile apps.
|
||||||
## You can register your "own" server app and
|
## You can register your "own" server app and
|
||||||
## upgrade the rate limit to 20 requests / sec.
|
## upgrade the rate limit to 20 requests / sec.
|
||||||
## Check https://developers.wargaming.net/documentation/guide/getting-started/
|
## Check https://developers.wargaming.net/documentation/guide/getting-started/
|
||||||
# wg_app_id = XXXXXXXXXXX
|
# 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 ] }
|
||||||
Reference in new issue
Block a user