Working backlog and library tabs
This commit is contained in:
parent
c1b769cdf1
commit
7cef3a430f
1 changed files with 199 additions and 9 deletions
208
games.py
208
games.py
|
@ -67,29 +67,219 @@ for gameupdate in holding:
|
|||
|
||||
games = sorted(games,key=lambda d: d["lastupdate"])
|
||||
|
||||
ps5list = []
|
||||
for game in games:
|
||||
if game["console"] == "ps5":
|
||||
ps5list.append(game)
|
||||
|
||||
ps2list = []
|
||||
for game in games:
|
||||
if game["console"] == "ps2":
|
||||
ps2list.append(game)
|
||||
|
||||
ps3list = []
|
||||
for game in games:
|
||||
if game["console"] == "ps3":
|
||||
ps3list.append(game)
|
||||
|
||||
xbox360list = []
|
||||
for game in games:
|
||||
if game["console"] == "xbox 360":
|
||||
xbox360list.append(game)
|
||||
|
||||
pclist = []
|
||||
for game in games:
|
||||
if game["console"] == "pc":
|
||||
pclist.append(game)
|
||||
|
||||
dslist = []
|
||||
for game in games:
|
||||
if game["console"] == "nintendo ds":
|
||||
dslist.append(game)
|
||||
|
||||
switchlist = []
|
||||
for game in games:
|
||||
if game["console"] == "nintendo switch":
|
||||
switchlist.append(game)
|
||||
|
||||
threedslist = []
|
||||
for game in games:
|
||||
if game["console"] == "nintendo 3ds":
|
||||
threedslist.append(game)
|
||||
|
||||
# NOW PLAYING
|
||||
|
||||
playingnow = []
|
||||
|
||||
def nowplaying(consolelist):
|
||||
if len(consolelist) > 0:
|
||||
thegame = consolelist[-1]
|
||||
try:
|
||||
if thegame["gameplay"]:
|
||||
try:
|
||||
if thegame["completed"]:
|
||||
if thegame["completed"] > thegame["gameplay"]:
|
||||
playing = False
|
||||
else:
|
||||
playing = True
|
||||
state = "completed"
|
||||
except:
|
||||
try:
|
||||
if thegame["beaten"]:
|
||||
if thegame["beaten"] > thegame["gameplay"]:
|
||||
playing = False
|
||||
else:
|
||||
playing = True
|
||||
state = "beaten"
|
||||
except:
|
||||
playing = True
|
||||
state = "playing"
|
||||
if playing:
|
||||
playingnow.append({"console":thegame["console"],"name":thegame["name"],"date":thegame["gameplay"],"state":state,"note":thegame["recent"]})
|
||||
except:
|
||||
pass
|
||||
|
||||
nowplaying(dslist)
|
||||
nowplaying(threedslist)
|
||||
nowplaying(switchlist)
|
||||
nowplaying(pclist)
|
||||
nowplaying(ps2list)
|
||||
nowplaying(ps3list)
|
||||
nowplaying(ps5list)
|
||||
nowplaying(xbox360list)
|
||||
|
||||
playingnow = sorted(playingnow,key=lambda d: d["date"],reverse=True)
|
||||
|
||||
for game in playingnow:
|
||||
if len(game["note"]) > 1:
|
||||
print(game["console"] + " → " + game["name"] + " (" + game["state"] + "): " + game["note"])
|
||||
else:
|
||||
print(game["console"] + " → " + game["name"] + " (" + game["state"] + ")")
|
||||
|
||||
# BACKLOG BREAKDOWN
|
||||
|
||||
print("Total Games: " + str(len(games)))
|
||||
|
||||
yeargames = 0
|
||||
for game in games:
|
||||
if int(game["initialdate"].year) == int(thisyear):
|
||||
try:
|
||||
if game["completed"]:
|
||||
pass
|
||||
except:
|
||||
try:
|
||||
if game["beaten"]:
|
||||
pass
|
||||
except:
|
||||
yeargames += 1
|
||||
print(thisyear + " Backlog: " + str(yeargames))
|
||||
|
||||
completed = 0
|
||||
beaten = 0
|
||||
unfinished = 0
|
||||
total = len(games)
|
||||
if total > 0:
|
||||
for game in games:
|
||||
try:
|
||||
if game["completed"]:
|
||||
completed += 1
|
||||
except:
|
||||
try:
|
||||
if game["beaten"]:
|
||||
beaten += 1
|
||||
except:
|
||||
try:
|
||||
if game["gameplay"]:
|
||||
unfinished += 1
|
||||
except:
|
||||
pass
|
||||
unplayed = total - (completed + beaten + unfinished)
|
||||
backlog = unfinished + unplayed
|
||||
print("Active Backlog • " + str(backlog) + " • " + str(round(((backlog/total)*100),1)) + "%")
|
||||
if unplayed > 0:
|
||||
print(str(unplayed) + " – " + str(round(((unplayed/total)*100),1)) + "% Unplayed")
|
||||
if unfinished > 0:
|
||||
print(str(unfinished) + " – " + str(round(((unfinished/total)*100),1)) + "% Unfinished")
|
||||
if beaten > 0:
|
||||
print(str(beaten) + " – " + str(round(((beaten/total)*100),1)) + "% Beaten")
|
||||
if completed > 0:
|
||||
print(str(completed) + " – " + str(round(((completed/total)*100),1)) + "% Completed")
|
||||
|
||||
# PLATFORM SUMMARY
|
||||
|
||||
def liststats(console,consolelist):
|
||||
completed = 0
|
||||
beaten = 0
|
||||
unfinished = 0
|
||||
total = len(consolelist)
|
||||
if total > 0:
|
||||
for game in consolelist:
|
||||
try:
|
||||
if game["completed"]:
|
||||
completed += 1
|
||||
except:
|
||||
try:
|
||||
if game["beaten"]:
|
||||
beaten += 1
|
||||
except:
|
||||
try:
|
||||
if game["gameplay"]:
|
||||
unfinished += 1
|
||||
except:
|
||||
pass
|
||||
unplayed = total - (completed + beaten + unfinished)
|
||||
print(console)
|
||||
if completed > 0:
|
||||
print("Completed: " + str(completed))
|
||||
if beaten > 0:
|
||||
print("Beaten: " + str(beaten))
|
||||
if unfinished > 0:
|
||||
print("Unfinished: " + str(unfinished))
|
||||
if unplayed > 0:
|
||||
print("Unplayed: " + str(unplayed))
|
||||
print("Total: " + str(total))
|
||||
|
||||
liststats("DS",dslist)
|
||||
liststats("3DS",threedslist)
|
||||
liststats("Switch",switchlist)
|
||||
liststats("PC",pclist)
|
||||
liststats("PS2",ps2list)
|
||||
liststats("PS3",ps3list)
|
||||
liststats("PS5",ps5list)
|
||||
liststats("XBOX 360",xbox360list)
|
||||
|
||||
# LIBRARY
|
||||
|
||||
def theresults():
|
||||
newgames = sorted(games,key=lambda d: d["id"])
|
||||
for game in newgames:
|
||||
try:
|
||||
if (game["completed"]):
|
||||
print(game["id"] + ": completed " + (datetime.strftime(game["completed"],"%-d %B %Y")))
|
||||
print(game["console"] + " → " + game["name"] + " (completed)")
|
||||
if len(game["recent"]) > 1:
|
||||
print("Notes: " + game["recent"])
|
||||
print(game["recent"])
|
||||
except:
|
||||
try:
|
||||
if (game["beaten"]):
|
||||
print(game["id"] + ": beaten " + (datetime.strftime(game["beaten"],"%-d %B %Y")))
|
||||
print(game["console"] + " → " + game["name"] + " (beaten)")
|
||||
if len(game["recent"]) > 1:
|
||||
print("Notes: " + game["recent"])
|
||||
print(game["recent"])
|
||||
except:
|
||||
try:
|
||||
if (game["gameplay"]):
|
||||
print(game["id"] + ": last played " + (datetime.strftime(game["gameplay"],"%-d %B %Y")))
|
||||
print(game["console"] + " → " + game["name"] + " (unfinished)")
|
||||
if len(game["recent"]) > 1:
|
||||
print("Notes: " + game["recent"])
|
||||
print(game["recent"])
|
||||
except:
|
||||
print(game["id"] + ": no data")
|
||||
print(game["console"] + " → " + game["name"] + " (unplayed)")
|
||||
print("")
|
||||
|
||||
if __name__ == "__main__":
|
||||
theresults()
|
||||
theresults()
|
||||
|
||||
# HISTORY
|
||||
|
||||
# iterate backwards from this year to 2016
|
||||
|
||||
# if nothing in this year, "history has yet to be written"
|
||||
|
||||
# else, for each year: initialdate, gameplay???, beaten, completed???
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue