mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-08 05:20:03 +03:00
Filter out bogus commodities not listed in the in-game market.
Fixes #2.
This commit is contained in:
parent
7a77f00cce
commit
35d57c6192
3
bpc.py
3
bpc.py
@ -3,6 +3,7 @@
|
||||
|
||||
from os.path import join
|
||||
import codecs
|
||||
import numbers
|
||||
import time
|
||||
|
||||
from config import config
|
||||
@ -25,7 +26,7 @@ def export(data, csv=False):
|
||||
h.write(header)
|
||||
|
||||
for commodity in data['lastStarport']['commodities']:
|
||||
if commodity.get('categoryname') and categorymap.get(commodity['categoryname'], True):
|
||||
if isinstance(commodity.get('demandBracket'), numbers.Integral) and commodity.get('categoryname') and categorymap.get(commodity['categoryname'], True):
|
||||
h.write(('%s;%s;%s;%s;%s;%s;%s;%s;%s;\n' % (
|
||||
rowheader,
|
||||
commoditymap.get(commodity['name'].strip(), commodity['name'].strip()),
|
||||
|
3
eddn.py
3
eddn.py
@ -2,6 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import numbers
|
||||
import requests
|
||||
from platform import system
|
||||
from sys import platform
|
||||
@ -35,7 +36,7 @@ def export(data, callback):
|
||||
for commodity in commodities:
|
||||
i = i+1
|
||||
callback('Sending %d/%d' % (i, len(commodities)))
|
||||
if commodity.get('categoryname') and categorymap.get(commodity['categoryname'], True):
|
||||
if isinstance(commodity.get('demandBracket'), numbers.Integral) and commodity.get('categoryname') and categorymap.get(commodity['categoryname'], True):
|
||||
msg = { '$schemaRef': schema,
|
||||
'header': header,
|
||||
'message': {
|
||||
|
3
td.py
3
td.py
@ -3,6 +3,7 @@
|
||||
from os.path import join
|
||||
from collections import defaultdict
|
||||
import codecs
|
||||
import numbers
|
||||
from platform import system
|
||||
from sys import platform
|
||||
import time
|
||||
@ -26,7 +27,7 @@ def export(data):
|
||||
# sort commodities by category
|
||||
bycategory = defaultdict(list)
|
||||
for commodity in data['lastStarport']['commodities']:
|
||||
if commodity.get('categoryname') and categorymap.get(commodity['categoryname'], True):
|
||||
if isinstance(commodity.get('demandBracket'), numbers.Integral) and commodity.get('categoryname') and categorymap.get(commodity['categoryname'], True):
|
||||
bycategory[categorymap.get(commodity['categoryname'], commodity['categoryname'])].append(commodity)
|
||||
|
||||
for category in sorted(bycategory):
|
||||
|
Loading…
x
Reference in New Issue
Block a user