import os import skel,tcgcore,variables def searchgen(): decksofinterest = [] for card in tcgcore.ownedcards(): if card[0:4] != "sig_": decksofinterest.append(card[:-2]) decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) wantedcards = [] ownedcollecting = [] for deck in decksofinterest: if tcgcore.collecting(deck): 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 in tcgcore.ownedcards(): ownedcollecting.append(combined) else: wantedcards.append(combined) hpw = [] mpw = [] lpw = [] hpt = [] mpt = [] lpt = [] for card in wantedcards: if tcgcore.priority(card[:-2]) == "high": hpw.append(card) elif tcgcore.priority(card[:-2]) == "medium": mpw.append(card) elif tcgcore.priority(card[:-2]) == "low": lpw.append(card) previouscard = "" for card in tcgcore.ownedcards(): if card[0:4] != "sig_": if card == previouscard: lpt.append(card) else: if not tcgcore.deckmastered(card[:-2]): mass = False for series in variables.masscollect: try: if card in variables.masscollect[series]["singles"]: mass = True except: pass if mass == True: if tcgcore.priority(card[:-2]) != "high": hpt.append(card) else: if card in ownedcollecting: if tcgcore.priority(card[:-2]) == "medium": hpt.append(card) elif tcgcore.priority(card[:-2]) == "low": mpt.append(card) else: lpt.append(card) previouscard = card hpw = sorted(list(dict.fromkeys(hpw))) mpw = sorted(list(dict.fromkeys(mpw))) lpw = sorted(list(dict.fromkeys(lpw))) hpt = sorted(list(dict.fromkeys(hpt))) mpt = sorted(list(dict.fromkeys(mpt))) lpt = sorted(list(dict.fromkeys(lpt))) if not os.path.isdir("build/search"): os.mkdir("build/search") thefile = "build/search/index.html" if os.path.exists(thefile): os.remove(thefile) skel.headerwrite(thefile,"search") content = open(thefile,"a") content.write("