Renaming WG_utils.py to blitzutils.py

This commit is contained in:
Jylpah committed 2018-10-03 23:17:27 +08:00
1 parent 92db62c755
commit 876c8d18ea
2 files changed
+12 -10

No files matched your search

+8 -9
View File
@@ -1,9 +1,9 @@
#!/usr/bin/python3.7 #!/usr/bin/python3.7
# Extract tankopedia data in WG API JSON format from Blitz app files (Android APK unzipped) # Extract tankopedia data in WG API JSON format from Blitz app files (Android APK unzipped)
import sys, argparse, json, os, inspect, aiohttp, asyncio, aiofiles, re, logging, time, xmltodict, collections import sys, argparse, json, os, inspect, aiohttp, asyncio, aiofiles, re, logging, time, xmltodict, collections
from blitzutils import WG
logging.getLogger("asyncio").setLevel(logging.DEBUG) logging.getLogger("asyncio").setLevel(logging.DEBUG)
@@ -14,12 +14,11 @@ BLITZAPP_VEHICLE_FILE='/list.xml'
VERBOSE = False VERBOSE = False
DEBUG = False DEBUG = False
NATIONS = [ 'ussr', 'germany', 'usa', 'china', 'france', 'uk', 'japan', 'other']
NATION_ID = {}
for i in range(len(NATIONS)):
NATION_ID[NATIONS[i]] = i
TANK_TYPE = [ 'lightTank', 'mediumTank', 'heavyTank', 'AT-SPG' ] wg = WG()
NATION_ID = {}
for i in range(len(wg.nations)):
NATION_ID[wg.nations[i]] = i
## main() ------------------------------------------------------------- ## main() -------------------------------------------------------------
async def main(argv): async def main(argv):
@@ -39,7 +38,7 @@ async def main(argv):
if DEBUG: VERBOSE = True if DEBUG: VERBOSE = True
tasks = [] tasks = []
for nation in NATIONS: for nation in wg.nations:
tasks.append(asyncio.create_task(extractTanks(args.blitzAppBase, nation))) tasks.append(asyncio.create_task(extractTanks(args.blitzAppBase, nation)))
tanklist = [] tanklist = []
@@ -143,7 +142,7 @@ async def getTankID(nation: str, tankID : int) -> int:
async def getTankType(tagstr : str): async def getTankType(tagstr : str):
tags = tagstr.split(' ') tags = tagstr.split(' ')
for t_type in TANK_TYPE: for t_type in wg.tank_type:
if tags[0] == t_type: if tags[0] == t_type:
return t_type return t_type
return None return None
+4 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/python3.7 #!/usr/bin/python3.7
import json, argparse, inspect, sys, os, base64, aiohttp, urllib, asyncio, aiofiles, aioconsole, logging, re import json, argparse, inspect, sys, os, base64, aiohttp, urllib, asyncio, aiofiles, aioconsole, logging, re
from WG_utils import WG from blitzutils import WG
logging.getLogger("asyncio").setLevel(logging.DEBUG) logging.getLogger("asyncio").setLevel(logging.DEBUG)
@@ -46,6 +46,9 @@ async def main(argv):
args.accountID = await wg.getAccountID(args.account) args.accountID = await wg.getAccountID(args.account)
debug('WG account_id: ' + str(args.accountID)) debug('WG account_id: ' + str(args.accountID))
if args.accountID == None:
args.accountID = 0
try: try:
queue = asyncio.Queue() queue = asyncio.Queue()