|
|
|
import datetime,os,re
|
|
|
|
import log,skel,variables
|
|
|
|
|
|
|
|
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")
|
|
|
|
cardstotal = 0
|
|
|
|
for event in log.log:
|
|
|
|
try:
|
|
|
|
cardstotal += len(event["received"])
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
firstdate = log.log[0]["date"]
|
|
|
|
if cardstotal > 14400:
|
|
|
|
rankcode = "rainbow"
|
|
|
|
extra = cardstotal - 14400
|
|
|
|
plusranks = int(extra / 300)
|
|
|
|
if plusranks > 0:
|
|
|
|
rank = "rainbow + " + str(plusranks)
|
|
|
|
else:
|
|
|
|
rank = "rainbow"
|
|
|
|
else:
|
|
|
|
if cardstotal > 14100:
|
|
|
|
rank = "himalayan"
|
|
|
|
elif cardstotal > 13800:
|
|
|
|
rank = "puma"
|
|
|
|
elif cardstotal > 13500:
|
|
|
|
rank = "chartreux"
|
|
|
|
elif cardstotal > 13500:
|
|
|
|
rank = "russian blue"
|
|
|
|
elif cardstotal > 12900:
|
|
|
|
rank = "panther"
|
|
|
|
elif cardstotal > 12600:
|
|
|
|
rank = "cheetah"
|
|
|
|
elif cardstotal > 12300:
|
|
|
|
rank = "tiger"
|
|
|
|
elif cardstotal > 12000:
|
|
|
|
rank = "lion"
|
|
|
|
elif cardstotal > 11700:
|
|
|
|
rank = "metal"
|
|
|
|
elif cardstotal > 11400:
|
|
|
|
rank = "ground"
|
|
|
|
elif cardstotal > 11100:
|
|
|
|
rank = "darkness"
|
|
|
|
elif cardstotal > 10800:
|
|
|
|
rank = "water"
|
|
|
|
elif cardstotal > 10500:
|
|
|
|
rank = "nature"
|
|
|
|
elif cardstotal > 10200:
|
|
|
|
rank = "light"
|
|
|
|
elif cardstotal > 9900:
|
|
|
|
rank = "wind"
|
|
|
|
elif cardstotal > 9600:
|
|
|
|
rank = "fire"
|
|
|
|
elif cardstotal > 9300:
|
|
|
|
rank = "mercury"
|
|
|
|
elif cardstotal > 9000:
|
|
|
|
rank = "jupiter"
|
|
|
|
elif cardstotal > 8700:
|
|
|
|
rank = "uranus"
|
|
|
|
elif cardstotal > 8400:
|
|
|
|
rank = "neptune"
|
|
|
|
elif cardstotal > 8100:
|
|
|
|
rank = "earth"
|
|
|
|
elif cardstotal > 7800:
|
|
|
|
rank = "venus"
|
|
|
|
elif cardstotal > 7500:
|
|
|
|
rank = "saturn"
|
|
|
|
elif cardstotal > 7200:
|
|
|
|
rank = "mars"
|
|
|
|
elif cardstotal > 6900:
|
|
|
|
rank = "magnolia"
|
|
|
|
elif cardstotal > 6600:
|
|
|
|
rank = "chocolate cosmos"
|
|
|
|
elif cardstotal > 6300:
|
|
|
|
rank = "lilac"
|
|
|
|
elif cardstotal > 6000:
|
|
|
|
rank = "hydrangea"
|
|
|
|
elif cardstotal > 5700:
|
|
|
|
rank = "clover"
|
|
|
|
elif cardstotal > 5400:
|
|
|
|
rank = "daffodil"
|
|
|
|
elif cardstotal > 5100:
|
|
|
|
rank = "tiger lily"
|
|
|
|
elif cardstotal > 4800:
|
|
|
|
rank = "sakura"
|
|
|
|
elif cardstotal > 4500:
|
|
|
|
rank = "silver"
|
|
|
|
elif cardstotal > 4200:
|
|
|
|
rank = "bronze"
|
|
|
|
elif cardstotal > 3900:
|
|
|
|
rank = "amethyst"
|
|
|
|
elif cardstotal > 3600:
|
|
|
|
rank = "sapphire"
|
|
|
|
elif cardstotal > 3300:
|
|
|
|
rank = "emerald"
|
|
|
|
elif cardstotal > 3000:
|
|
|
|
rank = "gold"
|
|
|
|
elif cardstotal > 2700:
|
|
|
|
rank = "amber"
|
|
|
|
elif cardstotal > 2400:
|
|
|
|
rank = "ruby"
|
|
|
|
elif cardstotal > 2200:
|
|
|
|
rank = "dragon fruit"
|
|
|
|
elif cardstotal > 2000:
|
|
|
|
rank = "apricot"
|
|
|
|
elif cardstotal > 1800:
|
|
|
|
rank = "grape"
|
|
|
|
elif cardstotal > 1600:
|
|
|
|
rank = "blueberry"
|
|
|
|
elif cardstotal > 1400:
|
|
|
|
rank = "lime"
|
|
|
|
elif cardstotal > 1200:
|
|
|
|
rank = "lemon"
|
|
|
|
elif cardstotal > 1000:
|
|
|
|
rank = "tangerine"
|
|
|
|
elif cardstotal > 800:
|
|
|
|
rank = "strawberry"
|
|
|
|
elif cardstotal > 700:
|
|
|
|
rank = "gray"
|
|
|
|
elif cardstotal > 600:
|
|
|
|
rank = "brown"
|
|
|
|
elif cardstotal > 500:
|
|
|
|
rank = "purple"
|
|
|
|
elif cardstotal > 400:
|
|
|
|
rank = "blue"
|
|
|
|
elif cardstotal > 300:
|
|
|
|
rank = "green"
|
|
|
|
elif cardstotal > 200:
|
|
|
|
rank = "yellow"
|
|
|
|
elif cardstotal > 100:
|
|
|
|
rank = "orange"
|
|
|
|
else:
|
|
|
|
rank = "red"
|
|
|
|
rankcode = re.sub(" ","",rank)
|
|
|
|
content.write("<img src=\"/assets/levels/" + rankcode + ".gif\">\n<ul>\n<li>" + str(cardstotal) + " cards held (" + rank + ")</li>\n<li>started <code>" + firstdate.strftime("%Y-%m-%d") + "</code></li>\n<li>last updated <code>" + datetime.datetime.today().strftime("%Y-%m-%d") + "</code></li>\n<li><a href=\"https://git.praze.net/tre/tcg\">code</a> under construction</li>\n</ul>\n")
|
|
|
|
if len(variables.faves) > 0:
|
|
|
|
content.write("<h2>faves</h2>\n<p>")
|
|
|
|
for card in variables.faves:
|
|
|
|
deck = card[:-2]
|
|
|
|
cardid = card[-2:]
|
|
|
|
content.write("<img src=\"/decks/" + deck + "/" + cardid + ".gif\" title=\"" + card + "\">")
|
|
|
|
content.write("</p>\n")
|
|
|
|
content.close()
|
|
|
|
skel.footerwrite(thefile)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
indexgen()
|