Skip to content

Commit 9a1cf70

Browse files
committed
Merge pull request #1 from AnthorNet/master
Added commodity name conversion...
2 parents 172b3d1 + 66e9e10 commit 9a1cf70

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.0.2:
2+
- Added commodity name conversion before uploading to EDDN
3+
14
1.0.1:
25
- Better ship name retrieval
36
- Added player dump utility

edce/eddn.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@
1616

1717
testSchema = True
1818

19+
def convertCommodityEDDN(name):
20+
if name == 'Marine Supplies':
21+
return 'Marine Equipment'
22+
23+
if name == 'Auto Fabricators':
24+
return 'Auto-Fabricators'
25+
26+
if name == 'Hazardous Environment Suits':
27+
return 'H.E. Suits'
28+
29+
if name == 'Atmospheric Extractors':
30+
return 'Atmospheric Processors'
31+
32+
if name == 'Non Lethal Weapons':
33+
return 'Non-lethal Weapons'
34+
35+
return name
36+
1937
def submitEDDN(data):
2038
if edce.globals.debug:
2139
print(">>>>>>>>>>>>>>>> submitEDDN")
@@ -67,7 +85,7 @@ def postMarketData(data):
6785
schema = schema + '/test'
6886

6987
for commodity in data.lastStarport.commodities:
70-
message = {"header": {"softwareVersion": edce.globals.version, "softwareName": edce.globals.name, "uploaderID": clientID}, "$schemaRef": schema, "message": {"buyPrice": math.floor(commodity.buyPrice), "timestamp": st, "stationStock": math.floor(commodity.stock), "systemName": system, "stationName": station, "demand": math.floor(commodity.demand), "sellPrice": math.floor(commodity.sellPrice), "itemName": commodity.name}}
88+
message = {"header": {"softwareVersion": edce.globals.version, "softwareName": edce.globals.name, "uploaderID": clientID}, "$schemaRef": schema, "message": {"buyPrice": math.floor(commodity.buyPrice), "timestamp": st, "stationStock": math.floor(commodity.stock), "systemName": system, "stationName": station, "demand": math.floor(commodity.demand), "sellPrice": math.floor(commodity.sellPrice), "itemName": convertCommodityEDDN(commodity.name)}}
7189
if commodity.demandBracket > 0:
7290
message['message']['demandLevel'] = getBracket(commodity.demandBracket)
7391
elif commodity.stockBracket > 0:

edce/globals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
exit()
55

66
name = "EDCE"
7-
version = "1.0.1"
7+
version = "1.0.2"
88

99
interactive = False
1010
debug = False

0 commit comments

Comments
 (0)