Add card type filter
parent
ad95e08715
commit
cc59c175ec
@ -1,21 +1,53 @@
|
||||
import datetime,os
|
||||
import log,skel,tcgcore
|
||||
import log,skel,tcgcore,variables
|
||||
|
||||
def ownedgen():
|
||||
def ownedgen(colour=False):
|
||||
if not os.path.isdir("build/owned"):
|
||||
os.mkdir("build/owned")
|
||||
if os.path.exists("build/owned/index.html"):
|
||||
os.remove("build/owned/index.html")
|
||||
thefile = "build/owned/index.html"
|
||||
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_":
|
||||
content.write(tcgcore.printcard(card))
|
||||
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)
|
||||
|
||||
if __name__ == "__main__":
|
||||
def ownedall():
|
||||
ownedgen()
|
||||
for type in tcgcore.typelist:
|
||||
ownedgen(type)
|
||||
|
||||
if __name__ == "__main__":
|
||||
ownedall()
|
||||
|
@ -1,30 +1,69 @@
|
||||
import datetime,os
|
||||
import log,skel,tcgcore,variables
|
||||
|
||||
def tradegen():
|
||||
def tradegen(colour=False):
|
||||
if not os.path.isdir("build/trade"):
|
||||
os.mkdir("build/trade")
|
||||
if os.path.exists("build/trade/index.html"):
|
||||
os.remove("build/trade/index.html")
|
||||
thefile = "build/trade/index.html"
|
||||
if colour:
|
||||
if not os.path.isdir("build/trade/" + colour):
|
||||
os.mkdir("build/trade/" + colour)
|
||||
thefile = "build/trade/" + colour + "/index.html"
|
||||
else:
|
||||
thefile = "build/trade/index.html"
|
||||
if os.path.exists(thefile):
|
||||
os.remove(thefile)
|
||||
skel.headerwrite(thefile,"trade")
|
||||
content = open(thefile,"a")
|
||||
content.write("<h1>available for trade</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=\"/trade\">Show all</a>")
|
||||
else:
|
||||
content.write("Filter: <a href=\"/trade/red\" title=\"red\">🔴</a> <a href=\"/trade/orange\" title=\"orange\">🟠</a> <a href=\"/trade/yellow\" title=\"yellow\">🟡</a> <a href=\"/trade/green\" title=\"green\">🟢</a> <a href=\"/trade/blue\" title=\"blue\">🔵</a> <a href=\"/trade/purple\" title=\"purple\">🟣</a> <a href=\"/trade/brown\" title=\"brown\">🟤</a> <a href=\"/trade/gray\" title=\"")
|
||||
if variables.british:
|
||||
content.write("grey")
|
||||
else:
|
||||
content.write("gray")
|
||||
content.write("\">⚪</a> <a href=\"/trade/special\" title=\"special\">✨</a> <a href=\"/trade/sig\" title=\"sig\">✍</a>")
|
||||
content.write("</p>\n<p>")
|
||||
for card in tcgcore.ownedcards():
|
||||
if card[0:4] != "sig_":
|
||||
if not tcgcore.collecting(card[:-2]):
|
||||
content.write(tcgcore.printcard(card))
|
||||
if colour:
|
||||
if not tcgcore.collecting(card[:-2]):
|
||||
if tcgcore.cardtype(card) == colour:
|
||||
content.write(tcgcore.printcard(card))
|
||||
else:
|
||||
if not tcgcore.collecting(card[:-2]):
|
||||
content.write(tcgcore.printcard(card))
|
||||
siglist = []
|
||||
for card in tcgcore.ownedcards():
|
||||
if card == "sig_" + variables.name.lower():
|
||||
siglist.append(card)
|
||||
if variables.keepsig == True:
|
||||
siglist.remove(siglist[0])
|
||||
for sig in siglist:
|
||||
content.write(tcgcore.printcard(sig))
|
||||
if colour:
|
||||
if colour == "sig":
|
||||
for sig in siglist:
|
||||
content.write(tcgcore.printcard(sig))
|
||||
else:
|
||||
for sig in siglist:
|
||||
content.write(tcgcore.printcard(sig))
|
||||
content.write("</p>\n<p>Trade cards <a href=\"" + variables.tradepost + "\">here</a></p>\n")
|
||||
content.close()
|
||||
skel.footerwrite(thefile)
|
||||
|
||||
if __name__ == "__main__":
|
||||
def tradeall():
|
||||
tradegen()
|
||||
for type in tcgcore.typelist:
|
||||
tradegen(type)
|
||||
tradegen("sig")
|
||||
|
||||
if __name__ == "__main__":
|
||||
tradeall()
|
||||
|
Loading…
Reference in New Issue