1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 00:07:14 +03:00

Also collect commodity IDs.

This commit is contained in:
Jonathan Harris 2016-01-23 01:45:27 +00:00
parent 7ef0447232
commit b7ff8a2324
2 changed files with 8 additions and 4 deletions

View File

@ -33,8 +33,11 @@ def addcommodities(data):
for commodity in data['lastStarport'].get('commodities'):
key = commodity_map.get(commodity['name']) or commodity['name']
new = { 'category' : category_map.get(commodity['categoryname']) or commodity['categoryname'],
'average' : commodity['cost_mean'].split('.')[0] }
new = {
'id' : commodity['id'],
'category' : category_map.get(commodity['categoryname']) or commodity['categoryname'],
'average' : commodity['cost_mean'].split('.')[0]
}
old = commodities.get(key)
if old:
if new != old:
@ -50,7 +53,7 @@ def addcommodities(data):
os.rename(commodityfile, commodityfile+'.bak')
with open(commodityfile, 'wb') as csvfile:
writer = csv.DictWriter(csvfile, ['category', 'name', 'average'])
writer = csv.DictWriter(csvfile, ['id','category', 'name', 'average'])
writer.writeheader()
for key in commodities:
commodities[key]['name'] = key

View File

@ -250,7 +250,8 @@ def lookup(module, ship_map):
# Shouldn't be listing player-specific paid stuff, other than Horizons
elif module.get('sku') and module['sku'].lower() != 'elite_horizons_v_planetary_landings':
raise AssertionError('%s: Unexpected sku "%s"' % (module['id'], module['sku']))
# raise AssertionError('%s: Unexpected sku "%s"' % (module['id'], module['sku']))
return None
# Skip Horizons Planetary Approach Suite
elif name[1] in ['planetapproachsuite']: