Last active
July 8, 2020 15:16
-
-
Save ZeldaZach/5fe19930966a0e128f4e3739c8c839d6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| import pathlib | |
| if __name__ == "__main__": | |
| custom_order = {"mythic": 0, "rare": 1, "uncommon": 2, "none": 3} | |
| path = pathlib.Path("mtgjson-website/docs/.vuepress/public/resources/supporters.json") | |
| with path.open() as f: | |
| content = json.load(f) | |
| for key in content.keys(): | |
| content[key] = sorted(content[key], key=lambda x: (custom_order[x.get("tier", "none")], "image" not in x, x["name"].lower())) | |
| with path.open("w") as f: | |
| json.dump(content, f, indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment