mirror of
https://github.com/Jylpah/blitz-tools.git
synced 2026-10-23 11:09:52 +02:00
ADd defaults for tankopedia and map JSON files
This commit is contained in:
1 parent
5a9f7587b9
commit
707239d75e
3 files changed
+23
-25
No files matched your search
+19
-18
@@ -32,10 +32,7 @@ def setVerbose(verbose: bool):
|
||||
def verbose(msg = ""):
|
||||
"""Print a message"""
|
||||
if VERBOSE:
|
||||
curframe = inspect.currentframe()
|
||||
calframe = inspect.getouterframes(curframe, 2)
|
||||
caller = calframe[1][3]
|
||||
print(caller + '(): ' + msg)
|
||||
print(msg)
|
||||
return None
|
||||
|
||||
def debug(msg = ""):
|
||||
@@ -170,20 +167,24 @@ class WG:
|
||||
|
||||
self.WG_appID = WG_appID
|
||||
self.tanks = None
|
||||
if tankopedia_fn != None:
|
||||
try:
|
||||
with open(tankopedia_fn, 'rt', encoding='utf8') as f:
|
||||
self.tanks = json.loads(f.read())
|
||||
except Exception as err:
|
||||
error('Could not read tankopedia: ' + tankopedia_fn + '\n' + str(err))
|
||||
|
||||
if maps_fn != None:
|
||||
try:
|
||||
with open(maps_fn, 'rt', encoding='utf8') as f:
|
||||
self.maps = json.loads(f.read())
|
||||
except Exception as err:
|
||||
error('Could not read maps file: ' + maps_fn + '\n' + str(err))
|
||||
|
||||
if (tankopedia_fn != None):
|
||||
if os.path.exists(tankopedia_fn) and os.path.isfile(tankopedia_fn):
|
||||
try:
|
||||
with open(tankopedia_fn, 'rt', encoding='utf8') as f:
|
||||
self.tanks = json.loads(f.read())
|
||||
except Exception as err:
|
||||
error('Could not read tankopedia: ' + tankopedia_fn + '\n' + str(err))
|
||||
else:
|
||||
verbose('Could not find Tankopedia file: ' + tankopedia_fn)
|
||||
if (maps_fn != None):
|
||||
if os.path.exists(maps_fn) and os.path.isfile(maps_fn):
|
||||
try:
|
||||
with open(maps_fn, 'rt', encoding='utf8') as f:
|
||||
self.maps = json.loads(f.read())
|
||||
except Exception as err:
|
||||
error('Could not read maps file: ' + maps_fn + '\n' + str(err))
|
||||
else:
|
||||
verbose('Could not find maps file: ' + maps_fn)
|
||||
if self.WG_appID != None:
|
||||
self.session = aiohttp.ClientSession()
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user