From 0d7bdd7a3d9f0214fca94f9122ee6b6a8395ec0b Mon Sep 17 00:00:00 2001 From: LDericher <40151420+ldericher@users.noreply.github.com> Date: Sat, 3 Nov 2018 00:50:36 +0100 Subject: [PATCH] Card sorting, Full-Opus export files --- main.py | 6 ++++++ opus.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/main.py b/main.py index 8ffaab5..231f499 100755 --- a/main.py +++ b/main.py @@ -81,6 +81,12 @@ def main(): json_data = myOpus.get_json(args.opusid, "/".join(elements), GRID, cardfilter, faceurls) json_file.write(json_data) + json_filename = "fullopus_{}.json".format(args.opusid) + with open(json_filename, "w") as json_file: + cardfilter = lambda card: True + json_data = myOpus.get_json(args.opusid, "full", GRID, cardfilter, faceurls) + json_file.write(json_data) + # Bye logging.info("Done. Put the generated JSON files in your 'Saved Objects' Folder.") logging.info("Thanks for using fftcgtool!") diff --git a/opus.py b/opus.py index fe45932..bf5815e 100644 --- a/opus.py +++ b/opus.py @@ -53,6 +53,11 @@ class Opus: card = Card(card_data) self._cards.append(card) + # sort every element alphabetically + self._cards.sort(key=lambda x: x._serial) + self._cards.sort(key=lambda x: x._name) + self._cards.sort(key=lambda x: x._element) + def __get_sheets(self, grid): # cards per sheet count = grid[0]*grid[1] - 1