@ -1,5 +1,5 @@
import os
import cardstring , gamesort , skeleton , variables
import cardstring , gamesort , game skel, variables
from pathlib import Path
from datetime import datetime , timedelta
@ -11,13 +11,13 @@ home = str(Path.home())
def backlog ( local = False ) :
# delete existing file
if not os . path . isdir ( " build/backlog" ) :
os . mkdir ( " build/backlog" )
if os . path . exists ( " build/backlog/index.html" ) :
os . remove ( " build/backlog/index.html" )
if not os . path . isdir ( " game build/backlog" ) :
os . mkdir ( " game build/backlog" )
if os . path . exists ( " game build/backlog/index.html" ) :
os . remove ( " game build/backlog/index.html" )
# write header
skeleton . headerwrite ( " build/backlog/index.html" , " backlog " , local )
output = " build/backlog/index.html"
game skel. headerwrite ( " game build/backlog/index.html" , " backlog " , local )
output = " game build/backlog/index.html"
filewrite = open ( output , " a " )
filewrite . write ( " <section> \n <div> \n <h1>Now Playing</h1> \n <div class= \" now-playing \" > \n " )
playingnow = [ ]
@ -65,9 +65,9 @@ def backlog(local=False):
filewrite . write ( " <h1>Backlog Breakdown</h1> \n <div class= \" backlog-breakdown \" > \n <div class= \" backlog-charts \" > \n <div class= \" mem-sum \" > \n <div class= \" donut \" > \n <svg viewBox= \" 0 0 42 42 \" > \n <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/index.html" )
filewrite . write ( variables . localpath + " game build/library/index.html" )
else :
filewrite . write ( variables . serverpath + " library " )
filewrite . write ( variables . game serverpath + " library " )
filewrite . write ( " \" ><text x= \" 21 \" y= \" 17.5 \" style= \" font-size: 3.5px; opacity: 0.75; text-anchor: middle; \" >Total Games</text> \n <text x= \" 21 \" y= \" 27 \" style= \" font-size: 10px; text-anchor: middle; \" > " + str ( len ( gamesort . games ) ) + " </text> \n <circle id= \" circle \" r= \" 15.91549430918954 \" cy= \" 21 \" cx= \" 21 \" stroke-width= \" 4 \" stroke= \" #000000c0 \" fill= \" transparent \" > \n </circle> \n " )
backlog = gamesort . unfinished ( gamesort . games ) + gamesort . unplayed ( gamesort . games )
@ -110,9 +110,9 @@ def backlog(local=False):
filewrite . write ( " </a></svg> \n </div> \n <div class= \" donut \" > \n <svg viewBox= \" 0 0 42 42 \" > \n <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/history/index.html" )
filewrite . write ( variables . localpath + " game build/history/index.html" )
else :
filewrite . write ( variables . serverpath + " history " )
filewrite . write ( variables . game serverpath + " history " )
filewrite . write ( " \" ><text x= \" 21 \" y= \" 17.5 \" style= \" font-size: 3.5px; opacity: 0.75; text-anchor: middle; \" > " + gamesort . thisyear + " Backlog</text> \n <text x= \" 21 \" y= \" 27 \" style= \" font-size: 10px; text-anchor: middle; \" > " )
if yeargames > 0 :
@ -194,126 +194,126 @@ def backlog(local=False):
if gamesort . unplayed ( gamesort . games ) / maxvalue > 0.5 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-unplayed/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-unplayed/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-unplayed " )
filewrite . write ( variables . game serverpath + " library/all-unplayed " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . unplayed ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " UP.png \" > \n </div> \n <div> \n <div class= \" Unplayed \" style= \" width: calc(100 % * ( " + str ( gamesort . unplayed ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > " + str ( round ( ( ( gamesort . unplayed ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % Unplayed</div> \n </div> \n </a> \n " )
else :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-unplayed/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-unplayed/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-unplayed " )
filewrite . write ( variables . game serverpath + " library/all-unplayed " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . unplayed ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " UP.png \" > \n </div> \n <div> \n <div class= \" Unplayed \" style= \" width: calc(100 % * ( " + str ( gamesort . unplayed ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > \n </div> \n <div class= \" borderless \" > " + str ( round ( ( ( gamesort . unplayed ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % Unplayed</div> \n </div> \n </a> \n " )
if gamesort . unfinished ( gamesort . games ) / maxvalue > 0.5 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-unfinished/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-unfinished/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-unfinished " )
filewrite . write ( variables . game serverpath + " library/all-unfinished " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . unfinished ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " UF.png \" > \n </div> \n <div> \n <div class= \" Unfinished \" style= \" width: calc(100 % * ( " + str ( gamesort . unfinished ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > " + str ( round ( ( ( gamesort . unfinished ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % Unfinished</div> \n </div> \n </a> \n " )
else :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-unfinished/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-unfinished/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-unfinished " )
filewrite . write ( variables . game serverpath + " library/all-unfinished " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . unfinished ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " UF.png \" > \n </div> \n <div> \n <div class= \" Unfinished \" style= \" width: calc(100 % * ( " + str ( gamesort . unfinished ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > \n </div> \n <div class= \" borderless \" > " + str ( round ( ( ( gamesort . unfinished ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % Unfinished</div> \n </div> \n </a> \n " )
if gamesort . beaten ( gamesort . games ) / maxvalue > 0.5 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-beaten/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-beaten/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-beaten " )
filewrite . write ( variables . game serverpath + " library/all-beaten " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . beaten ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " B.png \" > \n </div> \n <div> \n <div class= \" Beaten \" style= \" width: calc(100 % * ( " + str ( gamesort . beaten ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > " + str ( round ( ( ( gamesort . beaten ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % Beaten</div> \n </div> \n </a> \n " )
else :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-beaten/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-beaten/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-beaten " )
filewrite . write ( variables . game serverpath + " library/all-beaten " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . beaten ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " B.png \" > \n </div> \n <div> \n <div class= \" Beaten \" style= \" width: calc(100 % * ( " + str ( gamesort . beaten ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > \n </div> \n <div class= \" borderless \" > " + str ( round ( ( ( gamesort . beaten ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % Beaten</div> \n </div> \n </a> \n " )
if gamesort . completed ( gamesort . games ) / maxvalue > 0.5 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-completed/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-completed/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-completed " )
filewrite . write ( variables . game serverpath + " library/all-completed " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . completed ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " C.png \" > \n </div> \n <div> \n <div class= \" Completed \" style= \" width: calc(100 % * ( " + str ( gamesort . completed ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > " + str ( round ( ( ( gamesort . completed ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % Completed</div> \n </div> \n </a> \n " )
else :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-completed/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-completed/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-completed " )
filewrite . write ( variables . game serverpath + " library/all-completed " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . completed ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " C.png \" > \n </div> \n <div> \n <div class= \" Completed \" style= \" width: calc(100 % * ( " + str ( gamesort . completed ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > \n </div> \n <div class= \" borderless \" > " + str ( round ( ( ( gamesort . completed ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % Completed</div> \n </div> \n </a> \n " )
if gamesort . endless ( gamesort . games ) / maxvalue > 0.5 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-endless/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-endless/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-endless " )
filewrite . write ( variables . game serverpath + " library/all-endless " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . endless ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " E.png \" > \n </div> \n <div> \n <div class= \" Endless \" style= \" width: calc(100 % * ( " + str ( gamesort . endless ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > " + str ( round ( ( ( gamesort . endless ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % E ndless</div> \n </div> \n </a> \n " )
else :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/all-endless/index.html" )
filewrite . write ( variables . localpath + " game build/library/all-endless/index.html" )
else :
filewrite . write ( variables . serverpath + " library/all-endless " )
filewrite . write ( variables . game serverpath + " library/all-endless " )
filewrite . write ( " \" > \n <div> " + str ( gamesort . endless ( gamesort . games ) ) + " </div> \n <div> \n <img src= \" " )
if local :
filewrite . write ( variables . localpath + " build/" )
filewrite . write ( variables . localpath + " game build/" )
else :
filewrite . write ( variables . serverpath)
filewrite . write ( variables . game serverpath)
filewrite . write ( " E.png \" > \n </div> \n <div> \n <div class= \" Endless \" style= \" width: calc(100 % * ( " + str ( gamesort . endless ( gamesort . games ) ) + " / " + str ( maxvalue ) + " )); \" > \n </div> \n <div class= \" borderless \" > " + str ( round ( ( ( gamesort . endless ( gamesort . games ) / gamesort . total ( gamesort . games ) ) * 100 ) , 1 ) ) + " % E ndless</div> \n </div> \n </a> \n " )
filewrite . write ( " </div> \n </div> \n </div> \n " )
@ -337,14 +337,14 @@ def backlog(local=False):
if ctotal > 0 :
filewrite . write ( " <div class= \" platform-card \" > \n <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/" + console [ " shortname " ] . lower ( ) + " -all/index.html " )
filewrite . write ( variables . localpath + " game build/library/" + console [ " shortname " ] . lower ( ) + " -all/index.html " )
else :
filewrite . write ( variables . serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -all " )
filewrite . write ( variables . game serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -all " )
filewrite . write ( " \" class= \" title \" > " + console [ " name " ] + " </a> \n <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/" + console [ " shortname " ] . lower ( ) + " -all/index.html " )
filewrite . write ( variables . localpath + " game build/library/" + console [ " shortname " ] . lower ( ) + " -all/index.html " )
else :
filewrite . write ( variables . serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -all " )
filewrite . write ( variables . game serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -all " )
filewrite . write ( " \" class= \" abbr \" > " + console [ " shortname " ] + " </a> \n <div class= \" bars \" > \n " )
for game in consolegames :
try :
@ -367,47 +367,47 @@ def backlog(local=False):
if cunplayed > 0 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/" + console [ " shortname " ] . lower ( ) + " -unplayed/index.html " )
filewrite . write ( variables . localpath + " game build/library/" + console [ " shortname " ] . lower ( ) + " -unplayed/index.html " )
else :
filewrite . write ( variables . serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -unplayed " )
filewrite . write ( variables . game serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -unplayed " )
filewrite . write ( " \" class= \" unplayed \" title= \" Unplayed \" style= \" flex: " + str ( cunplayed ) + " 1 0 % ; \" > " + str ( cunplayed ) + " </a> \n " )
if cunfinished > 0 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/" + console [ " shortname " ] . lower ( ) + " -unfinished/index.html " )
filewrite . write ( variables . localpath + " game build/library/" + console [ " shortname " ] . lower ( ) + " -unfinished/index.html " )
else :
filewrite . write ( variables . serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -unfinished " )
filewrite . write ( variables . game serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -unfinished " )
filewrite . write ( " \" class= \" unfinished \" title= \" Unfinished \" style= \" flex: " + str ( cunfinished ) + " 1 0 % ; \" > " + str ( cunfinished ) + " </a> \n " )
if cbeaten > 0 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/" + console [ " shortname " ] . lower ( ) + " -beaten/index.html " )
filewrite . write ( variables . localpath + " game build/library/" + console [ " shortname " ] . lower ( ) + " -beaten/index.html " )
else :
filewrite . write ( variables . serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -beaten " )
filewrite . write ( variables . game serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -beaten " )
filewrite . write ( " \" class= \" beaten \" title= \" Beaten \" style= \" flex: " + str ( cbeaten ) + " 1 0 % ; \" > " + str ( cbeaten ) + " </a> \n " )
if ccompleted > 0 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/" + console [ " shortname " ] . lower ( ) + " -completed/index.html " )
filewrite . write ( variables . localpath + " game build/library/" + console [ " shortname " ] . lower ( ) + " -completed/index.html " )
else :
filewrite . write ( variables . serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -completed " )
filewrite . write ( variables . game serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -completed " )
filewrite . write ( " \" class= \" completed \" title= \" Completed \" style= \" flex: " + str ( ccompleted ) + " 1 0 % ; \" > " + str ( ccompleted ) + " </a> \n " )
if cendless > 0 :
filewrite . write ( " <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/" + console [ " shortname " ] . lower ( ) + " -endless/index.html " )
filewrite . write ( variables . localpath + " game build/library/" + console [ " shortname " ] . lower ( ) + " -endless/index.html " )
else :
filewrite . write ( variables . serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -endless " )
filewrite . write ( variables . game serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -endless " )
filewrite . write ( " \" class= \" endless \" title= \" Endless \" style= \" flex: " + str ( cendless ) + " 1 0 % ; \" > " + str ( cendless ) + " </a> \n " )
filewrite . write ( " </div> \n <a href= \" " )
if local :
filewrite . write ( variables . localpath + " build/library/" + console [ " shortname " ] . lower ( ) + " -all/index.html " )
filewrite . write ( variables . localpath + " game build/library/" + console [ " shortname " ] . lower ( ) + " -all/index.html " )
else :
filewrite . write ( variables . serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -all " )
filewrite . write ( variables . game serverpath + " library/ " + console [ " shortname " ] . lower ( ) + " -all " )
filewrite . write ( " \" class= \" total \" > " + str ( ctotal ) + " \n <span>Total</span> \n </a> \n </div> \n " )
filewrite . write ( " </div> \n </div> \n </div> \n " )
filewrite . close ( )
skeleton . footerwrite ( " build/backlog/index.html" )
game skel. footerwrite ( " game build/backlog/index.html" )
if __name__ == " __main__ " :
backlog ( True )