From 193e10c19710b12314d321acb6f6b08f3cc33d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Fri, 1 Nov 2024 23:21:17 +0000 Subject: [PATCH] Generate sketchpads --- .gitignore | 1 + README.org | 2 +- build/assets/sketch/.gitkeep | 0 indexgen.py | 29 +++++++++++++++++++++++++++++ setup.py | 8 ++++++++ 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 build/assets/sketch/.gitkeep create mode 100644 setup.py diff --git a/.gitignore b/.gitignore index a967458..8857b56 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ build/decks/*/*.gif build/decks/*/type build/assets/header.png build/assets/levels/*.gif +build/assets/sketch/*.gif __pycache__/ variables.py log.py diff --git a/README.org b/README.org index e1b76f5..cd95797 100644 --- a/README.org +++ b/README.org @@ -33,13 +33,13 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards chmod +x build.sh #+END_SRC - Save a header image to =build/assets/header.png= +- Save each stage of a filled sketchpad to =build/assets/sketch/=, as =00.gif=, =01.gif=, etc. - Add level images manually to =build/assets/levels/= - Add custom CSS to =build/user.css= *** Updating and building - For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"= that aren’t relevant). - Run =./build.sh= in this directory to download the relevant card images and then upload everything to the server. ** Currently unaccounted for -- Sketchpads - Portfolios - Duplicates - Masteries diff --git a/build/assets/sketch/.gitkeep b/build/assets/sketch/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/indexgen.py b/indexgen.py index bcac4e0..1e209fa 100644 --- a/indexgen.py +++ b/indexgen.py @@ -196,6 +196,35 @@ def indexgen(): content.write("gray") content.write("\"> × " + str(craygrey) + "\n") content.write("\n\n\n") + tradeout = [] + tradein = [] + for event in log.log: + if event["event"][0:11] == "trade with ": + try: + for card in event["lost"]: + tradeout.append(event["event"]) + except: + pass + try: + for card in event["received"]: + tradein.append(event["event"]) + except: + pass + tradecommon = list(set(tradeout).intersection(tradein)) + sketch = len(tradecommon) + if sketch > 0: + content.write("\n\n\n\n") + if sketch > 19: + content.write("\n") + content.write("\n\n\n") + if sketch > 19: + content.write("\n") + content.write("\n\n
" + str(sketch % 20) + "/20" + str(int(sketch / 20)) + " completed
") sigs = [] for card in tcgcore.ownedcards(): if card[0:4] == "sig_": diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..268d699 --- /dev/null +++ b/setup.py @@ -0,0 +1,8 @@ +import variables + +buildscript = open("build.sh","w") +buildscript.write("#!/usr/bin/env bash\n\npython3 generate.py\n\nrclone copy build " + variables.servername + ":" + variables.serverpath + " -P") +buildscript.close() + +if not os.path.exists("build/user.css"): + open("build/user.css","x")