import datetime,os import log,variables,skel,tcgcore def collectinggen(colour=False): if not os.path.isdir("build/collecting"): os.mkdir("build/collecting") if colour: if not os.path.isdir("build/collecting/" + colour): os.mkdir("build/collecting/" + colour) thefile = "build/collecting/" + colour + "/index.html" else: thefile = "build/collecting/index.html" if os.path.exists(thefile): os.remove(thefile) skel.headerwrite(thefile,"collecting") content = open(thefile,"a") content.write("

decks in progress

\n") decksofinterest = [] for card in tcgcore.ownedcards(): if card[0:4] != "sig_": if colour: if tcgcore.cardtype(card) == colour: decksofinterest.append(card[:-2]) else: decksofinterest.append(card[:-2]) decksofinterest = sorted(list(dict.fromkeys(decksofinterest))) highpriority = [] medpriority = [] lowpriority = [] for deck in decksofinterest: if tcgcore.collecting(deck): if deck in variables.highpriority: highpriority.append(deck) elif deck in variables.medpriority: medpriority.append(deck) else: if tcgcore.collecting(deck): lowpriority.append(deck) content.write(tcgcore.filterwrite("collecting",colour)) if len(highpriority) > 0: content.write("
\n

High priority

\n") for deck in highpriority: content.write(tcgcore.printdeck(deck)) content.write("
\n") if len(medpriority) > 0: content.write("
\n

Medium priority

\n") for deck in medpriority: content.write(tcgcore.printdeck(deck)) content.write("
\n") if len(lowpriority) > 0: content.write("
\n

Low priority

\n") for deck in lowpriority: content.write(tcgcore.printdeck(deck)) content.write("
\n") content.close() skel.footerwrite(thefile) def collectingall(): collectinggen() for type in tcgcore.typelist: collectinggen(type) if __name__ == "__main__": collectingall()