mirror of
https://gitlab.com/jrmiller82/pathfinder-2-sqlite.git
synced 2026-11-10 21:29:44 -05:00
move spells to folder
This commit is contained in:
1 parent
86c2ff401f
commit
bcd9365c27
546 files changed
+17864
No files matched your search
@@ -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("spells.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["spell"]:
|
||||
print(m["name"])
|
||||
part = yaml.safe_dump(m, allow_unicode=True)
|
||||
with open(os.path.join("spells", m["name"].lower() + ".yaml"), 'w', encoding="utf8") as f:
|
||||
f.write(part)
|
||||
|
||||
print("\tDone.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user