import datetime,os,re from collections import Counter import log,skel,variables,tcgcore def indexgen(): if os.path.exists("build/index.html"): os.remove("build/index.html") thefile = "build/index.html" skel.headerwrite(thefile,"index") content = open(thefile,"a") firstdate = log.log[0]["date"] if len(tcgcore.ownedcards()) > 14400: rankcode = "rainbow" extra = len(tcgcore.ownedcards()) - 14400 plusranks = int(extra / 300) if plusranks > 0: rank = "rainbow + " + str(plusranks) else: rank = "rainbow" else: if len(tcgcore.ownedcards()) > 14100: rank = "himalayan" elif len(tcgcore.ownedcards()) > 13800: rank = "puma" elif len(tcgcore.ownedcards()) > 13500: rank = "chartreux" elif len(tcgcore.ownedcards()) > 13500: rank = "russian blue" elif len(tcgcore.ownedcards()) > 12900: rank = "panther" elif len(tcgcore.ownedcards()) > 12600: rank = "cheetah" elif len(tcgcore.ownedcards()) > 12300: rank = "tiger" elif len(tcgcore.ownedcards()) > 12000: rank = "lion" elif len(tcgcore.ownedcards()) > 11700: rank = "metal" elif len(tcgcore.ownedcards()) > 11400: rank = "ground" elif len(tcgcore.ownedcards()) > 11100: rank = "darkness" elif len(tcgcore.ownedcards()) > 10800: rank = "water" elif len(tcgcore.ownedcards()) > 10500: rank = "nature" elif len(tcgcore.ownedcards()) > 10200: rank = "light" elif len(tcgcore.ownedcards()) > 9900: rank = "wind" elif len(tcgcore.ownedcards()) > 9600: rank = "fire" elif len(tcgcore.ownedcards()) > 9300: rank = "mercury" elif len(tcgcore.ownedcards()) > 9000: rank = "jupiter" elif len(tcgcore.ownedcards()) > 8700: rank = "uranus" elif len(tcgcore.ownedcards()) > 8400: rank = "neptune" elif len(tcgcore.ownedcards()) > 8100: rank = "earth" elif len(tcgcore.ownedcards()) > 7800: rank = "venus" elif len(tcgcore.ownedcards()) > 7500: rank = "saturn" elif len(tcgcore.ownedcards()) > 7200: rank = "mars" elif len(tcgcore.ownedcards()) > 6900: rank = "magnolia" elif len(tcgcore.ownedcards()) > 6600: rank = "chocolate cosmos" elif len(tcgcore.ownedcards()) > 6300: rank = "lilac" elif len(tcgcore.ownedcards()) > 6000: rank = "hydrangea" elif len(tcgcore.ownedcards()) > 5700: rank = "clover" elif len(tcgcore.ownedcards()) > 5400: rank = "daffodil" elif len(tcgcore.ownedcards()) > 5100: rank = "tiger lily" elif len(tcgcore.ownedcards()) > 4800: rank = "sakura" elif len(tcgcore.ownedcards()) > 4500: rank = "silver" elif len(tcgcore.ownedcards()) > 4200: rank = "bronze" elif len(tcgcore.ownedcards()) > 3900: rank = "amethyst" elif len(tcgcore.ownedcards()) > 3600: rank = "sapphire" elif len(tcgcore.ownedcards()) > 3300: rank = "emerald" elif len(tcgcore.ownedcards()) > 3000: rank = "gold" elif len(tcgcore.ownedcards()) > 2700: rank = "amber" elif len(tcgcore.ownedcards()) > 2400: rank = "ruby" elif len(tcgcore.ownedcards()) > 2200: rank = "dragon fruit" elif len(tcgcore.ownedcards()) > 2000: rank = "apricot" elif len(tcgcore.ownedcards()) > 1800: rank = "grape" elif len(tcgcore.ownedcards()) > 1600: rank = "blueberry" elif len(tcgcore.ownedcards()) > 1400: rank = "lime" elif len(tcgcore.ownedcards()) > 1200: rank = "lemon" elif len(tcgcore.ownedcards()) > 1000: rank = "tangerine" elif len(tcgcore.ownedcards()) > 800: rank = "strawberry" elif len(tcgcore.ownedcards()) > 700: rank = "gray" elif len(tcgcore.ownedcards()) > 600: rank = "brown" elif len(tcgcore.ownedcards()) > 500: rank = "purple" elif len(tcgcore.ownedcards()) > 400: rank = "blue" elif len(tcgcore.ownedcards()) > 300: rank = "green" elif len(tcgcore.ownedcards()) > 200: rank = "yellow" elif len(tcgcore.ownedcards()) > 100: rank = "orange" else: rank = "red" rankcode = re.sub(" ","",rank) content.write("" + tcgcore.printcard("sig_" + variables.name.lower()) + "\n
" + firstdate.strftime("%Y-%m-%d") + "
" + datetime.datetime.today().strftime("%Y-%m-%d") + "
× " + str(crayred) + " | \n") if crayorange > 0: content.write("× " + str(crayorange) + " | \n") if crayyellow > 0: content.write("× " + str(crayyellow) + " | \n") if craygreen > 0: content.write("× " + str(craygreen) + " | \n") if crayblue > 0: content.write("× " + str(crayblue) + " | \n") if craypurple > 0: content.write("× " + str(craypurple) + " | \n") if craybrown > 0: content.write("× " + str(craybrown) + " | \n") if craygrey > 0: content.write("× " + str(craygrey) + " | \n") content.write("
\n") if sketch > 19: content.write(" | \n") content.write(" |
" + str(sketch % 20) + "/20 | \n") if sketch > 19: content.write("" + str(int(sketch / 20)) + " completed | \n") content.write("
") masteredcount = 0 for deck in mastereddecks: if masteredcount < variables.maxmastered: content.write("") masteredcount += 1 if len(mastereddecks) > variables.maxmastered: content.write(" see all") content.write("
\n") sigs = [] for card in tcgcore.ownedcards(): if card[0:4] == "sig_": sigs.append(card) if len(sigs) > 0: content.write("") for card in sigs: content.write(tcgcore.printcard(card)) content.write("
\n") if len(variables.faves) > 0: content.write("") faveslist = sorted(variables.faves) for card in faveslist: content.write(tcgcore.printcard(card)) content.write("
\n") content.close() skel.footerwrite(thefile) if __name__ == "__main__": indexgen()