You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.0 KiB
Python

import datetime,os
import log,skel,tcgcore,variables
def ownedgen(colour=False):
if not os.path.isdir("build/owned"):
os.mkdir("build/owned")
if colour:
if not os.path.isdir("build/owned/" + colour):
os.mkdir("build/owned/" + colour)
thefile = "build/owned/" + colour + "/index.html"
else:
thefile = "build/owned/index.html"
if os.path.exists(thefile):
os.remove(thefile)
skel.headerwrite(thefile,"owned")
content = open(thefile,"a")
content.write("<h1>owned cards</h1>\n<p>")
if colour:
content.write("Filtered to <b>")
if colour == "gray":
if variables.british:
content.write("grey")
else:
content.write("gray")
else:
content.write(colour)
content.write("</b>. <a href=\"/owned\">Show all</a>")
else:
content.write("Filter: <a href=\"/owned/red\" title=\"red\">🔴</a> <a href=\"/owned/orange\" title=\"orange\">🟠</a> <a href=\"/owned/yellow\" title=\"yellow\">🟡</a> <a href=\"/owned/green\" title=\"green\">🟢</a> <a href=\"/owned/blue\" title=\"blue\">🔵</a> <a href=\"/owned/purple\" title=\"purple\">🟣</a> <a href=\"/owned/brown\" title=\"brown\">🟤</a> <a href=\"/owned/gray\" title=\"")
if variables.british:
content.write("grey")
else:
content.write("gray")
content.write("\">⚪</a> <a href=\"/owned/special\" title=\"special\">✨</a>")
content.write("</p>\n<p>")
for card in tcgcore.ownedcards():
if card[0:4] != "sig_":
if colour:
if tcgcore.cardtype(card) == colour:
content.write(tcgcore.printcard(card))
else:
content.write(tcgcore.printcard(card))
content.write("</p>\n")
content.close()
skel.footerwrite(thefile)
def ownedall():
ownedgen()
for type in tcgcore.typelist:
ownedgen(type)
if __name__ == "__main__":
ownedall()