From 45e1425e01ff651385dbc86b6f529465b17b6284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?tr=C3=A9meur?= Date: Wed, 30 Oct 2024 23:42:59 +0000 Subject: [PATCH] Change default priority to low, add crayons, general refactoring --- build/assets/crayons/crayon1.gif | Bin 0 -> 393 bytes build/assets/crayons/crayon2.gif | Bin 0 -> 363 bytes build/assets/crayons/crayon3.gif | Bin 0 -> 370 bytes build/assets/crayons/crayon4.gif | Bin 0 -> 386 bytes build/assets/crayons/crayon5.gif | Bin 0 -> 384 bytes build/assets/crayons/crayon6.gif | Bin 0 -> 381 bytes build/assets/crayons/crayon7.gif | Bin 0 -> 379 bytes build/assets/crayons/crayon8.gif | Bin 0 -> 601 bytes build/style.css | 8 + collectinggen.py | 231 ++-------------------------- generate.py | 3 +- indexgen.py | 188 ++++++++++++++--------- levelsgen.py | 252 +++++++++++++++++++++++++++++++ loggen.py | 111 ++++++++++---- ownedgen.py | 13 +- skel.py | 2 +- tcgcore.py | 71 +++++++++ variables-template.py | 2 + wantedgen.py | 71 +++------ 19 files changed, 577 insertions(+), 375 deletions(-) create mode 100644 build/assets/crayons/crayon1.gif create mode 100644 build/assets/crayons/crayon2.gif create mode 100644 build/assets/crayons/crayon3.gif create mode 100644 build/assets/crayons/crayon4.gif create mode 100644 build/assets/crayons/crayon5.gif create mode 100644 build/assets/crayons/crayon6.gif create mode 100644 build/assets/crayons/crayon7.gif create mode 100644 build/assets/crayons/crayon8.gif create mode 100644 levelsgen.py create mode 100644 tcgcore.py diff --git a/build/assets/crayons/crayon1.gif b/build/assets/crayons/crayon1.gif new file mode 100644 index 0000000000000000000000000000000000000000..68595c94cdb5ac40272cfeabdef31f2e15957dfe GIT binary patch literal 393 zcmZ?wbhEHbhIOnKU-RU08uLtwf^ku{n^*|qp$DR^y$B5O#eB3 z`cEJ^W5%zA3x6&ITDt1@Y9Inyz3SKMRX}%w-HSpf{$ycfV6bG+0f~bA#K5-fz?^^| z8hrgn775M_wwma-^r>Nw)pF0*%-k=l_Q!j<1`A9K(4O(;T5p1xyz#B03C>&2>9H>U z*y5&^X~Y*RBqq(G$f2&y#bXj%;T6j)DxIprsjX{V#w;l#pQ_rZXT+Pk zKtYkcC#yw3c-kU%PAy#{vsfna4n-Ap9sTuF@@3iB8?!7XPU5d>mr-KR;9emhbd)7+ Qn~`b4i#Xqk2uB8M0G!vUeE$hM|%FBn(_bIhW~eV1MLA@NKHcVCkrD3g9?KV$WV}<7}z=-CIx6{@bw>A zBx#wyI>lan~{}iW<8xB_JFLcN&d6p%S zTO-ZG-yq&pSt-fJ$z9mdC0WBQBdd^E)?6SrQ*<_SQc7AzR(ams;?fn#6Y7OTl*+4X h>oYsMd-Az>1OydDvUB?;6z%BR73Uij9pcDf4FGXXh`Im( literal 0 HcmV?d00001 diff --git a/build/assets/crayons/crayon3.gif b/build/assets/crayons/crayon3.gif new file mode 100644 index 0000000000000000000000000000000000000000..8dac1f2cac1cb94110c213d001f9243fdf7d7ba8 GIT binary patch literal 370 zcmZ?wbhEHb+ktk0?W7u^_>+Z^fkBl)2V^41PYi7R2POqr zXz=wPStJ-4WHr%GHPN8QYPsiY2JIJB`|mR)J#46PntrC^ifNDhgih7HiOuihoShy{ z2+)#{k||@aPL)$sYAUNJXXQ*uQxI>G&7F`coFOGWjVW(pdP!OT#EvPY)46yBM8qT{ uS28W-5s)jEY|c&Q6I|E0tGB!=MNq!DJ2r`H>!O|W4#oLKMTa;tSOWk*_mm9) literal 0 HcmV?d00001 diff --git a/build/assets/crayons/crayon4.gif b/build/assets/crayons/crayon4.gif new file mode 100644 index 0000000000000000000000000000000000000000..8de65e8bfb5bcb0436b3e56ca32ad8679e38964e GIT binary patch literal 386 zcmZ?wbhEHbpxcBceHHA>82T{fT(%qspdr&`WBt< zTXdm+@rC|1S7)ucGHctdWm|79-FkD`{`(sb+~2hS-p2j+Hl299=fvZ^McaZ~4`lTN z%{f{&^K{e9Q%&1$E!}n#h?X6=xAElTJtrUU1-cOIQY?hxPZmZ726F}-kQ~TQ3~cic z%nq>7;OjrKNU$>4YNB6iqCt<w7AD##UedfOYOONehh4>J%vw29 z#M2dxP0HE1_;kb#ij|n=aPfBP%PSi8FR2xmZfu@d$-&L5(Yuan?X>Yuzzwrh#roRrI^EPzu+pxKBL+88+o%<$X(Yu7j zK=d|i<%g`5@3Vnu)%&vbAImm;EL;DfY{Q504Idh}eQMnPsR>AK``EMRbI;z-y?a0R z?D;hP@R#XFzRWoMWzos6i-G9W*Xc(-16>GqDHcNUCkrD3gE@l^NDkyD2DZ5eW(Qbk z@bw>ABv=`2HPJ6M(V)j_x#w#J?-y13@3X2*df4Kl6`pe~)<$Kz--;z!Co>-Wxy~># z!A4P8Q@=cyM?^|SDMQD=v}!`0m~@d!rV&#t7oV_%th}1GUMma7oI*u)4L!387ES@- z)Rn6Z*X4;8DyXhD%3)#W6_rR+)6nmmm0#c3yktVc4)LQJx(3??CQrR;F!MsZZ&Y-M HBZD;nrp>9x literal 0 HcmV?d00001 diff --git a/build/assets/crayons/crayon6.gif b/build/assets/crayons/crayon6.gif new file mode 100644 index 0000000000000000000000000000000000000000..93f07e4332b2d2b3765806c09297926ad459aa83 GIT binary patch literal 381 zcmZ?wbhEHb^!WfGF$p;>=Hrvpy}!`n00(^V-TUYb!r*YW%vf@yn*hFWbAmZSVZLt?TRd zuCIG0e%k{yaMIUeE|8UTNa BvLpZi literal 0 HcmV?d00001 diff --git a/build/assets/crayons/crayon7.gif b/build/assets/crayons/crayon7.gif new file mode 100644 index 0000000000000000000000000000000000000000..22c53352e2ded8e07ca42d5e88b0c0a066f432da GIT binary patch literal 379 zcmZ?wbhEHbl zFX}tIxbMX387EfHJhyq#SrA%$dH0%2yVu+}ye(Cqzui@CezftDqL3v;p(`t6S5(HX ztc+V(6}PT2ZCzvf=FWo6orOCmR_&NrwR2+ij)~R#X145|*|Kj|>)}QHCs)ll0YWp+ zZCZ40^Ww9c7G2)8=JM{fHx6w(w`noZZD2RzBou$LFfuThGU$L*fc(V3HsipofC^2% z{v(S7BZI9b`l&uM>akkx`Igcb^Jg7LXNagwrHy)vb&f8DT?0C}R}LD~Pl}Rjvm+ zsJ<1lg?euXTPgP9JJff%u7nvobYf=hl-~5e=o!v%&iDOvKAqQZUZoaSLqflBD>SRo zXi$$5mpHa#nHEMEYETAp5Zo~4dmeRNV%v^sS_olXH&nF-fXsZ~qtqn?VXPa51|g97 zka^Uz9ow`_gpmd{AOqiLj$>Pvi7_$^9YRf(!TY15n;`HRBd%+irlIRKRh0n<_>dbI zqm&ZDm#)LjHn(#XCt!p)gv&Vxs@%d^02GVGLZQHe{0sCywb4JVErO6263wHVKM~rk zQodZy?riV9+u7aESE~Ef%1n0qxO#fnmw0b*;Fmf)kr(Br{hN=MJ~7`U_e17Wp$%o6mu80^-ye%D`%?`WK?o%=JF&#^8ZPr(ErAk;S W)$cZ1K8p`y@$x!c>-~}uUi<|(kkab_ literal 0 HcmV?d00001 diff --git a/build/style.css b/build/style.css index 17a6ec6..7d690bb 100644 --- a/build/style.css +++ b/build/style.css @@ -122,3 +122,11 @@ span.cardname { font-family: monospace; white-space: nowrap; } + +img.crayon { + vertical-align: middle; +} + +table.level { + display: inline-block; +} diff --git a/collectinggen.py b/collectinggen.py index 6241279..4ee916f 100644 --- a/collectinggen.py +++ b/collectinggen.py @@ -1,5 +1,5 @@ import datetime,os -import log,variables,skel +import log,variables,skel,tcgcore def collectinggen(): if not os.path.isdir("build/collecting"): @@ -10,235 +10,36 @@ def collectinggen(): skel.headerwrite(thefile,"collecting") content = open(thefile,"a") content.write("

decks in progress

\n") - ownedcards = [] decksofinterest = [] for event in log.log: - for card in event["received"]: - ownedcards.append(card) - decksofinterest.append(card[:-2]) - ownedcards = sorted(ownedcards) + try: + for card in event["received"]: + decksofinterest.append(card[:-2]) + except: + pass decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) highpriority = [] medpriority = [] + lowpriority = [] for deck in decksofinterest: if deck in variables.highpriority: highpriority.append(deck) - else: + elif deck in variables.medpriority: medpriority.append(deck) + else: + lowpriority.append(deck) if len(highpriority) > 0: content.write("

High priority

\n") for deck in highpriority: - with open("build/decks/" + deck + "/type") as thetype: - decktype = thetype.read() - cardcount = sum(deck in card for card in ownedcards) - content.write("\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n
" + deck + " [" + str(cardcount) + "/20]
\n") + content.write(tcgcore.printdeck(deck)) if len(medpriority) > 0: content.write("

Medium priority

\n") for deck in medpriority: - with open("build/decks/" + deck + "/type") as thetype: - decktype = thetype.read() - cardcount = sum(deck in card for card in ownedcards) - content.write("\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n
" + deck + " [" + str(cardcount) + "/20]
\n") + content.write(tcgcore.printdeck(deck)) + if len(lowpriority) > 0: + content.write("

Low priority

\n") + for deck in lowpriority: + content.write(tcgcore.printdeck(deck)) content.close() skel.footerwrite(thefile) diff --git a/generate.py b/generate.py index 6ec83ff..d458086 100644 --- a/generate.py +++ b/generate.py @@ -1,7 +1,8 @@ -import indexgen,collectinggen,ownedgen,wantedgen,loggen +import indexgen,collectinggen,ownedgen,wantedgen,loggen,levelsgen indexgen.indexgen() collectinggen.collectinggen() ownedgen.ownedgen() wantedgen.wantedgen() loggen.loggen() +levelsgen.levelsgen() diff --git a/indexgen.py b/indexgen.py index f0daa5a..7125f71 100644 --- a/indexgen.py +++ b/indexgen.py @@ -1,5 +1,5 @@ import datetime,os,re -import log,skel,variables +import log,skel,variables,tcgcore def indexgen(): if os.path.exists("build/index.html"): @@ -7,142 +7,194 @@ def indexgen(): thefile = "build/index.html" skel.headerwrite(thefile,"index") content = open(thefile,"a") - cardstotal = 0 - for event in log.log: - try: - cardstotal += len(event["received"]) - except: - pass firstdate = log.log[0]["date"] - if cardstotal > 14400: + if len(tcgcore.ownedcards()) > 14400: rankcode = "rainbow" - extra = cardstotal - 14400 + extra = len(tcgcore.ownedcards()) - 14400 plusranks = int(extra / 300) if plusranks > 0: rank = "rainbow + " + str(plusranks) else: rank = "rainbow" else: - if cardstotal > 14100: + if len(tcgcore.ownedcards()) > 14100: rank = "himalayan" - elif cardstotal > 13800: + elif len(tcgcore.ownedcards()) > 13800: rank = "puma" - elif cardstotal > 13500: + elif len(tcgcore.ownedcards()) > 13500: rank = "chartreux" - elif cardstotal > 13500: + elif len(tcgcore.ownedcards()) > 13500: rank = "russian blue" - elif cardstotal > 12900: + elif len(tcgcore.ownedcards()) > 12900: rank = "panther" - elif cardstotal > 12600: + elif len(tcgcore.ownedcards()) > 12600: rank = "cheetah" - elif cardstotal > 12300: + elif len(tcgcore.ownedcards()) > 12300: rank = "tiger" - elif cardstotal > 12000: + elif len(tcgcore.ownedcards()) > 12000: rank = "lion" - elif cardstotal > 11700: + elif len(tcgcore.ownedcards()) > 11700: rank = "metal" - elif cardstotal > 11400: + elif len(tcgcore.ownedcards()) > 11400: rank = "ground" - elif cardstotal > 11100: + elif len(tcgcore.ownedcards()) > 11100: rank = "darkness" - elif cardstotal > 10800: + elif len(tcgcore.ownedcards()) > 10800: rank = "water" - elif cardstotal > 10500: + elif len(tcgcore.ownedcards()) > 10500: rank = "nature" - elif cardstotal > 10200: + elif len(tcgcore.ownedcards()) > 10200: rank = "light" - elif cardstotal > 9900: + elif len(tcgcore.ownedcards()) > 9900: rank = "wind" - elif cardstotal > 9600: + elif len(tcgcore.ownedcards()) > 9600: rank = "fire" - elif cardstotal > 9300: + elif len(tcgcore.ownedcards()) > 9300: rank = "mercury" - elif cardstotal > 9000: + elif len(tcgcore.ownedcards()) > 9000: rank = "jupiter" - elif cardstotal > 8700: + elif len(tcgcore.ownedcards()) > 8700: rank = "uranus" - elif cardstotal > 8400: + elif len(tcgcore.ownedcards()) > 8400: rank = "neptune" - elif cardstotal > 8100: + elif len(tcgcore.ownedcards()) > 8100: rank = "earth" - elif cardstotal > 7800: + elif len(tcgcore.ownedcards()) > 7800: rank = "venus" - elif cardstotal > 7500: + elif len(tcgcore.ownedcards()) > 7500: rank = "saturn" - elif cardstotal > 7200: + elif len(tcgcore.ownedcards()) > 7200: rank = "mars" - elif cardstotal > 6900: + elif len(tcgcore.ownedcards()) > 6900: rank = "magnolia" - elif cardstotal > 6600: + elif len(tcgcore.ownedcards()) > 6600: rank = "chocolate cosmos" - elif cardstotal > 6300: + elif len(tcgcore.ownedcards()) > 6300: rank = "lilac" - elif cardstotal > 6000: + elif len(tcgcore.ownedcards()) > 6000: rank = "hydrangea" - elif cardstotal > 5700: + elif len(tcgcore.ownedcards()) > 5700: rank = "clover" - elif cardstotal > 5400: + elif len(tcgcore.ownedcards()) > 5400: rank = "daffodil" - elif cardstotal > 5100: + elif len(tcgcore.ownedcards()) > 5100: rank = "tiger lily" - elif cardstotal > 4800: + elif len(tcgcore.ownedcards()) > 4800: rank = "sakura" - elif cardstotal > 4500: + elif len(tcgcore.ownedcards()) > 4500: rank = "silver" - elif cardstotal > 4200: + elif len(tcgcore.ownedcards()) > 4200: rank = "bronze" - elif cardstotal > 3900: + elif len(tcgcore.ownedcards()) > 3900: rank = "amethyst" - elif cardstotal > 3600: + elif len(tcgcore.ownedcards()) > 3600: rank = "sapphire" - elif cardstotal > 3300: + elif len(tcgcore.ownedcards()) > 3300: rank = "emerald" - elif cardstotal > 3000: + elif len(tcgcore.ownedcards()) > 3000: rank = "gold" - elif cardstotal > 2700: + elif len(tcgcore.ownedcards()) > 2700: rank = "amber" - elif cardstotal > 2400: + elif len(tcgcore.ownedcards()) > 2400: rank = "ruby" - elif cardstotal > 2200: + elif len(tcgcore.ownedcards()) > 2200: rank = "dragon fruit" - elif cardstotal > 2000: + elif len(tcgcore.ownedcards()) > 2000: rank = "apricot" - elif cardstotal > 1800: + elif len(tcgcore.ownedcards()) > 1800: rank = "grape" - elif cardstotal > 1600: + elif len(tcgcore.ownedcards()) > 1600: rank = "blueberry" - elif cardstotal > 1400: + elif len(tcgcore.ownedcards()) > 1400: rank = "lime" - elif cardstotal > 1200: + elif len(tcgcore.ownedcards()) > 1200: rank = "lemon" - elif cardstotal > 1000: + elif len(tcgcore.ownedcards()) > 1000: rank = "tangerine" - elif cardstotal > 800: + elif len(tcgcore.ownedcards()) > 800: rank = "strawberry" - elif cardstotal > 700: + elif len(tcgcore.ownedcards()) > 700: rank = "gray" - elif cardstotal > 600: + elif len(tcgcore.ownedcards()) > 600: rank = "brown" - elif cardstotal > 500: + elif len(tcgcore.ownedcards()) > 500: rank = "purple" - elif cardstotal > 400: + elif len(tcgcore.ownedcards()) > 400: rank = "blue" - elif cardstotal > 300: + elif len(tcgcore.ownedcards()) > 300: rank = "green" - elif cardstotal > 200: + elif len(tcgcore.ownedcards()) > 200: rank = "yellow" - elif cardstotal > 100: + elif len(tcgcore.ownedcards()) > 100: rank = "orange" else: rank = "red" rankcode = re.sub(" ","",rank) - content.write("\n
    \n
  • " + str(cardstotal) + " cards held (" + rank + ")
  • \n
  • started " + firstdate.strftime("%Y-%m-%d") + "
  • \n
  • last updated " + datetime.datetime.today().strftime("%Y-%m-%d") + "
  • \n
  • code under construction
  • \n
\n") + content.write("\n
    \n
  • " + str(len(tcgcore.ownedcards())) + " cards held (" + rank + ")
  • \n
  • started " + firstdate.strftime("%Y-%m-%d") + "
  • \n
  • last updated " + datetime.datetime.today().strftime("%Y-%m-%d") + "
  • \n
  • code under construction
  • \n
\n") + crayred = 0 + crayorange = 0 + crayyellow = 0 + craygreen = 0 + crayblue = 0 + craypurple = 0 + craybrown = 0 + craygrey = 0 + for event in log.log: + try: + crayred += event["crayons"]["red"] + except: + pass + try: + crayorange += event["crayons"]["orange"] + except: + pass + try: + crayyellow += event["crayons"]["yellow"] + except: + pass + try: + craygreen += event["crayons"]["green"] + except: + pass + try: + crayblue += event["crayons"]["blue"] + except: + pass + try: + craypurple += event["crayons"]["purple"] + except: + pass + try: + craybrown += event["crayons"]["brown"] + except: + pass + try: + craygrey += event["crayons"]["gray"] + except: + pass + if crayred + crayorange + crayyellow + craygreen + crayblue + craypurple + craybrown + craygrey > 0: + content.write("\n\n\n") + if crayred > 0: + content.write("\n") + if crayorange > 0: + content.write("\n") + if crayyellow > 0: + content.write("\n") + if craygreen > 0: + content.write("\n") + if crayblue > 0: + content.write("\n") + if craypurple > 0: + content.write("\n") + if craybrown > 0: + content.write("\n") + if craygrey > 0: + content.write("\n") + content.write("\n\n
× " + str(crayred) + " × " + str(crayorange) + " × " + str(crayyellow) + " × " + str(craygreen) + " × " + str(crayblue) + " × " + str(craypurple) + " × " + str(craybrown) + " × " + str(craygrey) + "
\n") if len(variables.faves) > 0: content.write("

faves

\n

") for card in variables.faves: - deck = card[:-2] - cardid = card[-2:] - content.write("") + content.write(tcgcore.printcard(card)) content.write("

\n") content.close() skel.footerwrite(thefile) diff --git a/levelsgen.py b/levelsgen.py new file mode 100644 index 0000000..3bf34c3 --- /dev/null +++ b/levelsgen.py @@ -0,0 +1,252 @@ +import datetime,os,re +import log,skel + +def levelsgen(): + if not os.path.isdir("build/levels"): + os.mkdir("build/levels") + if os.path.exists("build/levels/index.html"): + os.remove("build/levels/index.html") + thefile = "build/levels/index.html" + skel.headerwrite(thefile,"levels") + content = open(thefile,"a") + content.write("

levels

\n") + datecard = {} + cardno = -1 + for event in log.log: + try: + for card in event["received"]: + cardno += 1 + datecard[cardno] = event["date"] + except: + pass + firstdate = log.log[0]["date"] + content.write("\n\n\n\n\n\n\n\n\n
" + firstdate.strftime("%Y-%m-%d") + "
\n") + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[1800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[2000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[2200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[2400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[2700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[3000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[3300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[3600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[3900].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[5200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[4500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[4800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[5100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[5400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[5700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[6000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[6300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[6600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[6900].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[7200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[7500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[7800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[8100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[8400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[8700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[9000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[9300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[9600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[9900].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[10200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[10500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[10800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[11100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[11400].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[11700].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[12000].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[12300].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[12600].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[12900].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[13200].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[13500].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[13800].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[14100].strftime("%Y-%m-%d") + "
\n") + except: + pass + try: + content.write("\n\n\n\n\n\n\n\n\n
" + datecard[14400].strftime("%Y-%m-%d") + "
\n") + except: + pass + content.close() + skel.footerwrite(thefile) + +if __name__ == "__main__": + levelsgen() diff --git a/loggen.py b/loggen.py index 56d36d8..f08b308 100644 --- a/loggen.py +++ b/loggen.py @@ -1,5 +1,5 @@ import datetime,os -import log,skel +import log,skel,tcgcore def loggen(): if not os.path.isdir("build/log"): @@ -12,36 +12,85 @@ def loggen(): content.write("

log

\n") thelog = log.log[::-1] for event in thelog: - content.write("

" + event["date"].strftime("%Y-%m-%d") + ": Received ") - receivedlist = sorted(event["received"]) - for card in receivedlist: - with open("build/decks/" + card[:-2] + "/type") as thetype: - cardtype = thetype.read() - content.write("") - if cardtype == "red": - content.write("🔴") - elif cardtype == "orange": - content.write("🟠") - elif cardtype == "yellow": - content.write("🟡") - elif cardtype == "green": - content.write("🟢") - elif cardtype == "blue": - content.write("🔵") - elif cardtype == "purple": - content.write("🟣") - elif cardtype == "brown": - content.write("🟤") - elif cardtype == "gray": - content.write("⚪") - elif cardtype == "special": - content.write("✨") - content.write(card + "") - if receivedlist.index(card) == len(receivedlist) - 1: - content.write(" ") - else: - content.write(", ") - content.write(" [" + event["event"] + "].

\n") + content.write("

" + event["date"].strftime("%Y-%m-%d") + " [" + event["event"] + "]: ") + try: + if event["received"]: + content.write("Received ") + receivedlist = sorted(event["received"]) + for card in receivedlist: + content.write(tcgcore.cardtext(card)) + if receivedlist.index(card) != len(receivedlist) - 1: + content.write(", ") + content.write(".") + except: + pass + try: + if event["crayons"]: + crayontypes = len(event["crayons"]) + content.write("Gained crayons: ") + try: + redno = event["crayons"]["red"] + content.write(str(redno) + " red") + if list(event["crayons"])[-1] != "red": + content.write(", ") + except: + pass + try: + orangeno = event["crayons"]["orange"] + content.write(str(orangeno) + " orange") + if list(event["crayons"])[-1] != "orange": + content.write(", ") + except: + pass + try: + yellowno = event["crayons"]["yellow"] + content.write(str(yellowno) + " yellow") + if list(event["crayons"])[-1] != "yellow": + content.write(", ") + except: + pass + try: + greenno = event["crayons"]["green"] + content.write(str(greenno) + " green") + if list(event["crayons"])[-1] != "green": + content.write(", ") + except: + pass + try: + blueno = event["crayons"]["blue"] + content.write(str(blueno) + " blue") + if list(event["crayons"])[-1] != "blue": + content.write(", ") + except: + pass + try: + purpleno = event["crayons"]["purple"] + content.write(str(purpleno) + " purple") + if list(event["crayons"])[-1] != "purple": + content.write(", ") + except: + pass + try: + brownno = event["crayons"]["brown"] + content.write(str(brownno) + " brown") + if list(event["crayons"])[-1] != "brown": + content.write(", ") + except: + pass + try: + grayno = event["crayons"]["gray"] + if variables.british: + content.write(str(grayno) + " grey") + else: + content.write(str(grayno) + " gray") + if list(event["crayons"])[-1] != "gray": + content.write(", ") + except: + pass + content.write(".") + except: + pass + content.write("

\n") content.close() skel.footerwrite(thefile) diff --git a/ownedgen.py b/ownedgen.py index cc0655a..cb9aeb0 100644 --- a/ownedgen.py +++ b/ownedgen.py @@ -1,5 +1,5 @@ import datetime,os -import log,skel +import log,skel,tcgcore def ownedgen(): if not os.path.isdir("build/owned"): @@ -9,16 +9,9 @@ def ownedgen(): thefile = "build/owned/index.html" skel.headerwrite(thefile,"owned") content = open(thefile,"a") - cards = [] - for event in log.log: - for card in event["received"]: - cards.append(card) - cards = sorted(cards) content.write("

owned cards

\n

") - for card in cards: - deck = card[:-2] - cardid = card[-2:] - content.write("") + for card in tcgcore.ownedcards(): + content.write(tcgcore.printcard(card)) content.write("

\n") content.close() skel.footerwrite(thefile) diff --git a/skel.py b/skel.py index 201a7c0..78cc0cc 100644 --- a/skel.py +++ b/skel.py @@ -2,7 +2,7 @@ import variables def headerwrite(thefile,pagename): header = open(thefile,"a") - header.write("\n\n \n \n \n \n TCG :: " + pagename + "\n \n \n \n