From b7ff8a23240411526cb6becf4c060071769c9c59 Mon Sep 17 00:00:00 2001
From: Jonathan Harris <jonathan@marginal.org.uk>
Date: Sat, 23 Jan 2016 01:45:27 +0000
Subject: [PATCH] Also collect commodity IDs.

---
 collate.py    | 9 ++++++---
 outfitting.py | 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/collate.py b/collate.py
index d7f64b88..40e82093 100755
--- a/collate.py
+++ b/collate.py
@@ -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
diff --git a/outfitting.py b/outfitting.py
index e863b7e7..b7bbb814 100644
--- a/outfitting.py
+++ b/outfitting.py
@@ -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']: