diff --git a/master.py b/master.py index dce4592..0261b04 100755 --- a/master.py +++ b/master.py @@ -186,8 +186,15 @@ def create_trophies(): db.session.commit() print(f"Created {len(tr)} trophies.") + # Create their icons + create_trophies_icons() + + +def create_trophies_icons(): + tr = [] + with open(os.path.join(app.root_path, "data", "trophies.yaml")) as fp: + tr = yaml.safe_load(fp.read()) - # Create their icons in /app/static/images/trophies names = [slugify.slugify(t["name"]) for t in tr] src = os.path.join(app.root_path, "data", "trophies.png") dst = os.path.join(app.root_path, "static", "images", "trophies") @@ -210,6 +217,7 @@ def create_trophies(): for (name, icon) in zip(names, trophy_iterator(img)): icon.save(os.path.join(dst, f"{name}.png")) + def create_forums(): # Clean up forums forums("clear") @@ -285,6 +293,7 @@ commands = { "forums": forums, "create-groups-and-privs": create_groups_and_privs, "create-trophies": create_trophies, + "create-trophies-icons": create_trophies_icons, "create-forums": create_forums, "add-group": add_group, "enable-user": enable_user,