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.
tcg/collectinggen.py

49 lines
1.6 KiB
Python

4 weeks ago
import datetime,os
import log,variables,skel,tcgcore
4 weeks ago
def collectinggen():
if not os.path.isdir("build/collecting"):
os.mkdir("build/collecting")
if os.path.exists("build/collecting/index.html"):
os.remove("build/collecting/index.html")
thefile = "build/collecting/index.html"
skel.headerwrite(thefile,"collecting")
content = open(thefile,"a")
content.write("<h1>decks in progress</h1>\n")
decksofinterest = []
for event in log.log:
try:
for card in event["received"]:
3 weeks ago
if card[0:4] != "sig_":
decksofinterest.append(card[:-2])
except:
pass
4 weeks ago
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
highpriority = []
medpriority = []
lowpriority = []
4 weeks ago
for deck in decksofinterest:
if deck in variables.highpriority:
4 weeks ago
highpriority.append(deck)
elif deck in variables.medpriority:
4 weeks ago
medpriority.append(deck)
else:
lowpriority.append(deck)
4 weeks ago
if len(highpriority) > 0:
content.write("<h2>High priority</h2>\n")
for deck in highpriority:
content.write(tcgcore.printdeck(deck))
4 weeks ago
if len(medpriority) > 0:
content.write("<h2>Medium priority</h2>\n")
for deck in medpriority:
content.write(tcgcore.printdeck(deck))
if len(lowpriority) > 0:
content.write("<h2>Low priority</h2>\n")
for deck in lowpriority:
content.write(tcgcore.printdeck(deck))
4 weeks ago
content.close()
skel.footerwrite(thefile)
if __name__ == "__main__":
collectinggen()