mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-07 02:43:22 +03:00
Send 2.4-style mod info to EDShipyard and Coriolis
This commit is contained in:
parent
771e786eaa
commit
6ffcfc74a1
11
companion.py
11
companion.py
@ -386,7 +386,10 @@ def ship(data):
|
|||||||
('fuel', 'main', 'capacity'),
|
('fuel', 'main', 'capacity'),
|
||||||
('fuel', 'reserve', 'capacity'),
|
('fuel', 'reserve', 'capacity'),
|
||||||
('id',),
|
('id',),
|
||||||
|
('launchBays',),
|
||||||
('name',),
|
('name',),
|
||||||
|
('shipID',),
|
||||||
|
('shipName',),
|
||||||
('value', 'hull'),
|
('value', 'hull'),
|
||||||
('value', 'modules'),
|
('value', 'modules'),
|
||||||
('value', 'unloaned'),
|
('value', 'unloaned'),
|
||||||
@ -394,7 +397,11 @@ def ship(data):
|
|||||||
|
|
||||||
description['modules'] = {}
|
description['modules'] = {}
|
||||||
for slot in data['ship'].get('modules', {}):
|
for slot in data['ship'].get('modules', {}):
|
||||||
for prop in ['free', 'id', 'modifiers', 'name', 'on', 'priority', 'recipeLevel', 'recipeName', 'recipeValue', 'unloaned', 'value']:
|
for prop in data['ship']['modules'][slot]:
|
||||||
addleaf(data['ship']['modules'], description['modules'], (slot, 'module', prop))
|
if prop == 'module':
|
||||||
|
for prop2 in ['free', 'id', 'name', 'on', 'priority', 'value', 'unloaned']:
|
||||||
|
addleaf(data['ship']['modules'], description['modules'], (slot, prop, prop2))
|
||||||
|
else:
|
||||||
|
addleaf(data['ship']['modules'], description['modules'], (slot, prop))
|
||||||
|
|
||||||
return description
|
return description
|
||||||
|
@ -18,7 +18,7 @@ import companion
|
|||||||
# Return a URL for the current ship
|
# Return a URL for the current ship
|
||||||
def url(data, is_beta):
|
def url(data, is_beta):
|
||||||
|
|
||||||
string = json.dumps(companion.ship(data), ensure_ascii=False, sort_keys=True, separators=(',', ':')) # most compact representation
|
string = json.dumps(companion.ship(data), ensure_ascii=False, sort_keys=True, separators=(',', ':')).encode('utf-8') # most compact representation
|
||||||
|
|
||||||
out = StringIO.StringIO()
|
out = StringIO.StringIO()
|
||||||
with gzip.GzipFile(fileobj=out, mode='w') as f:
|
with gzip.GzipFile(fileobj=out, mode='w') as f:
|
||||||
|
@ -154,7 +154,7 @@ def export(data, filename=None):
|
|||||||
# Return a URL for the current ship
|
# Return a URL for the current ship
|
||||||
def url(data, is_beta):
|
def url(data, is_beta):
|
||||||
|
|
||||||
string = json.dumps(companion.ship(data), ensure_ascii=False, sort_keys=True, separators=(',', ':')) # most compact representation
|
string = json.dumps(companion.ship(data), ensure_ascii=False, sort_keys=True, separators=(',', ':')).encode('utf-8') # most compact representation
|
||||||
|
|
||||||
out = StringIO.StringIO()
|
out = StringIO.StringIO()
|
||||||
with gzip.GzipFile(fileobj=out, mode='w') as f:
|
with gzip.GzipFile(fileobj=out, mode='w') as f:
|
||||||
|
@ -11,7 +11,7 @@ import companion
|
|||||||
# Export ship loadout in Companion API json format
|
# Export ship loadout in Companion API json format
|
||||||
def export(data, filename=None):
|
def export(data, filename=None):
|
||||||
|
|
||||||
string = json.dumps(companion.ship(data), ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': ')) # pretty print
|
string = json.dumps(companion.ship(data), ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': ')).encode('utf-8') # pretty print
|
||||||
|
|
||||||
if filename:
|
if filename:
|
||||||
with open(filename, 'wt') as h:
|
with open(filename, 'wt') as h:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user