Fix for Original UI to use new save formats/code

This commit is contained in:
ebolam
2022-12-16 21:17:25 -05:00
parent 802bef8c37
commit c3438268e9
7 changed files with 133 additions and 60 deletions

View File

@@ -110,6 +110,31 @@ def getstoryfiles():
print(f"Browser loading error: {file} has incorrect format.")
continue
list.append(ob)
elif os.path.isdir("stories/{}".format(file)):
if os.path.exists("stories/{}/story.json".format(file)):
ob = {}
ob["name"] = file
f = open("stories/{}/story.json".format(file), "r")
try:
js = json.load(f)
except:
print(f"Browser loading error: {file} is malformed or not a JSON file.")
f.close()
continue
f.close()
if 'file_version' in js:
try:
ob["actions"] = int(js["actions"]["action_count"])+1
except TypeError:
print(f"Browser loading error: {file} has incorrect format.")
continue
else:
try:
ob["actions"] = len(js["actions"])
except TypeError:
print(f"Browser loading error: {file} has incorrect format.")
continue
list.append(ob)
return list
#==================================================================#