Generate sketchpads

master
trémeur 3 weeks ago
parent 8e995e5126
commit 193e10c197

1
.gitignore vendored

@ -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

@ -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 arent 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

@ -196,6 +196,35 @@ def indexgen():
content.write("gray")
content.write("\"> × " + str(craygrey) + "</td>\n")
content.write("</tr>\n</tbody>\n</table>\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("<table class=\"sketchpads\">\n<tbody>\n<tr>\n<td><img src=\"/assets/sketch/")
if sketch % 20 < 10:
content.write("0" + str(sketch % 20))
else:
content.write(sketch % 20)
content.write(".gif\"></td>\n")
if sketch > 19:
content.write("<td><img src=\"/assets/sketch/20.gif\"></td>\n")
content.write("</tr>\n<tr>\n<td align=\"center\">" + str(sketch % 20) + "/20</td>\n")
if sketch > 19:
content.write("<td align=\"center\">" + str(int(sketch / 20)) + " completed</td>\n")
content.write("</tr>\n</tbody>\n</table>")
sigs = []
for card in tcgcore.ownedcards():
if card[0:4] == "sig_":

@ -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")
Loading…
Cancel
Save