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

wanted cards

\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))) 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 if combined not in ownedcards: wantedcards.append(combined) highpriority = [] medpriority = [] for card in wantedcards: if card[:-2] in variables.highpriority: highpriority.append(card) else: medpriority.append(card) if len(highpriority) > 0: content.write("

High priority: ") for card in highpriority: with open("build/decks/" + card[:-2] + "/type") as thetype: cardtype = thetype.read() content.write("") if cardtype == "red": content.write("🔴") elif cardtype == "orange": content.write("🟠") elif cardtype == "yellow": content.write("🟡") elif cardtype == "green": content.write("🟢") elif cardtype == "blue": content.write("🔵") elif cardtype == "purple": content.write("🟣") elif cardtype == "brown": content.write("🟤") elif cardtype == "gray": content.write("⚪") elif cardtype == "special": content.write("✨") content.write(card + "") if highpriority.index(card) == len(highpriority) - 1: content.write(" ") else: content.write(", ") content.write("

\n") if len(medpriority) > 0: content.write("

Medium priority: ") for card in medpriority: with open("build/decks/" + card[:-2] + "/type") as thetype: cardtype = thetype.read() content.write("") if cardtype == "red": content.write("🔴") elif cardtype == "orange": content.write("🟠") elif cardtype == "yellow": content.write("🟡") elif cardtype == "green": content.write("🟢") elif cardtype == "blue": content.write("🔵") elif cardtype == "purple": content.write("🟣") elif cardtype == "brown": content.write("🟤") elif cardtype == "gray": content.write("⚪") elif cardtype == "special": content.write("✨") content.write(card + "") if medpriority.index(card) == len(medpriority) - 1: content.write(" ") else: content.write(", ") content.write("

\n") content.close() skel.footerwrite(thefile) if __name__ == "__main__": wantedgen()