1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-09 11:52:27 +03:00

EDDN doesn't yet accept an outfitting schema

This commit is contained in:
Jonathan Harris 2015-07-01 13:55:33 +01:00
parent be65aa6f75
commit facad95077

43
eddn.py
View File

@ -65,27 +65,28 @@ def export(data):
} }
}) })
# *Do* send empty modules list - implies station has no outfitting # EDDN doesn't yet accept an outfitting schema
modules = [] # # *Do* send empty modules list - implies station has no outfitting
for v in data['lastStarport'].get('modules', {}).itervalues(): # modules = []
try: # for v in data['lastStarport'].get('modules', {}).itervalues():
module = outfitting.lookup(v) # try:
if module: # module = outfitting.lookup(v)
modules.append(module) # if module:
except AssertionError as e: # modules.append(module)
if __debug__: print 'Outfitting: %s' % e # Silently skip unrecognized modules # except AssertionError as e:
except: # if __debug__: print 'Outfitting: %s' % e # Silently skip unrecognized modules
if __debug__: raise # except:
send({ # if __debug__: raise
'$schemaRef' : 'http://schemas.elite-markets.net/eddn/outfitting/1', # send({
'header' : header, # '$schemaRef' : 'http://schemas.elite-markets.net/eddn/outfitting/1',
'message' : { # 'header' : header,
'systemName' : data['lastSystem']['name'].strip(), # 'message' : {
'stationName' : data['lastStarport']['name'].strip(), # 'systemName' : data['lastSystem']['name'].strip(),
'timestamp' : time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(querytime)), # 'stationName' : data['lastStarport']['name'].strip(),
'modules' : modules, # 'timestamp' : time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime(querytime)),
} # 'modules' : modules,
}) # }
# })
# Don't send empty ships list - shipyard data is only guaranteed present if user has visited the shipyard. # Don't send empty ships list - shipyard data is only guaranteed present if user has visited the shipyard.
if data['lastStarport'].get('ships'): if data['lastStarport'].get('ships'):