You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.8 KiB
Python
50 lines
1.8 KiB
Python
import datetime,os
|
|
import log,skel
|
|
|
|
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>: Received ")
|
|
receivedlist = sorted(event["received"])
|
|
for card in receivedlist:
|
|
with open("build/decks/" + card[:-2] + "/type") as thetype:
|
|
cardtype = thetype.read()
|
|
content.write("<span class=\"cardname\">")
|
|
if cardtype == "red":
|
|
content.write("🔴")
|
|
elif cardtype == "orange":
|
|
content.write("🟠")
|
|
elif cardtype == "yellow":
|
|
content.write("🟡")
|
|
elif cardtype == "green":
|
|
content.write("🟢")
|
|
elif cardtype == "blue":
|
|
content.write("🔵")
|
|
elif cardtype == "purple":
|
|
content.write("🟣")
|
|
elif cardtype == "brown":
|
|
content.write("🟤")
|
|
elif cardtype == "gray":
|
|
content.write("⚪")
|
|
elif cardtype == "special":
|
|
content.write("✨")
|
|
content.write(card + "</span>")
|
|
if receivedlist.index(card) == len(receivedlist) - 1:
|
|
content.write(" ")
|
|
else:
|
|
content.write(", ")
|
|
content.write(" <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>.</p>\n")
|
|
content.close()
|
|
skel.footerwrite(thefile)
|
|
|
|
if __name__ == "__main__":
|
|
loggen()
|