Generate year backlog

master
trémeur 11 months ago
parent 674b53a694
commit 6ad0bbf004

@ -19,7 +19,7 @@ year = 2016
concernedfiles = [] concernedfiles = []
endlessgames = ["the sims 4 (pc)","american truck simulator (pc)","civilization iv (pc)","final fantasy xiv (pc)","medieval ii: total war (pc)","tabletop simulator (pc)","train simulator 2020 (pc)"] endlessgames = ["the sims 4 (pc)","american truck simulator (pc)","civilization iv (pc)","final fantasy xiv (pc)","medieval ii: total war (pc)","tabletop simulator (pc)","train simulator 2020 (pc)","theatrhythm curtain call (nintendo 3ds)"]
while year < int(thisyear) + 1: while year < int(thisyear) + 1:
month = 0 month = 0
@ -141,7 +141,7 @@ def nowplaying(consolelist):
if len(consolelist) > 0: if len(consolelist) > 0:
thegame = consolelist[-1] thegame = consolelist[-1]
try: try:
if thegame["gameplay"]: if thegame["gameplay"] > (datetime.now() - timedelta(days=180)):
try: try:
if thegame["completed"]: if thegame["completed"]:
if thegame["completed"] > thegame["gameplay"]: if thegame["completed"] > thegame["gameplay"]:
@ -312,25 +312,85 @@ if endless > 0:
yeargames = 0 yeargames = 0
yearplaying = 0 yearplaying = 0
for game in games: for game in games:
if int(game["initialdate"].year) == int(thisyear): if game["initialdate"].year == int(thisyear):
try: try:
if game["completed"]: if game["gameplay"]:
if game["id"] not in endlessgames:
yeargames += 1
except:
yeargames += 1
for game in games:
try:
if game["beaten"].year == int(thisyear):
yeargames -= 1
except:
try:
if game["completed"].year == int(thisyear):
yeargames -= 1
except:
pass pass
writeindex.write(" </svg>\n </div>\n <div class=\"donut\">\n <svg viewBox=\"0 0 42 42\">\n <text x=\"21\" y=\"17.5\" style=\"font-size: 3.5px; opacity: 0.75; text-anchor: middle;\">" + thisyear + " Backlog</text>\n <text x=\"21\" y=\"27\" style=\"font-size: 10px; text-anchor: middle;\">")
if yeargames > 0:
writeindex.write("")
elif yeargames < 0:
writeindex.write("")
writeindex.write(str(abs(yeargames)) + "</text>\n <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"4\" stroke=\"#000000c0\" fill=\"transparent\">\n </circle>\n")
yearbacklog = []
for game in games:
try:
if game["completed"].year == int(thisyear):
yearbacklog.append(game)
except:
try:
if game["beaten"].year == int(thisyear):
yearbacklog.append(game)
except:
if game["initialdate"].year == int(thisyear):
yearbacklog.append(game)
yearcompleted = 0
yearbeaten = 0
yearendless = 0
yearunfinished = 0
yeartotal = len(yearbacklog)
if yeartotal > 0:
for game in yearbacklog:
try:
if game["completed"]:
yearcompleted += 1
except: except:
try: try:
if game["beaten"]: if game["beaten"]:
pass yearbeaten += 1
except: except:
yeargames += 1
try: try:
if game["gameplay"]: if game["gameplay"]:
yearplaying += 1 if game["id"] in endlessgames:
yearendless += 1
else:
yearunfinished += 1
except: except:
pass pass
yearunplayed = yeartotal - (yearcompleted + yearbeaten + yearunfinished + yearendless)
writeindex.write(" </svg>\n </div>\n <div class=\"donut\">\n <svg viewBox=\"0 0 42 42\">\n <text x=\"21\" y=\"17.5\" style=\"font-size: 3.5px; opacity: 0.75; text-anchor: middle;\">" + thisyear + " Backlog</text>\n <text x=\"21\" y=\"27\" style=\"font-size: 10px; text-anchor: middle;\">" + str(yeargames) + "</text>\n <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"4\" stroke=\"#000000c0\" fill=\"transparent\">\n </circle>\n <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"3\" stroke=\"hsla(200, 30%, 30%, 0.9)\" fill=\"transparent\" stroke-dasharray=\"100 100\">\n </circle>\n") yeartakeup = 100
if yearplaying > 0: if yearunplayed > 0:
writeindex.write(" <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"3\" stroke=\"hsla(0, 38%, 35%, 0.9)\" fill=\"transparent\" stroke-dasharray=\"" + str(100 * yeargames / yearplaying) + " 100\">\n </circle>\n") writeindex.write(" <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"3\" stroke=\"hsla(200, 30%, 30%, 0.9)\" fill=\"transparent\" stroke-dasharray=\"" + str(yeartakeup) + " 100\">\n </circle>\n")
yeartakeup = yeartakeup - round(((yearunplayed/yeartotal)*100),1)
if yearunfinished > 0:
writeindex.write(" <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"3\" stroke=\"hsla(0, 38%, 35%, 0.9)\" fill=\"transparent\" stroke-dasharray=\"" + str(yeartakeup) + " 100\">\n </circle>\n")
yeartakeup = yeartakeup - round(((yearunfinished/yeartotal)*100),1)
if yearbeaten > 0:
writeindex.write(" <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"3\" stroke=\"hsla(0, 0%, 82%, 0.9)\" fill=\"transparent\" stroke-dasharray=\"" + str(yeartakeup) + " 100\">\n </circle>\n")
yeartakeup = yeartakeup - round(((yearbeaten/yeartotal)*100),1)
if yearcompleted > 0:
writeindex.write(" <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"3\" stroke=\"hsla(48, 75%, 70%, 0.9)\" fill=\"transparent\" stroke-dasharray=\"" + str(yeartakeup) + " 100\">\n </circle>\n")
yeartakeup = yeartakeup - round(((yearcompleted/yeartotal)*100),1)
if yearendless > 0:
writeindex.write(" <circle id=\"circle\" r=\"15.91549430918954\" cy=\"21\" cx=\"21\" stroke-width=\"3\" stroke=\"hsla(275, 39%, 32%, 0.9)\" fill=\"transparent\" stroke-dasharray=\"" + str(yeartakeup) + " 100\">\n </circle>\n")
writeindex.write(" </svg>\n </div>\n </div>\n <div class=\"status-tally\">\n <div class=\"backlog-tally\">\n <div style=\"width: " + str(round(((backlog/total)*100),1)) + "%;\">\n <span>Active Backlog · " + str(backlog) + " · " + str(round(((backlog/total)*100),1)) + "%</span>\n </div>\n <div style=\"width: " + str(100 - round(((backlog/total)*100),1)) + "%;\">\n </div>\n </div>\n") writeindex.write(" </svg>\n </div>\n </div>\n <div class=\"status-tally\">\n <div class=\"backlog-tally\">\n <div style=\"width: " + str(round(((backlog/total)*100),1)) + "%;\">\n <span>Active Backlog · " + str(backlog) + " · " + str(round(((backlog/total)*100),1)) + "%</span>\n </div>\n <div style=\"width: " + str(100 - round(((backlog/total)*100),1)) + "%;\">\n </div>\n </div>\n")
@ -398,7 +458,7 @@ def liststats(title,abbr,consolelist):
unfinished += 1 unfinished += 1
except: except:
pass pass
unplayed = total - (completed + beaten + unfinished) unplayed = total - (completed + beaten + unfinished + endless)
if unplayed > 0: if unplayed > 0:
writeindex.write(" <a class=\"unplayed\" title=\"Unplayed\" style=\"flex: " + str(unplayed) + " 1 0%;\">" + str(unplayed) + "</a>\n") writeindex.write(" <a class=\"unplayed\" title=\"Unplayed\" style=\"flex: " + str(unplayed) + " 1 0%;\">" + str(unplayed) + "</a>\n")
if unfinished > 0: if unfinished > 0:

Loading…
Cancel
Save