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

@ -144,6 +144,14 @@ a {
text-decoration:none text-decoration:none
} }
div#about_note a {
text-decoration: underline;
}
div#about_note a:hover {
opacity: .7;
}
.link,a { .link,a {
color:var(--active-text) color:var(--active-text)
} }

View file

@ -325,7 +325,7 @@ def unplayed(selection):
gamehue = 250 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): def headerwrite(output,section):
header = open(output, "a") 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" 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: try:
if game["firstplayed"]: if game["firstplayed"]:
cardstring += " <div>\n <div>" + game["firstplayed"].strftime("%Y-%m-%d") + "</div>\n <div>\n <div class=\"status-dot " try:
if game["id"] in endlessgames: if game["firstplayed"] != game["beaten"]:
cardstring += "Endless" cardstring += " <div>\n <div>" + game["firstplayed"].strftime("%Y-%m-%d") + "</div>\n <div>\n <div class=\"status-dot "
else: if game["id"] in endlessgames:
cardstring += "Started" cardstring += "Endless"
cardstring += "\"></div>Started</div>\n </div>\n" 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: except:
pass pass
try: try:
@ -944,54 +953,53 @@ def history():
theyear = int(thisyear) theyear = int(thisyear)
while theyear >= gamestartyear: while theyear >= gamestartyear:
yearlist = [] histlist = []
feedlist = []
enddate = datetime.strptime((str(theyear) + "-12-31"),"%Y-%m-%d") enddate = datetime.strptime((str(theyear) + "-12-31"),"%Y-%m-%d")
startdate = datetime.strptime((str(theyear) + "-01-01"),"%Y-%m-%d") startdate = datetime.strptime((str(theyear) + "-01-01"),"%Y-%m-%d")
eachdate = enddate eachdate = enddate
while eachdate >= startdate: while eachdate >= startdate:
for game in games: 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: try:
if game["gameplay"] == eachdate: if game["gameplay"] == eachdate:
if game["firstplayed"] != eachdate: if game["firstplayed"] != eachdate:
yearlist.append({"date":eachdate,"name":game["name"],"console":game["console"],"action":"Playing"}) feedlist.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"})
except: except:
pass pass
try: try:
if game["completed"] == eachdate: 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: except:
pass 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) eachdate -= timedelta(days=1)
checkdate = enddate checkdate = enddate
for event in yearlist: for event in histlist:
filewrite.write(" <div>\n") filewrite.write(" <div>\n")
if checkdate != event["date"]: if checkdate != event["date"]:
filewrite.write(" <h2>" + event["date"].strftime("%Y-%m-%d") + "</h2>\n") filewrite.write(" <h2>" + event["date"].strftime("%Y-%m-%d") + "</h2>\n")
@ -1003,8 +1011,11 @@ def history():
else: else:
filewrite.write("Started") filewrite.write("Started")
else: 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") 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") 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"] checkdate = event["date"]
theyear -= 1 theyear -= 1