diff --git a/scripts/md_csv/convert_newjson.py b/scripts/md_csv/convert_newjson.py index 597dadf..538f377 100644 --- a/scripts/md_csv/convert_newjson.py +++ b/scripts/md_csv/convert_newjson.py @@ -37,7 +37,27 @@ def convertOldEvent(oldJson): assert(numKey in node) properties[node[numKey]['en_name']] = properties[numKey] del properties[numKey] - #end for + #end for + if 'ext' in properties: + ext = properties['ext'] + if isinstance(ext, str): + rawdata = ext.encode('utf8') + else: + ext = json.dumps(ext) + rawdata = ext.encode('utf8') + if len(rawdata) <= 1024 * 2: + properties['ext1'] = rawdata.decode('utf8') + else: + assert(len(rawdata) <= 1024 * 4) + ext1 = ext[0:2000].encode('utf8') + ext2 = ext[2000:].encode('utf8') + print(len(ext1), len(ext2), len(rawdata)) + assert(len(ext1) + len(ext2) == len(rawdata)) + assert(len(ext1) <= 1024 * 2 and len(ext2) <= 1024 * 2) + properties['ext1'] = ext1.decode('utf8') + properties['ext2'] = ext2.decode('utf8') + #endif + del properties['ext'] def convert_newjson(gameid): files = getFiles(OLD_PATH + gameid)