Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
L0laapk3 committed Dec 18, 2019
2 parents e9f5c79 + ef706b4 commit 0fad476
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
13 changes: 7 additions & 6 deletions auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def handleGameLine(line):
with condition:
condition.notify()

psutil.Process(pid).nice(psutil.BELOW_NORMAL_PRIORITY_CLASS if os.name == 'nt' else 10)

if isSteam:
pipef.close()
with open(os.path.join(tmpDir, "factorio-current.log"), "r") as f:
Expand All @@ -181,8 +183,7 @@ def handleGameLine(line):
line = pipef.readline()
printingStackTraceback = handleGameLine(line)


psutil.Process(pid).nice(psutil.BELOW_NORMAL_PRIORITY_CLASS if os.name == 'nt' else 10)




Expand Down Expand Up @@ -428,7 +429,7 @@ def changeModlist(newState):

printErase("building autorun.lua")
if (os.path.isfile(os.path.join(workfolder, "mapInfo.json"))):
with open(os.path.join(workfolder, "mapInfo.json"), "r") as f:
with open(os.path.join(workfolder, "mapInfo.json"), "r", encoding='utf-8') as f:
mapInfoLua = re.sub(r'"([^"]+)" *:', lambda m: '["'+m.group(1)+'"] = ', f.read().replace("[", "{").replace("]", "}"))
if isFirstSnapshot:
f.seek(0)
Expand Down Expand Up @@ -642,7 +643,7 @@ def refZoom():

if os.path.isfile(os.path.join(workfolder, "mapInfo.out.json")):
print("generating mapInfo.json")
with open(os.path.join(workfolder, "mapInfo.json"), 'r+') as destf, open(os.path.join(workfolder, "mapInfo.out.json"), "r") as srcf:
with open(os.path.join(workfolder, "mapInfo.json"), 'r+', encoding='utf-8') as destf, open(os.path.join(workfolder, "mapInfo.out.json"), "r") as srcf:
data = json.load(destf)
for mapIndex, mapStuff in json.load(srcf)["maps"].items():
for surfaceName, surfaceStuff in mapStuff["surfaces"].items():
Expand All @@ -660,7 +661,7 @@ def refZoom():

print("updating labels")
tags = {}
with open(os.path.join(workfolder, "mapInfo.json"), 'r+') as mapInfoJson:
with open(os.path.join(workfolder, "mapInfo.json"), 'r+', encoding='utf-8') as mapInfoJson:
data = json.load(mapInfoJson)
for mapStuff in data["maps"]:
for surfaceName, surfaceStuff in mapStuff["surfaces"].items():
Expand Down Expand Up @@ -739,7 +740,7 @@ def refZoom():
#TODO: download leaflet shit

print("generating mapInfo.js")
with open(os.path.join(workfolder, "mapInfo.js"), 'w') as outf, open(os.path.join(workfolder, "mapInfo.json"), "r") as inf:
with open(os.path.join(workfolder, "mapInfo.js"), 'w') as outf, open(os.path.join(workfolder, "mapInfo.json"), "r", encoding='utf-8') as inf:
outf.write('"use strict";\nwindow.mapInfo = JSON.parse(')
outf.write(json.dumps(inf.read()))
outf.write(");")
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "L0laapk3_FactorioMaps",
"version": "3.5.1",
"version": "3.5.2",
"title": "FactorioMaps",
"author": "L0laapk3",
"contact": "https://github.com/L0laapk3/",
Expand Down
3 changes: 2 additions & 1 deletion updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"3.3.2": "Many bugfixes.",
"3.4.0": ["Separated map tags to surface and snapshot level", "Thumbnail generation of the map"],
"3.5.0": ["!Added API for integration with i.a. Factorissimo", "Better dependency management", "Several bugfixes"],
"3.5.1": "Removed dependency on package that isnt being updated anymore."
"3.5.1": "Removed dependency on package that isnt being updated anymore.",
"3.5.2": "Added support for unicode characters"
}

0 comments on commit 0fad476

Please sign in to comment.