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.

67 lines
2.6 KiB
Python

4 weeks ago
import datetime,os
import log,variables,skel,tcgcore
4 weeks ago
def wantedgen():
if not os.path.isdir("build/wanted"):
os.mkdir("build/wanted")
if os.path.exists("build/wanted/index.html"):
os.remove("build/wanted/index.html")
thefile = "build/wanted/index.html"
skel.headerwrite(thefile,"wanted")
content = open(thefile,"a")
content.write("<h1>wanted cards</h1>\n")
decksofinterest = []
for card in tcgcore.ownedcards():
if card[0:4] != "sig_":
decksofinterest.append(card[:-2])
4 weeks ago
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
wantedcards = []
for deck in decksofinterest:
wantedlist = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20"]
for card in wantedlist:
combined = deck + card
3 weeks ago
if combined not in tcgcore.ownedcards():
4 weeks ago
wantedcards.append(combined)
highpriority = []
medpriority = []
lowpriority = []
4 weeks ago
for card in wantedcards:
if tcgcore.priority(card[:-2]) == "high":
4 weeks ago
highpriority.append(card)
elif tcgcore.priority(card[:-2]) == "medium":
4 weeks ago
medpriority.append(card)
elif tcgcore.priority(card[:-2]) == "low":
lowpriority.append(card)
4 weeks ago
if len(highpriority) > 0:
content.write("<h2>High priority</h2>\n<textarea readonly>" + ", ".join(highpriority) + "</textarea>\n<p>")
4 weeks ago
for card in highpriority:
content.write(tcgcore.cardtext(card))
4 weeks ago
if highpriority.index(card) == len(highpriority) - 1:
content.write(" ")
else:
content.write(", ")
content.write("</p>\n")
if len(medpriority) > 0:
content.write("<h2>Medium priority</h2>\n<textarea readonly>" + ", ".join(medpriority) + "</textarea>\n<p>")
4 weeks ago
for card in medpriority:
content.write(tcgcore.cardtext(card))
4 weeks ago
if medpriority.index(card) == len(medpriority) - 1:
content.write(" ")
else:
content.write(", ")
content.write("</p>\n")
if len(lowpriority) > 0:
content.write("<h2>Low priority</h2>\n<textarea readonly>" + ", ".join(lowpriority) + "</textarea>\n<p>")
for card in lowpriority:
content.write(tcgcore.cardtext(card))
if lowpriority.index(card) == len(lowpriority) - 1:
content.write(" ")
else:
content.write(", ")
content.write("</p>\n")
4 weeks ago
content.close()
skel.footerwrite(thefile)
if __name__ == "__main__":
wantedgen()