|
|
|
@ -3,15 +3,17 @@ import gamesort,skeleton,variables
|
|
|
|
|
from datetime import datetime,timedelta
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
Generates history page
|
|
|
|
|
Generates history page and RSS feed
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def history(local=False):
|
|
|
|
|
# delete existing file
|
|
|
|
|
# delete existing files
|
|
|
|
|
if not os.path.isdir("build/history"):
|
|
|
|
|
os.mkdir("build/history")
|
|
|
|
|
if os.path.exists("build/history/index.html"):
|
|
|
|
|
os.remove("build/history/index.html")
|
|
|
|
|
if os.path.exists("build/feed.xml"):
|
|
|
|
|
os.remove("build/feed.xml")
|
|
|
|
|
# write header
|
|
|
|
|
skeleton.headerwrite("build/history/index.html","history",local)
|
|
|
|
|
output = "build/history/index.html"
|
|
|
|
@ -19,6 +21,9 @@ def history(local=False):
|
|
|
|
|
|
|
|
|
|
filewrite.write(" <section class=\"history\">\n <div class=\"list\">\n")
|
|
|
|
|
|
|
|
|
|
feedwrite = open("build/feed.xml", "a")
|
|
|
|
|
feedwrite.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n <channel>\n <atom:link href=\"" + variables.domain + variables.serverpath + "feed.xml\" rel=\"self\" type=\"application/rss+xml\" />\n <title>Static backlog</title>\n <link>" + variables.domain + variables.serverpath + "backlog</link>\n <description>Feed for gaming updates</description>\n <language>en-gb</language>")
|
|
|
|
|
|
|
|
|
|
theyear = int(gamesort.thisyear)
|
|
|
|
|
while theyear > 2016:
|
|
|
|
|
yearlist = []
|
|
|
|
@ -60,9 +65,13 @@ def history(local=False):
|
|
|
|
|
else:
|
|
|
|
|
filewrite.write(event["action"])
|
|
|
|
|
filewrite.write("\"></div>\n </div>\n <div> " + event["name"] + "\n <span>(" + event["console"] + ")</span>\n </div>\n </div>\n </div>\n")
|
|
|
|
|
feedwrite.write(" <item>\n <title>" + event["action"] + " " + event["name"] + " (" + event["console"] + ")</title>\n <pubDate>" + event["date"].strftime("%a, %-d %b %Y") + " 00:00:00 UT</pubDate>\n <link>" + variables.domain + variables.serverpath + "history</link>\n <guid isPermaLink=\"false\">" + event["action"] + "-" + event["name"].replace(" ","-") + "-" + event["console"] + "</guid>\n <description>" + event["action"] + " " + event["name"] + " (" + event["console"] + ")</description>\n </item>\n")
|
|
|
|
|
checkdate = event["date"]
|
|
|
|
|
theyear -= 1
|
|
|
|
|
|
|
|
|
|
feedwrite.write(" </channel>\n</rss>")
|
|
|
|
|
feedwrite.close()
|
|
|
|
|
|
|
|
|
|
filewrite.write(" </div>\n")
|
|
|
|
|
|
|
|
|
|
theyear = int(gamesort.thisyear)
|
|
|
|
|