mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-05-31 15:49:41 +03:00
Filter commodities on legality
This commit is contained in:
parent
323b414e19
commit
d0cba6f4c4
@ -292,6 +292,8 @@ def fixup(data):
|
|||||||
else:
|
else:
|
||||||
if not category_map.get(commodity['categoryname'], True): # Check marketable
|
if not category_map.get(commodity['categoryname'], True): # Check marketable
|
||||||
pass
|
pass
|
||||||
|
elif commodity.get('legality'): # Check not prohibited
|
||||||
|
pass
|
||||||
elif not commodity.get('categoryname'):
|
elif not commodity.get('categoryname'):
|
||||||
if __debug__: print 'Missing "categoryname" for "%s"' % commodity.get('name', '')
|
if __debug__: print 'Missing "categoryname" for "%s"' % commodity.get('name', '')
|
||||||
elif not commodity.get('name'):
|
elif not commodity.get('name'):
|
||||||
|
3
eddn.py
3
eddn.py
@ -159,7 +159,8 @@ class EDDN:
|
|||||||
def export_commodities(self, data, is_beta):
|
def export_commodities(self, data, is_beta):
|
||||||
commodities = []
|
commodities = []
|
||||||
for commodity in data['lastStarport'].get('commodities') or []:
|
for commodity in data['lastStarport'].get('commodities') or []:
|
||||||
if category_map.get(commodity['categoryname'], True): # Check marketable
|
if (category_map.get(commodity['categoryname'], True) and # Check marketable
|
||||||
|
not commodity.get('legality')): # check not prohibited
|
||||||
commodities.append(OrderedDict([
|
commodities.append(OrderedDict([
|
||||||
('name', commodity['name']),
|
('name', commodity['name']),
|
||||||
('meanPrice', int(commodity['meanPrice'])),
|
('meanPrice', int(commodity['meanPrice'])),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user