feat: new scrape of monsters. split monsters into single files. added bestiary 2

This commit is contained in:
Brad Laney committed 2020-05-30 00:59:14 -05:00
1 parent 52bec35b45
commit 46c663747b
851 files changed
+358375 -47584

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
# THIS FILE SIMPLY LOADS THE YAML FILE INTO PYYAML AND THEN SPITS IT BACK OUT
# TO CLEAN UP AND ORDER ALL THE YAML
import yaml
import glob
import os
def main():
# change directory to the data directory
os.chdir('../data/')
# gets all files with a yaml extension in the directory
yfiles = []
for file in glob.glob("monsters.yaml"):
yfiles.append(file)
yfiles.sort()
print("Going to clean up the following files: {}".format(yfiles))
for x in yfiles:
with open(x, 'r', encoding="utf8") as r:
data = yaml.full_load(r)
for m in data["monsters"]:
print(m["name"])
part = yaml.safe_dump(m, allow_unicode=True)
with open(os.path.join("monsters", m["name"].lower() + ".yaml"), 'w', encoding="utf8") as f:
f.write(part)
print("\tDone.")
if __name__ == "__main__":
main()