import datetime,os import log,variables,skel 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("

decks in progress

\n") ownedcards = [] decksofinterest = [] for event in log.log: for card in event["received"]: ownedcards.append(card) decksofinterest.append(card[:-2]) ownedcards = sorted(ownedcards) decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) highpriority = [] medpriority = [] for deck in decksofinterest: 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: with open("build/decks/" + deck + "/type") as thetype: decktype = thetype.read() cardcount = sum(deck in card for card in ownedcards) content.write("\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n
" + deck + " [" + str(cardcount) + "/20]
\n") if len(medpriority) > 0: content.write("

Medium priority

\n") for deck in medpriority: with open("build/decks/" + deck + "/type") as thetype: decktype = thetype.read() cardcount = sum(deck in card for card in ownedcards) content.write("\n\n \n \n \n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n
" + deck + " [" + str(cardcount) + "/20]
\n") content.close() skel.footerwrite(thefile) if __name__ == "__main__": collectinggen()