import gamesort,variables from pathlib import Path from datetime import datetime,timedelta home = str(Path.home()) def playcard(game,local=False,decay=False): cardstring = "" if decay == True: cardstring += "
\n" else: cardstring += "
\n" cardstring += " \n
\n
\n" for console in variables.consoles: if game["console"] == console["code"]: cardstring += " \""\n" cardstring += "
\n
\n
\n" try: if game["completed"]: cardstring += " \"C\"\n" except: try: if game["beaten"]: cardstring += " \"B\"\n" except: try: if game["gameplay"]: if game["id"] in variables.endlessgames: cardstring += " \"E\"\n" else: cardstring += " \"UF\"\n" except: cardstring += " \"UP\"\n" cardstring += "
\n
\n
" + game["name"] + "
\n" try: if len(game["recent"]) > 1: cardstring += "
" + game["recent"] + "
\n" except: pass try: if game["gameplay"]: try: if game["completed"]: if game["gameplay"] > game["completed"]: if game["gameplay"] < (datetime.now() - timedelta(days=180)): cardstring += "
\n
\n \n
\n" else: cardstring += " \n
\n \"⯈\"\n
\n" else: cardstring += " \n
\n \n
\n" except: try: if game["beaten"]: if game["gameplay"] > game["beaten"]: if game["gameplay"] < (datetime.now() - timedelta(days=180)): cardstring += " \n
\n \n
\n" else: cardstring += " \n
\n \"⯈\"\n
\n" else: cardstring += " \n
\n \n
\n" except: if game["gameplay"] < (datetime.now() - timedelta(days=180)): if game["id"] in variables.endlessgames: cardstring += " \n
\n \n
\n" else: cardstring += " \n
\n \"⏸\"\n
\n" else: cardstring += " \n
\n \"⯈\"\n
\n" except: cardstring += " \n
\n \n
\n" cardstring += "
\n
\n
\n
\n" try: if len(game["recent"]) > 1: cardstring += "
\n \n
" + game["recent"] + "
\n
\n" except: pass cardstring += "
\n
\n \n

" try: if game["completed"]: cardstring += "Completed" except: try: if game["beaten"]: cardstring += "Beaten" except: try: if game["gameplay"]: if game["id"] in variables.endlessgames: cardstring += "Endless" else: cardstring += "Unfinished" except: cardstring += "Unplayed" cardstring += "

\n
\n
\n \n

" try: if game["gameplay"]: try: if game["completed"]: if game["gameplay"] > game["completed"]: if game["gameplay"] < (datetime.now() - timedelta(days=180)): cardstring += "Not playing" else: cardstring += "Playing" else: cardstring += "Not playing" except: try: if game["beaten"]: if game["gameplay"] > game["beaten"]: if game["gameplay"] < (datetime.now() - timedelta(days=180)): cardstring += "Not playing" else: cardstring += "Playing" else: cardstring += "Not playing" except: if game["gameplay"] < (datetime.now() - timedelta(days=180)): if game["id"] in variables.endlessgames: cardstring += "Not playing" else: cardstring += "Paused" else: cardstring += "Playing" except: cardstring += "Not playing" cardstring += "

\n
\n
\n
\n
\n
\n \n

" for console in variables.consoles: if game["console"] == console["code"]: cardstring += console["name"] cardstring += "

\n
\n
\n \n

" + game["lastupdate"].strftime("%Y-%m-%d") + "

\n
\n
\n
\n
\n
\n

Milestones

\n
\n
\n
" + game["initialdate"].strftime("%Y-%m-%d") + "
\n
\n Added
\n
\n" try: if game["firstplayed"]: cardstring += "
\n
" + game["firstplayed"].strftime("%Y-%m-%d") + "
\n
\n Started
\n
\n" except: pass try: if game["beaten"]: cardstring += "
\n
" + game["beaten"].strftime("%Y-%m-%d") + "
\n
\n Beaten
\n
\n" except: pass try: if game["completed"]: cardstring += "
\n
" + game["completed"].strftime("%Y-%m-%d") + "
\n
\n Completed
\n
\n" except: pass cardstring += "
\n
\n
\n
\n
\n" return cardstring if __name__ == "__main__": playcard(gamesort.games[0],True)