Skip to content

Commit

Permalink
no longer (re-) scans all replays every game. Only does it once and j…
Browse files Browse the repository at this point in the history
…ust appends the data afterwards
  • Loading branch information
Yoshi-E committed Dec 21, 2017
1 parent 681750f commit a036c1c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Wows_I_knowYou.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,11 @@ def detectCurrentGame():
newgame = jsonData["dateTime"]

if(lastgame < newgame):
lastgame = newgame
print(jsonData["dateTime"]+" "+jsonData["mapName"].replace("spaces/","")+":")
lastgame = newgame
timestamp = jsonData["dateTime"]
mapName = jsonData["mapName"]
logic = jsonData["logic"]
print(timestamp+" "+mapName.replace("spaces/","")+":")

for ship_data in jsonData["vehicles"]:
shipId = str(ship_data["shipId"])
Expand Down Expand Up @@ -224,8 +227,16 @@ def detectCurrentGame():
print(username_t+" Played "+met_num_t+" Days: "+days+" at "+map_name+"Last Ship: "+shipDB[last_met_shipid]["name"])
else:
print(username_t+" Played "+met_num_t+" day since last battle: "+days+ " at "+map_name)
userData[username][timestamp]["mapName"] = mapName
userData[username][timestamp]["logic"] = logic
userData[username][timestamp]["shipId"] = shipId
userData[username][timestamp]["userId"] = userId

#Save UserData to Disk
with open(base_path + "/userDatabase.json", "w") as outfile:
json.dump(userData, outfile)

userData = generateUserDBJson() # This is very ineffective, as it checks all replays all over again
# userData = generateUserDBJson() # This is very ineffective, as it checks all replays all over again
print(line)
time.sleep(refreshRate)

Expand Down

0 comments on commit a036c1c

Please sign in to comment.