mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-05-31 23:59:38 +03:00
Fix for offline collation
This commit is contained in:
parent
b99060a451
commit
633edd5381
@ -175,8 +175,8 @@ if __name__ == "__main__":
|
|||||||
print 'No starport!'
|
print 'No starport!'
|
||||||
else:
|
else:
|
||||||
if data['lastStarport'].get('commodities'):
|
if data['lastStarport'].get('commodities'):
|
||||||
session.fixup(data['lastStarport']['commodities'])
|
fixed = session.fixup(data)
|
||||||
addcommodities(data)
|
addcommodities(fixed)
|
||||||
else:
|
else:
|
||||||
print 'No market'
|
print 'No market'
|
||||||
if data['lastStarport'].get('modules'):
|
if data['lastStarport'].get('modules'):
|
||||||
|
@ -19,8 +19,9 @@ def export(data, filename=None):
|
|||||||
|
|
||||||
# special handling for completely empty trees
|
# special handling for completely empty trees
|
||||||
p = props[0]
|
p = props[0]
|
||||||
if not data[p]:
|
if p in data and not data[p]:
|
||||||
to[p] = data[p]
|
to[p] = data[p]
|
||||||
|
return
|
||||||
|
|
||||||
# Does the leaf exist ?
|
# Does the leaf exist ?
|
||||||
tail = data
|
tail = data
|
||||||
@ -47,17 +48,22 @@ def export(data, filename=None):
|
|||||||
# subset of "ship" that's not noisy
|
# subset of "ship" that's not noisy
|
||||||
ship = {}
|
ship = {}
|
||||||
for props in [
|
for props in [
|
||||||
|
('alive',),
|
||||||
('cargo', 'capacity'),
|
('cargo', 'capacity'),
|
||||||
|
('free',),
|
||||||
('fuel', 'main', 'capacity'),
|
('fuel', 'main', 'capacity'),
|
||||||
('fuel', 'reserve', 'capacity'),
|
('fuel', 'reserve', 'capacity'),
|
||||||
('fuel', 'superchargedFSD'),
|
('fuel', 'superchargedFSD'),
|
||||||
('id',),
|
('id',),
|
||||||
('name',),
|
('name',),
|
||||||
|
('value', 'hull'),
|
||||||
|
('value', 'modules'),
|
||||||
|
('value', 'unloaned'),
|
||||||
]: addleaf(data['ship'], ship, props)
|
]: addleaf(data['ship'], ship, props)
|
||||||
|
|
||||||
ship['modules'] = {}
|
ship['modules'] = {}
|
||||||
for slot in data['ship'].get('modules', {}):
|
for slot in data['ship'].get('modules', {}):
|
||||||
for prop in ('id', 'modifiers', 'name', 'on', 'priority'):
|
for prop in ['free', 'id', 'modifiers', 'name', 'on', 'priority', 'recipeLevel', 'recipeName', 'recipeValue', 'unloaned', 'value']:
|
||||||
addleaf(data['ship']['modules'], ship['modules'], (slot, 'module', prop))
|
addleaf(data['ship']['modules'], ship['modules'], (slot, 'module', prop))
|
||||||
|
|
||||||
string = json.dumps(ship, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': ')).encode('utf-8')
|
string = json.dumps(ship, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': ')).encode('utf-8')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user