Track games more sensibly

This commit is contained in:
mez 2025-04-29 22:57:56 +01:00
parent 795e72b1db
commit c10181274d
2 changed files with 59 additions and 40 deletions

View file

@ -325,7 +325,7 @@ def unplayed(selection):
gamehue = 250
gamedescription = "I nicked this design and method of game tracking from <a href=\"https://backloggery.com\" target=\"_blank\">Backloggery</a>. I dont have full data on when I obtained/started playing some of my games, so some of these statistics are inaccurate.</p><p>I classify games by the console I play them on, not the one they were released for, so there are PS4 games under PS5, GBA games under DS, etc.</p><p>“Complete” means getting all the achievements if its a game/platform that has them; otherwise it means getting in-game 100% completion.</p><p>Achievements and playtime are automatically tracked <a href=\"https://www.exophase.com/user/nawwarnugans/\">on exophase</a>."
gamedescription = "I nicked this design and method of game tracking from <a href=\"https://backloggery.com\" target=\"_blank\">Backloggery</a>. I classify games by the console I play them on, not the one they were released for, so there are PS4 games under PS5, GBA games under DS, etc.</p><p>“Complete” means getting all the achievements if its a game/platform that has them; otherwise it means getting in-game 100% completion.</p><p>Achievements and playtime are automatically tracked <a href=\"https://www.exophase.com/user/nawwarnugans/\" target=\"_blank\">on exophase</a>."
def headerwrite(output,section):
header = open(output, "a")
@ -484,12 +484,21 @@ def playcard(game,decay=False):
cardstring += "</p>\n </div>\n <div>\n <label>Last Updated</label>\n <p>" + game["lastupdate"].strftime("%Y-%m-%d") + "</p>\n </div>\n </div>\n </div>\n <div class=\"history\">\n <div class=\"box_1\">\n <h2>Milestones</h2>\n <div class=\"list\">\n <div>\n <div>" + game["initialdate"].strftime("%Y-%m-%d") + "</div>\n <div>\n <div class=\"status-dot Added\"></div>Added</div>\n </div>\n"
try:
if game["firstplayed"]:
cardstring += " <div>\n <div>" + game["firstplayed"].strftime("%Y-%m-%d") + "</div>\n <div>\n <div class=\"status-dot "
if game["id"] in endlessgames:
cardstring += "Endless"
else:
cardstring += "Started"
cardstring += "\"></div>Started</div>\n </div>\n"
try:
if game["firstplayed"] != game["beaten"]:
cardstring += " <div>\n <div>" + game["firstplayed"].strftime("%Y-%m-%d") + "</div>\n <div>\n <div class=\"status-dot "
if game["id"] in endlessgames:
cardstring += "Endless"
else:
cardstring += "Started"
cardstring += "\"></div>Started</div>\n </div>\n"
except:
cardstring += " <div>\n <div>" + game["firstplayed"].strftime("%Y-%m-%d") + "</div>\n <div>\n <div class=\"status-dot "
if game["id"] in endlessgames:
cardstring += "Endless"
else:
cardstring += "Started"
cardstring += "\"></div>Started</div>\n </div>\n"
except:
pass
try:
@ -944,54 +953,53 @@ def history():
theyear = int(thisyear)
while theyear >= gamestartyear:
yearlist = []
histlist = []
feedlist = []
enddate = datetime.strptime((str(theyear) + "-12-31"),"%Y-%m-%d")
startdate = datetime.strptime((str(theyear) + "-01-01"),"%Y-%m-%d")
eachdate = enddate
while eachdate >= startdate:
for game in games:
try:
if game["firstplayed"] == eachdate:
try:
if game["beat"] != eachdate:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
except:
try:
if game["completed"] != eachdate:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
except:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
except:
pass
if game["initialdate"] == eachdate:
try:
if game["beat"] != eachdate:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Added"})
except:
try:
if game["completed"] != eachdate:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Added"})
except:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Added"})
try:
if game["gameplay"] == eachdate:
if game["firstplayed"] != eachdate:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Playing"})
except:
pass
try:
if game["beaten"] == eachdate:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Beat"})
feedlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Playing"})
except:
pass
try:
if game["completed"] == eachdate:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Completed"})
histlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Completed"})
feedlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Completed"})
except:
pass
try:
if game["beaten"] == eachdate:
histlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Beat"})
feedlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Beat"})
except:
pass
try:
if game["firstplayed"] == eachdate:
try:
if game["beaten"] != eachdate:
histlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
feedlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
except:
try:
if game["completed"] != eachdate:
histlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
feedlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
except:
histlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
feedlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Started"})
except:
pass
if game["initialdate"] == eachdate:
histlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Added"})
feedlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Added"})
eachdate -= timedelta(days=1)
checkdate = enddate
for event in yearlist:
for event in histlist:
filewrite.write(" <div>\n")
if checkdate != event["date"]:
filewrite.write(" <h2>" + event["date"].strftime("%Y-%m-%d") + "</h2>\n")
@ -1003,8 +1011,11 @@ def history():
else:
filewrite.write("Started")
else:
filewrite.write(event["action"])
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")
checkdate = event["date"]
checkdate = enddate
for event in feedlist:
feedwrite.write(" <item>\n <title>" + event["action"] + " " + event["name"] + " (" + event["console"] + ")</title>\n <pubDate>" + event["date"].strftime("%a, %-d %b %Y") + " 00:00:00 GMT</pubDate>\n <link>https://tre.praze.net/trackers/games/history</link>\n <guid isPermaLink=\"false\">" + event["action"] + "-" + event["name"].replace(" ","-") + "-" + event["date"].strftime("%Y-%m-%d") + "</guid>\n <description>" + event["action"] + " " + event["name"] + " (" + event["console"] + ")</description>\n </item>\n")
checkdate = event["date"]
theyear -= 1