diff --git a/.gitignore b/.gitignore index 5fabae1..7c9f02c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,9 @@ -build/ +build/*/index.html +build/index.html +build/decks/*/*.gif +build/decks/*/type +build/assets/header.png +build/assets/levels/*.gif __pycache__/ -priority.py +variables.py log.py \ No newline at end of file diff --git a/build/assets/levels/.gitkeep b/build/assets/levels/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/build/decks/.gitkeep b/build/decks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/build/style.css b/build/style.css new file mode 100644 index 0000000..17a6ec6 --- /dev/null +++ b/build/style.css @@ -0,0 +1,124 @@ +/* basic colours */ + +:root { + --textcolour: black; + --linecolour: black; + --bgcolour: white; +} + +@media(prefers-color-scheme: dark) { + :root { + --textcolour: white; + --linecolour: white; + --bgcolour: black; + } +} + +* { + color: var(--textcolour); + background-color: var(--bgcolour); +} + +/* basic layout */ + +body { + display: grid; + margin: 0; + grid-template: 1fr 1fr / minmax(200px,500px) minmax(700px,1fr); + height: 100vh; +} + +body > aside { + grid-column-start: 1; + grid-column-end: 2; + grid-row-start: 1; + grid-row-end: 2; + border-bottom: 4px solid var(--linecolour); + padding: 5px; +} + +body > nav { + grid-column-start: 1; + grid-column-end: 2; + grid-row-start: 2; + grid-row-end: 3; +} + +body > main { + grid-column-start: 2; + grid-column-end: 3; + grid-row-start: 1; + grid-row-end: 3; + overflow: auto; + border-left: 4px solid var(--linecolour); + padding: 5px; +} + +@media (max-width: 800px) { + body { + display: block; + } + body > * { + border-left: none !important; + border-bottom: 4px solid var(--linecolour) !important; + } + body > aside { + display: none; + } +} + +table.decktable { + display: inline-block; + border: 1px solid var(--linecolour); +} + +table.decktable.red th { + background-color: red; +} + +table.decktable.orange th { + background-color: orange; +} + +table.decktable.yellow th { + background-color: yellow; +} + +table.decktable.green th { + background-color: green; +} + +table.decktable.blue th { + background-color: blue; +} + +table.decktable.purple th { + background-color: purple; +} + +table.decktable.brown th { + background-color: brown; +} + +table.decktable.gray th { + background-color: gray; +} + +main img { + image-rendering: pixelated; + image-rendering: -moz-crisp-edges; + image-rendering: crisp-edges; +} + +aside { + background: url("/assets/header.png"); + background-size: auto; + background-repeat: no-repeat; + background-position: center; + background-color: var(--headbg); +} + +span.cardname { + font-family: monospace; + white-space: nowrap; +} diff --git a/collectinggen.py b/collectinggen.py index 2d0b364..6241279 100644 --- a/collectinggen.py +++ b/collectinggen.py @@ -1,5 +1,5 @@ import datetime,os -import log,priority,skel +import log,variables,skel def collectinggen(): if not os.path.isdir("build/collecting"): @@ -21,14 +21,17 @@ def collectinggen(): highpriority = [] medpriority = [] for deck in decksofinterest: - if deck in priority.high: + if deck in variables.highpriority: highpriority.append(deck) else: medpriority.append(deck) if len(highpriority) > 0: content.write("

High priority

\n") for deck in highpriority: - content.write("\n\n \n \n \n\n\n \n \n \n \n \n\n\n \n
" + deck + "
\n
" + deck + " [" + str(cardcount) + "/20]
0: content.write("

Medium priority

\n") for deck in medpriority: - content.write("\n\n \n \n \n\n\n \n \n \n \n \n\n\n \n
" + deck + "
\n
" + deck + " [" + str(cardcount) + "/20]
\n
  • " + str(cardstotal) + " cards held
  • \n
  • Started " + firstdate.strftime("%Y-%m-%d") + "
  • \n\n") + if cardstotal > 14400: + rankcode = "rainbow" + extra = cardstotal - 14400 + plusranks = int(extra / 300) + if plusranks > 0: + rank = "rainbow + " + str(plusranks) + else: + rank = "rainbow" + else: + if cardstotal > 14100: + rank = "himalayan" + elif cardstotal > 13800: + rank = "puma" + elif cardstotal > 13500: + rank = "chartreux" + elif cardstotal > 13500: + rank = "russian blue" + elif cardstotal > 12900: + rank = "panther" + elif cardstotal > 12600: + rank = "cheetah" + elif cardstotal > 12300: + rank = "tiger" + elif cardstotal > 12000: + rank = "lion" + elif cardstotal > 11700: + rank = "metal" + elif cardstotal > 11400: + rank = "ground" + elif cardstotal > 11100: + rank = "darkness" + elif cardstotal > 10800: + rank = "water" + elif cardstotal > 10500: + rank = "nature" + elif cardstotal > 10200: + rank = "light" + elif cardstotal > 9900: + rank = "wind" + elif cardstotal > 9600: + rank = "fire" + elif cardstotal > 9300: + rank = "mercury" + elif cardstotal > 9000: + rank = "jupiter" + elif cardstotal > 8700: + rank = "uranus" + elif cardstotal > 8400: + rank = "neptune" + elif cardstotal > 8100: + rank = "earth" + elif cardstotal > 7800: + rank = "venus" + elif cardstotal > 7500: + rank = "saturn" + elif cardstotal > 7200: + rank = "mars" + elif cardstotal > 6900: + rank = "magnolia" + elif cardstotal > 6600: + rank = "chocolate cosmos" + elif cardstotal > 6300: + rank = "lilac" + elif cardstotal > 6000: + rank = "hydrangea" + elif cardstotal > 5700: + rank = "clover" + elif cardstotal > 5400: + rank = "daffodil" + elif cardstotal > 5100: + rank = "tiger lily" + elif cardstotal > 4800: + rank = "sakura" + elif cardstotal > 4500: + rank = "silver" + elif cardstotal > 4200: + rank = "bronze" + elif cardstotal > 3900: + rank = "amethyst" + elif cardstotal > 3600: + rank = "sapphire" + elif cardstotal > 3300: + rank = "emerald" + elif cardstotal > 3000: + rank = "gold" + elif cardstotal > 2700: + rank = "amber" + elif cardstotal > 2400: + rank = "ruby" + elif cardstotal > 2200: + rank = "dragon fruit" + elif cardstotal > 2000: + rank = "apricot" + elif cardstotal > 1800: + rank = "grape" + elif cardstotal > 1600: + rank = "blueberry" + elif cardstotal > 1400: + rank = "lime" + elif cardstotal > 1200: + rank = "lemon" + elif cardstotal > 1000: + rank = "tangerine" + elif cardstotal > 800: + rank = "strawberry" + elif cardstotal > 700: + rank = "gray" + elif cardstotal > 600: + rank = "brown" + elif cardstotal > 500: + rank = "purple" + elif cardstotal > 400: + rank = "blue" + elif cardstotal > 300: + rank = "green" + elif cardstotal > 200: + rank = "yellow" + elif cardstotal > 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") + if len(variables.faves) > 0: + content.write("

    faves

    \n

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

    \n") content.close() skel.footerwrite(thefile) diff --git a/log-template.py b/log-template.py index c6f33b8..80f26bc 100644 --- a/log-template.py +++ b/log-template.py @@ -1,3 +1,3 @@ import datetime -log = [{"date":datetime.datetime(Y,M,D),"url":"link to comment","received":["card01","card02"]}] +log = [{"event":"event name","date":datetime.datetime(Y,M,D),"url":"link to comment","received":["card01","card02"]}] diff --git a/loggen.py b/loggen.py index 6d5fe75..56d36d8 100644 --- a/loggen.py +++ b/loggen.py @@ -15,12 +15,33 @@ def loggen(): content.write("

    " + event["date"].strftime("%Y-%m-%d") + ": Received ") receivedlist = sorted(event["received"]) for card in receivedlist: - content.write("" + card + "") + 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(" [x].

    \n") + content.write(" [" + event["event"] + "].

    \n") content.close() skel.footerwrite(thefile) diff --git a/priority-template.py b/priority-template.py deleted file mode 100644 index 3e6aadc..0000000 --- a/priority-template.py +++ /dev/null @@ -1 +0,0 @@ -high = ["deckname"] diff --git a/skel.py b/skel.py index 741aad2..201a7c0 100644 --- a/skel.py +++ b/skel.py @@ -1,6 +1,8 @@ +import variables + def headerwrite(thefile,pagename): header = open(thefile,"a") - header.write("\n\n \n \n \n \n TCG\n \n \n \n \n
    \n") header.close() def footerwrite(thefile): diff --git a/variables-template.py b/variables-template.py new file mode 100644 index 0000000..5ec8c02 --- /dev/null +++ b/variables-template.py @@ -0,0 +1,4 @@ +highpriority = ["deckname","nameofadeck"] +tradepost = "URL" +faves = ["favecard01","favecard02"] +headerbackground = "#000000" diff --git a/wantedgen.py b/wantedgen.py index d5958df..28100e9 100644 --- a/wantedgen.py +++ b/wantedgen.py @@ -1,5 +1,5 @@ import datetime,os -import log,priority,skel +import log,variables,skel def wantedgen(): if not os.path.isdir("build/wanted"): @@ -28,14 +28,35 @@ def wantedgen(): highpriority = [] medpriority = [] for card in wantedcards: - if card[:-2] in priority.high: + if card[:-2] in variables.highpriority: highpriority.append(card) else: medpriority.append(card) if len(highpriority) > 0: content.write("

    High priority: ") for card in highpriority: - content.write("" + card + "") + 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 highpriority.index(card) == len(highpriority) - 1: content.write(" ") else: @@ -44,7 +65,28 @@ def wantedgen(): if len(medpriority) > 0: content.write("

    Medium priority: ") for card in medpriority: - content.write("" + card + "") + 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 medpriority.index(card) == len(medpriority) - 1: content.write(" ") else: