mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-24 03:29:54 +02:00
Compare commits
49
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fa65872ad2 | ||
|
|
b2f37ebcf5 | ||
|
|
d323f11662 | ||
|
|
d847a394a9 | ||
|
|
8514e9db17 | ||
|
|
521986adf1 | ||
|
|
7e39fdc442 | ||
|
|
14ee570ee5 | ||
|
|
e0228a4bf1 | ||
|
|
2a93cfbce3 | ||
|
|
78a959224c | ||
|
|
ae24ab35f7 | ||
|
|
ba6b4781e5 | ||
|
|
050bd99488 | ||
|
|
eb39c9ce84 | ||
|
|
24547763e9 | ||
|
|
28347e1653 | ||
|
|
ffe5afbf1e | ||
|
|
17ac09afde | ||
|
|
9117963085 | ||
|
|
dc8f9a233d | ||
|
|
ce3f9993c5 | ||
|
|
fd7eb8261d | ||
|
|
748ed7806b | ||
|
|
1ada279728 | ||
|
|
57cbc5b233 | ||
|
|
43842dc140 | ||
|
|
170a801652 | ||
|
|
210e943157 | ||
|
|
b3b7b81eb4 | ||
|
|
446e289041 | ||
|
|
f8a0fdfbe1 | ||
|
|
4c0de49077 | ||
|
|
07aa7af32f | ||
|
|
ea3306ee6c | ||
|
|
e4882d70af | ||
|
|
433c26d2f8 | ||
|
|
f6b1b1353f | ||
|
|
36fb53f0e7 | ||
|
|
b19a2169a7 | ||
|
|
67aeaddf36 | ||
|
|
763f205175 | ||
|
|
d97c0cabd8 | ||
|
|
e6ff2f438d | ||
|
|
f4f153a175 | ||
|
|
829e03f644 | ||
|
|
53b2f62817 | ||
|
|
804a4a6483 | ||
|
|
47a1f96c4e |
No files matched your search
+413
-239
File diff suppressed because it is too large.
Load diff
+125
-41
@@ -22,6 +22,11 @@ _log_level = NORMAL
|
||||
LOG = False
|
||||
LOGGER = None
|
||||
|
||||
MODE_TANK_STATS = 'tank_stats'
|
||||
MODE_PLAYER_STATS = 'player_stats'
|
||||
MODE_PLAYER_ACHIEVEMENTS= 'player_achievements'
|
||||
MODE_TANKOPEDIA = 'tankopedia'
|
||||
|
||||
# Progress display
|
||||
_progress_N = 100
|
||||
_progress_i = 0
|
||||
@@ -418,12 +423,14 @@ def set_progress_bar(heading: str, max_value: int, step: int = None, slow: bool
|
||||
return
|
||||
|
||||
|
||||
def set_counter(heading: str):
|
||||
def set_counter(heading: str, step = None):
|
||||
global _progress_obj, _progress_i
|
||||
_progress_i = 0
|
||||
if _progress_obj != None:
|
||||
finish_progress_bar()
|
||||
_progress_obj = Counter(heading)
|
||||
_progress_obj = Counter(heading + ': ')
|
||||
if step != None:
|
||||
set_progress_step(step)
|
||||
return
|
||||
|
||||
|
||||
@@ -479,6 +486,16 @@ def NOW() -> int:
|
||||
return int(time.time())
|
||||
|
||||
|
||||
def get_date_str(timestamp:int = NOW(), date_format = '%Y%m%d_%H%M%S'):
|
||||
"""Return YYYYMMDD_HHmm date string"""
|
||||
try:
|
||||
ts = datetime.fromtimestamp(timestamp)
|
||||
return ts.strftime(date_format)
|
||||
except Exception as err:
|
||||
error(exception=err)
|
||||
return None
|
||||
|
||||
|
||||
def rebase_file_args(current_dir, files):
|
||||
"""REbase file command line params after moving working dir to the script's dir"""
|
||||
if isinstance(files, list):
|
||||
@@ -626,6 +643,14 @@ def get_JSON_value(json, key : str = None, keys : list = None, keypath = None):
|
||||
raise KeyError('Key not found: ' + get_JSON_keypath(keypath, keys[0]))
|
||||
|
||||
|
||||
def sort_dict(d: dict, number: bool = False) -> dict:
|
||||
"""Sort a dict by keys"""
|
||||
if number:
|
||||
return dict(sorted(d.items(), key=lambda item: int(item[0])))
|
||||
else:
|
||||
return dict(sorted(d.items(), key=lambda item: item[0]))
|
||||
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Class SlowBar
|
||||
# -----------------------------------------------------------
|
||||
@@ -649,8 +674,6 @@ class StatsNotFound(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# Class WG
|
||||
# -----------------------------------------------------------
|
||||
@@ -686,7 +709,7 @@ class WG:
|
||||
# WHERE account_id = {} AND stat = {}
|
||||
# AND date >= {} LIMIT 1;"""
|
||||
|
||||
|
||||
# TANK_STATS
|
||||
SQL_TANK_STATS_TBL = 'tank_stats'
|
||||
|
||||
SQL_TANK_STATS_CREATE_TBL = 'CREATE TABLE IF NOT EXISTS ' + SQL_TANK_STATS_TBL + \
|
||||
@@ -700,6 +723,7 @@ class WG:
|
||||
|
||||
SQL_TANK_STATS_UPDATE = 'REPLACE INTO ' + SQL_TANK_STATS_TBL + '(account_id, tank_id, update_time, stats) VALUES(?,?,?,?)'
|
||||
|
||||
# PLAYER_STATS
|
||||
SQL_PLAYER_STATS_TBL = 'player_stats'
|
||||
|
||||
SQL_PLAYER_STATS_CREATE_TBL = 'CREATE TABLE IF NOT EXISTS ' + SQL_PLAYER_STATS_TBL + \
|
||||
@@ -713,6 +737,7 @@ class WG:
|
||||
|
||||
SQL_PLAYER_STATS_CACHED = 'SELECT * FROM ' + SQL_PLAYER_STATS_TBL + ' WHERE account_id = ? AND update_time > ?'
|
||||
|
||||
# PLAYER_ACHIEVEMENTS
|
||||
SQL_PLAYER_ACHIEVEMENTS_TBL = 'player_achievements'
|
||||
|
||||
SQL_PLAYER_ACHIEVEMENTS_CREATE_TBL = 'CREATE TABLE IF NOT EXISTS ' + SQL_PLAYER_ACHIEVEMENTS_TBL + \
|
||||
@@ -720,12 +745,13 @@ class WG:
|
||||
update_time INTEGER NOT NULL,
|
||||
stats TEXT)"""
|
||||
|
||||
SQL_PLAYER_ACHIEVEMENTS_COUNT = 'SELECT COUNT(*) FROM ' + SQL_PLAYER_ACHIEVEMENTS_TBL
|
||||
|
||||
SQL_PLAYER_ACHIEVEMENTS_CACHED = 'SELECT * FROM ' + SQL_PLAYER_ACHIEVEMENTS_TBL + ' WHERE account_id = ? AND update_time > ?'
|
||||
|
||||
SQL_PLAYER_ACHIEVEMENTS_UPDATE = 'REPLACE INTO ' + SQL_PLAYER_ACHIEVEMENTS_TBL + '(account_id, update_time, stats) VALUES(?,?,?)'
|
||||
|
||||
SQL_PLAYER_ACHIEVEMENTS_COUNT = 'SELECT COUNT(*) FROM ' + SQL_PLAYER_ACHIEVEMENTS_TBL
|
||||
|
||||
|
||||
SQL_TABLES = [ SQL_PLAYER_STATS_TBL, SQL_TANK_STATS_TBL, SQL_PLAYER_ACHIEVEMENTS_TBL ]
|
||||
|
||||
SQL_CHECK_TABLE_EXITS = """SELECT name FROM sqlite_master WHERE type='table' AND name=?"""
|
||||
@@ -908,33 +934,18 @@ class WG:
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_map(cls, map_str: str) -> str:
|
||||
def get_map(self, map_str: str) -> str:
|
||||
"""Return map name from short map string in replays"""
|
||||
try:
|
||||
return cls.maps[map_str]
|
||||
return self.maps[map_str]
|
||||
except:
|
||||
error('Map ' + map_str + ' not found')
|
||||
return None
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_map_user_strs(cls) -> str:
|
||||
return cls.maps.keys()
|
||||
|
||||
|
||||
@classmethod
|
||||
def tank_str2name(cls, tank_str: str) -> str:
|
||||
"""Return tank name from short tank string in replays"""
|
||||
try:
|
||||
return cls.tanks["userStr"][tank_str]
|
||||
except:
|
||||
error('Tank ' + tank_str + ' not found')
|
||||
return tank_str
|
||||
|
||||
|
||||
@classmethod
|
||||
def get_tank_user_strs(cls) -> str:
|
||||
return cls.tanks["userStr"].keys()
|
||||
def get_tank_user_strs(self) -> str:
|
||||
return self.tanks["userStr"].keys()
|
||||
|
||||
|
||||
@classmethod
|
||||
@@ -1070,11 +1081,15 @@ class WG:
|
||||
def load_tanks(self, tankopedia_fn: str):
|
||||
"""Load tanks from tankopedia JSON"""
|
||||
if tankopedia_fn == None:
|
||||
return False
|
||||
|
||||
return False
|
||||
try:
|
||||
with open(tankopedia_fn, 'rt', encoding='utf8') as f:
|
||||
self.tanks = json.loads(f.read())
|
||||
self.tanks['tankStr'] = dict()
|
||||
p = re.compile('.+_short$')
|
||||
for usr_str in self.tanks['userStr']:
|
||||
if p.match(usr_str) == None:
|
||||
self.tanks['tankStr'][self.tanks['userStr'][usr_str]] = usr_str
|
||||
self.tanks_by_tier = dict()
|
||||
for tier in range(1,11):
|
||||
self.tanks_by_tier[str(tier)] = list()
|
||||
@@ -1084,7 +1099,44 @@ class WG:
|
||||
except Exception as err:
|
||||
error('Could not read tankopedia: ' + tankopedia_fn, err)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def get_replay_filename(self, replay: dict):
|
||||
try:
|
||||
summary = replay['data']['summary']
|
||||
timestamp = int(summary['battle_start_timestamp'])
|
||||
timestamp = get_date_str(timestamp, date_format='%Y%m%d_%H%M')
|
||||
player = summary['player_name']
|
||||
arena_id = int(summary['arena_unique_id'])
|
||||
vehicle = self.name2tank_str(summary['vehicle'])
|
||||
vehicle.replace(' ','_')
|
||||
|
||||
return '{:s}_{:s}_{:s}_{:d}.wotbreplay.json'.format(timestamp, player, vehicle, arena_id)
|
||||
except Exception as err:
|
||||
error('Unexpected Exception', err)
|
||||
return None
|
||||
|
||||
def get_map_user_strs(self) -> str:
|
||||
return self.maps.keys()
|
||||
|
||||
|
||||
def tank_str2name(self, tank_str: str) -> str:
|
||||
"""Return tank name from short tank string in replays"""
|
||||
try:
|
||||
return self.tanks["userStr"][tank_str]
|
||||
except:
|
||||
error('Tank ' + tank_str + ' not found')
|
||||
return tank_str
|
||||
|
||||
|
||||
def name2tank_str(self, name: str) -> str:
|
||||
"""Return shorttank string from tank string in replays"""
|
||||
try:
|
||||
return self.tanks["tankStr"][name]
|
||||
except:
|
||||
debug('Tank ' + name + ' not found')
|
||||
return name
|
||||
|
||||
|
||||
def get_tanks_by_tier(self, tier: int) -> list():
|
||||
"""Returns tank_ids by tier"""
|
||||
@@ -1261,7 +1313,7 @@ class WG:
|
||||
# debug('JSON Response received: ' + str(json_data))
|
||||
stats = json_data['data'][str(account_id)]
|
||||
if cache:
|
||||
await self.put_2_statsQ('tank_stats', [account_id, tank_ids], stats)
|
||||
await self.save_tank_stats(account_id, tank_ids, stats)
|
||||
return stats
|
||||
except Exception as err:
|
||||
error(exception=err)
|
||||
@@ -1294,7 +1346,7 @@ class WG:
|
||||
# debug('JSON Response received: ' + str(json_data))
|
||||
stats = json_data['data'][str(account_id)]
|
||||
if cache:
|
||||
await self.put_2_statsQ('player_stats', [account_id], stats)
|
||||
await self.save_player_stats(account_id, stats)
|
||||
return stats
|
||||
except Exception as err:
|
||||
error(exception=err)
|
||||
@@ -1333,7 +1385,7 @@ class WG:
|
||||
for account_id in json_data['data'].keys():
|
||||
stats[account_id] = json_data['data'][account_id]
|
||||
if cache:
|
||||
await self.put_2_statsQ('player_achievements', [int(account_id)], json_data['data'][account_id])
|
||||
await self.save_player_achievements(int(account_id), json_data['data'][account_id])
|
||||
return stats
|
||||
except Exception as err:
|
||||
error(exception=err)
|
||||
@@ -1440,7 +1492,7 @@ class WG:
|
||||
return None
|
||||
|
||||
|
||||
async def put_2_statsQ(self, statsType: str, key: list, stats: list):
|
||||
async def save_stats(self, statsType: str, key: list, stats: list):
|
||||
"""Save stats to a async queue to be saved by the stat_saver -task"""
|
||||
if self.statsQ == None:
|
||||
return False
|
||||
@@ -1449,6 +1501,30 @@ class WG:
|
||||
return True
|
||||
|
||||
|
||||
async def save_player_stats(self, account_id: int, stats: dict):
|
||||
try:
|
||||
await self.save_stats(MODE_PLAYER_STATS, [int(account_id)], stats)
|
||||
except Exception as err:
|
||||
error(exception=err)
|
||||
return None
|
||||
|
||||
|
||||
async def save_player_achievements(self, account_id: int, stats: dict):
|
||||
try:
|
||||
await self.save_stats(MODE_PLAYER_ACHIEVEMENTS, [int(account_id)], stats)
|
||||
except Exception as err:
|
||||
error(exception=err)
|
||||
return None
|
||||
|
||||
|
||||
async def save_tank_stats(self, account_id: int, tank_ids: list, stats: dict):
|
||||
try:
|
||||
await self.save_stats(MODE_TANK_STATS, [int(account_id), tank_ids], stats)
|
||||
except Exception as err:
|
||||
error(exception=err)
|
||||
return None
|
||||
|
||||
|
||||
async def stat_saver(self):
|
||||
"""Async task for saving stats into cache in background"""
|
||||
|
||||
@@ -1464,8 +1540,13 @@ class WG:
|
||||
|
||||
await self.cache.commit()
|
||||
|
||||
async with self.cache.execute(WG.SQL_TANK_STATS_COUNT) as cursor:
|
||||
debug('Cache contains: ' + str((await cursor.fetchone())[0]) + ' cached player tank stat records' )
|
||||
if is_debug():
|
||||
async with self.cache.execute(WG.SQL_PLAYER_STATS_COUNT) as cursor:
|
||||
debug('Cache contains: ' + str((await cursor.fetchone())[0]) + ' player stat records' )
|
||||
async with self.cache.execute(WG.SQL_PLAYER_ACHIEVEMENTS_COUNT) as cursor:
|
||||
debug('Cache contains: ' + str((await cursor.fetchone())[0]) + ' player achievement records' )
|
||||
async with self.cache.execute(WG.SQL_TANK_STATS_COUNT) as cursor:
|
||||
debug('Cache contains: ' + str((await cursor.fetchone())[0]) + ' player tank stat records' )
|
||||
except Exception as err:
|
||||
error(exception=err)
|
||||
sys.exit(1)
|
||||
@@ -1474,19 +1555,20 @@ class WG:
|
||||
try:
|
||||
stats = await self.statsQ.get()
|
||||
|
||||
stats_type = stats[0]
|
||||
stat_type = stats[0]
|
||||
key = stats[1]
|
||||
stats_data = stats[2]
|
||||
update_time = stats[3]
|
||||
|
||||
if stats_type == 'tank_stats':
|
||||
#debug('stat_type: ' + stat_type + ', key: ' + str(key))
|
||||
if stat_type == MODE_TANK_STATS:
|
||||
await self.store_tank_stats(key, stats_data, update_time)
|
||||
elif stats_type == 'player_stats':
|
||||
elif stat_type == MODE_PLAYER_STATS:
|
||||
await self.store_player_stats(key, stats_data, update_time)
|
||||
elif stats_type == 'player_achievements':
|
||||
elif stat_type == MODE_PLAYER_ACHIEVEMENTS:
|
||||
await self.store_player_achievements(key, stats_data, update_time)
|
||||
else:
|
||||
error('Function to saves stats type \'' + stats_type + '\' is not implemented yet')
|
||||
error('Function to saves stats type \'' + stat_type + '\' is not implemented yet')
|
||||
|
||||
except asyncio.CancelledError:
|
||||
# this is an eternal loop that will wait until cancelled
|
||||
@@ -1521,7 +1603,7 @@ class WG:
|
||||
for stat in stats_data:
|
||||
tank_id = stat['tank_id']
|
||||
await self.cache.execute(WG.SQL_TANK_STATS_UPDATE, (account_id, tank_id, update_time, json.dumps(stat)))
|
||||
tank_ids.remove(tank_id)
|
||||
tank_ids.discard(tank_id)
|
||||
# no stats found => Add None to mark that
|
||||
for tank_id in tank_ids:
|
||||
await self.cache.execute(WG.SQL_TANK_STATS_UPDATE, (account_id, tank_id, update_time, None))
|
||||
@@ -1793,6 +1875,8 @@ class WoTinspector:
|
||||
except Exception as err:
|
||||
debug(exception=err, id=N)
|
||||
await asyncio.sleep(SLEEP)
|
||||
_id = self.read_replay_id(json_resp)
|
||||
json_resp['_id'] = _id
|
||||
|
||||
debug(' Could not post replay: ' + title, id=N)
|
||||
return json_resp
|
||||
|
||||
+10
-8
@@ -79,8 +79,8 @@ async def main(argv):
|
||||
tankopedia = collections.OrderedDict()
|
||||
tankopedia['status'] = 'ok'
|
||||
tankopedia['meta'] = { "count": len(tanks) }
|
||||
tankopedia['data'] = tanks
|
||||
tankopedia['userStr'] = userStrs
|
||||
tankopedia['data'] = bu.sort_dict(tanks, number=True)
|
||||
tankopedia['userStr'] = bu.sort_dict(userStrs)
|
||||
bu.verbose_std('New tankopedia \'' + args.tanks + '\' contains ' + str(len(tanks)) + ' tanks')
|
||||
bu.verbose_std('New tankopedia \'' + args.tanks + '\' contains ' + str(len(userStrs)) + ' tank strings')
|
||||
await outfile.write(json.dumps(tankopedia, ensure_ascii=False, indent=4, sort_keys=False))
|
||||
@@ -115,13 +115,12 @@ async def extract_tanks(blitz_app_base : str, nation: str):
|
||||
for data in tankList['root'].keys():
|
||||
tank_xml = tankList['root'][data]
|
||||
tank = dict()
|
||||
tank['tank_id'] = await get_tank_id(nation, int(tank_xml['id']))
|
||||
tank['userStr'] = tank_xml['userString']
|
||||
tank['nation'] = nation
|
||||
tank['tier'] = int(tank_xml['level'])
|
||||
#debug(tank_xml['price'])
|
||||
tank['is_premium'] = issubclass(type(tank_xml['price']), dict)
|
||||
tank['nation'] = nation
|
||||
tank['tank_id'] = await get_tank_id(nation, int(tank_xml['id']))
|
||||
tank['tier'] = int(tank_xml['level'])
|
||||
tank['type'] = await get_tank_type(tank_xml['tags'])
|
||||
tank['userStr'] = tank_xml['userString']
|
||||
#bu.debug('Reading tank string: ' + tank['userStr'], force=True)
|
||||
tanks.append(tank)
|
||||
except Exception as err:
|
||||
@@ -165,7 +164,10 @@ async def convert_tank_names(tanklist : list, tank_strs: dict) -> dict:
|
||||
tank['name'] = tank_strs[tank['userStr']]
|
||||
#userStrs[tank['userStr'].split(':')[1]] = tank['name']
|
||||
tank.pop('userStr', None)
|
||||
tankopedia[str(tank['tank_id'])] = tank
|
||||
tank_tmp = collections.OrderedDict()
|
||||
for key in sorted(tank.keys()):
|
||||
tank_tmp[key] = tank[key]
|
||||
tankopedia[str(tank['tank_id'])] = tank_tmp
|
||||
|
||||
for tank_str in tank_strs:
|
||||
skip = False
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/bin/python3.7
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Get Tankpedia from WoTinspector.com
|
||||
|
||||
|
||||
@@ -43,13 +43,17 @@
|
||||
"neptune_02": "Normandy - Beach",
|
||||
"north": "North",
|
||||
"ordeal": "Trial by Fire",
|
||||
"plant": "Ghost Factory",
|
||||
"pliego": "Castilla",
|
||||
"port": "Port Bay",
|
||||
"rift": "Hellas",
|
||||
"rock": "Mayan Ruins",
|
||||
"rudniki": "Mines",
|
||||
"rudniki_01": "Mines - Hill",
|
||||
"rudniki_02": "Mines - Village",
|
||||
"rudniki_03": "Mines - Center",
|
||||
"savanna": "Oasis Palms",
|
||||
"skit": "Naval Frontier",
|
||||
"test": "World of Ducks",
|
||||
"tutorial": "Proving Grounds"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,13 @@
|
||||
|
||||
| Release | Date | Notes | Inaccurate? |
|
||||
|:-------:|:--------:|-------------|-----|
|
||||
| 8.4 | 2021-10-20 | Polish heavy tanks | |
|
||||
| 8.3 | 2021-09-16 | FV4005, FV4022, VK 91.01 (P) and WZ-121 legendary camos, -5 deg gun depression to WZ-120 | |
|
||||
| 8.2 | 2021-08-18 | Ghost Factory map, XP/credits nerf for inactive players, new store UI | |
|
||||
| 8.1 | 2021-07-15 | Armor highlighting updated | |
|
||||
| 8.0 | 2021-06-08 | American experimental heavies (Yoh-line), PBR camos | |
|
||||
| 7.9 | 2021-04-27 | Mines rework, new tutorial, colorblind mode, JgPz E100 legendary camo | |
|
||||
| 7.8 | 2021-03-24 | Mid-tier balance changes, Grille line new consumables | |
|
||||
| 7.7 | 2021-02-24 | Czechoslovakian medium tanks | |
|
||||
| 7.6 | 2021-01-27 | AMC 13 90, TOG II buffs, free replay camera | |
|
||||
| 7.5 | 2020-12-09 | ATGM removal, Batchat, Kpz70, T-2020 buff | |
|
||||
|
||||
+570
-23
File diff suppressed because it is too large.
Load diff
@@ -195,7 +195,7 @@ async def replayWorker(queue: asyncio.Queue, workerID: int, account_id: int, pri
|
||||
bu.verbose_std(msg_str + title + ' has already been posted. Skipping.' )
|
||||
else:
|
||||
os.remove(replay_json_fn)
|
||||
bu.debug(msg_str + "Replay JSON not valid: Deleting " + replay_json_fn, id=workerID)
|
||||
bu.debug(msg_str + "Replay JSON not valid/complete: Deleting " + replay_json_fn, id=workerID)
|
||||
SKIPPED_N += 1
|
||||
queue.task_done()
|
||||
continue
|
||||
@@ -216,13 +216,13 @@ async def replayWorker(queue: asyncio.Queue, workerID: int, account_id: int, pri
|
||||
if not bu.debug(msg_str + 'Replay saved OK: ' + filename):
|
||||
bu.verbose_std(msg_str + title + ' posted')
|
||||
else:
|
||||
bu.warning(msg_str +'Replay file is not valid: ' + filename)
|
||||
bu.warning(msg_str +'Replay file is not valid/complete: ' + filename)
|
||||
ERROR_N += 1
|
||||
else:
|
||||
bu.error(msg_str + 'Error saving replay: ' + filename)
|
||||
ERROR_N += 1
|
||||
else:
|
||||
bu.error(msg_str + 'Replay file is not valid: ' + filename)
|
||||
bu.error(msg_str + 'Replay file is not valid/complete: ' + filename)
|
||||
ERROR_N += 1
|
||||
except Exception as err:
|
||||
bu.error(msg_str + 'Unexpected Exception: ' + str(type(err)) + ' : ' + str(err) )
|
||||
@@ -286,14 +286,14 @@ def getTitle(replayfile: str, title: str = None, i : int = 0) -> str:
|
||||
# bu.debug('Replay file\'s metadata: opened')
|
||||
try:
|
||||
metadata_json = json.load(meta)
|
||||
#player = metadata_json['playerName']
|
||||
tank = wg.tank_str2name(metadata_json['playerVehicleName'])
|
||||
#player = metadata_json['playerName']
|
||||
tank_name = wg.get_tank_name(metadata_json['vehicleCompDescriptor'])
|
||||
map_name = wg.get_map(metadata_json['mapName'])
|
||||
bu.debug('Tank: ' + tank + ' Map: ' + map_name)
|
||||
bu.debug('Tank: ' + tank_name if tank_name != None else "NOT FOUND IN tanks.json" + ' Map: ' + map_name)
|
||||
except Exception as err:
|
||||
bu.error(exception = err)
|
||||
if (tank != None) and (map_name != None):
|
||||
title = tank + ' @ ' + map_name
|
||||
if (tank_name != None) and (map_name != None):
|
||||
title = tank_name + ' @ ' + map_name
|
||||
else:
|
||||
title = re.sub('\\.wotbreplay$', '', filename)
|
||||
except Exception as err:
|
||||
|
||||
Reference in new issue
Block a user