@@ -93,13 +93,25 @@ def update_db():
93
93
eos .db .gamedata_meta .create_all ()
94
94
95
95
def _readData (minerName , jsonName , keyIdName = None ):
96
- with open (os .path .join (JSON_DIR , minerName , '{}.json' .format (jsonName )), encoding = 'utf-8' ) as f :
97
- rawData = json .load (f )
96
+ compiled_data = None
97
+ for i in itertools .count (0 ):
98
+ try :
99
+ with open (os .path .join (JSON_DIR , minerName , '{}.{}.json' .format (jsonName , i )), encoding = 'utf-8' ) as f :
100
+ rawData = json .load (f )
101
+ if i == 0 :
102
+ compiled_data = {} if type (rawData ) == dict else []
103
+ if type (rawData ) == dict :
104
+ compiled_data .update (rawData )
105
+ else :
106
+ compiled_data .extend (rawData )
107
+ except FileNotFoundError :
108
+ break
109
+
98
110
if not keyIdName :
99
111
return rawData
100
112
# IDs in keys, rows in values
101
113
data = []
102
- for k , v in rawData .items ():
114
+ for k , v in compiled_data .items ():
103
115
row = {}
104
116
row .update (v )
105
117
if keyIdName not in row :
@@ -325,24 +337,27 @@ def convertSection(sectionData):
325
337
326
338
newData = []
327
339
for row in data :
328
- newRow = {
329
- 'typeID' : row ['typeID' ],
330
- }
331
- for (k , v ) in eos .config .translation_mapping .items ():
332
- if v == '' :
333
- v = '_en-us'
334
- typeLines = []
335
- traitData = row ['traits{}' .format (v )]
336
- for skillData in sorted (traitData .get ('skills' , ()), key = lambda i : i ['header' ]):
337
- typeLines .append (convertSection (skillData ))
338
- if 'role' in traitData :
339
- typeLines .append (convertSection (traitData ['role' ]))
340
- if 'misc' in traitData :
341
- typeLines .append (convertSection (traitData ['misc' ]))
342
- traitLine = '<br />\n <br />\n ' .join (typeLines )
343
- newRow ['traitText{}' .format (v )] = traitLine
344
-
345
- newData .append (newRow )
340
+ try :
341
+ newRow = {
342
+ 'typeID' : row ['typeID' ],
343
+ }
344
+ for (k , v ) in eos .config .translation_mapping .items ():
345
+ if v == '' :
346
+ v = '_en-us'
347
+ typeLines = []
348
+ traitData = row ['traits{}' .format (v )]
349
+ for skillData in sorted (traitData .get ('skills' , ()), key = lambda i : i ['header' ]):
350
+ typeLines .append (convertSection (skillData ))
351
+ if 'role' in traitData :
352
+ typeLines .append (convertSection (traitData ['role' ]))
353
+ if 'misc' in traitData :
354
+ typeLines .append (convertSection (traitData ['misc' ]))
355
+ traitLine = '<br />\n <br />\n ' .join (typeLines )
356
+ newRow ['traitText{}' .format (v )] = traitLine
357
+
358
+ newData .append (newRow )
359
+ except :
360
+ pass
346
361
_addRows (newData , eos .gamedata .Traits , fieldMap = {'traitText_en-us' : 'display' })
347
362
348
363
def processMetadata ():
0 commit comments