Skip to content

Commit 7a90ca7

Browse files
committed
dump last json and better time check
1 parent b2de5d3 commit 7a90ca7

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ target/
6060
*.xz
6161
cookies.txt
6262
*.ini
63-
lastQuery
63+
*.time
64+
*.json

edce/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ def getString(section, key):
3636
return res
3737

3838
def performSetup():
39-
username = input("Frontier Store Username (leave empty to be prompted at runtime): ").strip()
40-
password = getpass.getpass('Frontier Store Password (leave empty to be prompted at runtime): ').strip()
39+
print("Enter your Frontier Store credentials here. You can leave your username or password empty, however you will be prompted every time you run the edce_client.py script.")
40+
username = input("Frontier Store Username: ").strip()
41+
password = getpass.getpass('Frontier Store Password: ').strip()
4142
enableEDDN = input("Send market data to EDDN. No private information is sent. [Y/n]: ").strip().lower()
4243

4344
Config = configparser.ConfigParser()

edce/globals.py

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

66
name = "EDCE"
7-
version = "0.3"
7+
version = "1.0"
88

99
interactive = False
1010
debug = False
11-
lastQuery = 0

edce/query.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,18 @@ def initSession():
124124
return session
125125

126126
def writeQueryTime():
127-
with open("lastQuery", "w") as f:
127+
with open("last.time", "w") as f:
128128
f.write("%d" % time.time())
129129
f.close()
130130

131+
def writeRawJSON(filename, data):
132+
with open(filename, "w") as f:
133+
f.write(data)
134+
f.close()
135+
131136
def readQueryTime():
132137
try:
133-
with open("lastQuery", "r") as f:
138+
with open("last.time", "r") as f:
134139
t = int(f.readline())
135140
f.close()
136141
if edce.globals.debug:
@@ -192,6 +197,7 @@ def performQuery(s=None):
192197

193198
res = submitProfile(session)
194199
if checkProfileData(res):
200+
writeRawJSON("last.json",res)
195201
writeQueryTime()
196202
return res
197203

edce_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515

1616
edce.globals.interactive = True
1717
edce.globals.debug = False
18-
edce.eddn.testSchema = True
18+
edce.eddn.testSchema = False
1919

2020
try:
2121
res = edce.query.performQuery()
2222

2323
data = edce.util.edict(res)
2424
edce.util.writeJSONLog(data.commander.name,data.lastSystem.name,data)
2525

26-
shipId = "%s" % data.commander.currentShipId
2726
station = ""
2827
if data.commander.docked:
2928
station = "/" + data.lastStarport.name
3029
print("CMDR:\t" + data.commander.name)
3130
print("System:\t" + data.lastSystem.name + station)
3231

32+
shipId = "%s" % data.commander.currentShipId
3333
if shipId in data.ships:
3434
print("Ship:\t" + data.ships[shipId].name)
3535

0 commit comments

Comments
 (0)