|
|
|
import datetime,os
|
|
|
|
import log,skel,tcgcore
|
|
|
|
|
|
|
|
def loggen():
|
|
|
|
if not os.path.isdir("build/log"):
|
|
|
|
os.mkdir("build/log")
|
|
|
|
if os.path.exists("build/log/index.html"):
|
|
|
|
os.remove("build/log/index.html")
|
|
|
|
thefile = "build/log/index.html"
|
|
|
|
skel.headerwrite(thefile,"log")
|
|
|
|
content = open(thefile,"a")
|
|
|
|
content.write("<h1>log</h1>\n")
|
|
|
|
thelog = log.log[::-1]
|
|
|
|
for event in thelog:
|
|
|
|
content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code> <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>: ")
|
|
|
|
try:
|
|
|
|
if event["received"]:
|
|
|
|
content.write("Received ")
|
|
|
|
receivedlist = sorted(event["received"])
|
|
|
|
for card in receivedlist:
|
|
|
|
content.write(tcgcore.cardtext(card))
|
|
|
|
if receivedlist.index(card) != len(receivedlist) - 1:
|
|
|
|
content.write(", ")
|
|
|
|
content.write(".")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
if event["crayons"]:
|
|
|
|
crayontypes = len(event["crayons"])
|
|
|
|
content.write("Gained crayons: ")
|
|
|
|
try:
|
|
|
|
redno = event["crayons"]["red"]
|
|
|
|
content.write(str(redno) + " red")
|
|
|
|
if list(event["crayons"])[-1] != "red":
|
|
|
|
content.write(", ")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
orangeno = event["crayons"]["orange"]
|
|
|
|
content.write(str(orangeno) + " orange")
|
|
|
|
if list(event["crayons"])[-1] != "orange":
|
|
|
|
content.write(", ")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
yellowno = event["crayons"]["yellow"]
|
|
|
|
content.write(str(yellowno) + " yellow")
|
|
|
|
if list(event["crayons"])[-1] != "yellow":
|
|
|
|
content.write(", ")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
greenno = event["crayons"]["green"]
|
|
|
|
content.write(str(greenno) + " green")
|
|
|
|
if list(event["crayons"])[-1] != "green":
|
|
|
|
content.write(", ")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
blueno = event["crayons"]["blue"]
|
|
|
|
content.write(str(blueno) + " blue")
|
|
|
|
if list(event["crayons"])[-1] != "blue":
|
|
|
|
content.write(", ")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
purpleno = event["crayons"]["purple"]
|
|
|
|
content.write(str(purpleno) + " purple")
|
|
|
|
if list(event["crayons"])[-1] != "purple":
|
|
|
|
content.write(", ")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
brownno = event["crayons"]["brown"]
|
|
|
|
content.write(str(brownno) + " brown")
|
|
|
|
if list(event["crayons"])[-1] != "brown":
|
|
|
|
content.write(", ")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
grayno = event["crayons"]["gray"]
|
|
|
|
if variables.british:
|
|
|
|
content.write(str(grayno) + " grey")
|
|
|
|
else:
|
|
|
|
content.write(str(grayno) + " gray")
|
|
|
|
if list(event["crayons"])[-1] != "gray":
|
|
|
|
content.write(", ")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
content.write(".")
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
content.write("</p>\n")
|
|
|
|
content.close()
|
|
|
|
skel.footerwrite(thefile)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
loggen()
|