Prepare for adding other trackers

master
trémeur 6 months ago
parent 6a8a0c40e6
commit 29ab288b65

6
.gitignore vendored

@ -1,6 +1,6 @@
__pycache__/ __pycache__/
build.sh build.sh
build/* gamebuild/*
!build/*.css !gamebuild/*.css
!build/*.png !gamebuild/*.png
variables.py variables.py

@ -4,25 +4,29 @@
- =python3= - =python3=
- =orgparse= (install via pip) - =orgparse= (install via pip)
- =rclone= (for syncing to the server) - =rclone= (for syncing to the server)
* Tracking games with a backloggery clone * General setup
** Setup
*** Fonts
Upload the fonts Lato, Titillium Web, and Material Icons to the directory =/fonts= on your server (I recommend [[https://gwfh.mranftl.com/fonts][google-webfonts-helper]]). Check the filenames are consistent with those in =build/backloggery.css=. Alternatively, you can load the fonts remotely and adjust the page head HTML generated by =skeleton.py=.
*** Setting the variables *** Setting the variables
Rename =variables-template.py= to =variables.py= and edit: Rename =variables-template.py= to =variables.py= and edit:
- =endlessgames=: a list of “endless” games in the format =title (console)=
- =orgpath=: absolute path to the root directory in which =.org= files are stored, including trailing slash - =orgpath=: absolute path to the root directory in which =.org= files are stored, including trailing slash
- =localpath=: absolute path to this directory, including trailing slash - =localpath=: absolute path to this directory, including trailing slash
- =serverpath=: path to directory on the server where files will be uploaded, including trailing slash
- =domain=: =https://yourdomain.tld= without trailing slash - =domain=: =https://yourdomain.tld= without trailing slash
- =rclonesiteroot=: path =rclone= uses to access your webserver - =rclonesiteroot=: path =rclone= uses to access your webserver
* Tracking games with a backloggery clone
** Setup
*** Fonts
Upload the fonts Lato, Titillium Web, and Material Icons to the directory =/fonts= on your server (I recommend [[https://gwfh.mranftl.com/fonts][google-webfonts-helper]]). Check the filenames are consistent with those in =build/backloggery.css=. Alternatively, you can load the fonts remotely and adjust the page head HTML generated by =skeleton.py=.
*** Setting the variables
In =variables.py=, edit:
- =trackgames=: set to =True=
- =gameserverpath=: path to directory on the server where files will be uploaded, including trailing slash
- =endlessgames=: a list of “endless” games in the format =title (console)=
- =description=: content for the “about” section (can include HTML tags) - =description=: content for the “about” section (can include HTML tags)
- =startyear=: year from which to begin tracking (an integer) - =startyear=: year from which to begin tracking (an integer)
- =hue=: theme colour expressed as a hue from 0 to 360 - =hue=: theme colour expressed as a hue from 0 to 360
- =consoles=: add or remove consoles following the format provided (=.png= images must be added to the build directory with a filename corresponding with the value of ="img"= for each console) - =consoles=: add or remove consoles following the format provided (=.png= images must be added to the build directory with a filename corresponding with the value of ="img"= for each console)
*** The rest * First run
- Run =python3 init.py= and then =chmod +x build.sh=. - Run =python3 init.py= and then =chmod +x build.sh=.
- Create the directory on the server. - Create directories on the server corresponding to any =*serverpath= variables you have set..
** Generating the files * Generating the files
- Run =python3 generate.py local= to build in the local =build= directory. - Run =python3 generate.py local= to build in local directories.
- Run =./build.sh= to build and upload to the server. - Run =./build.sh= to build and upload to the server.

@ -1,5 +1,5 @@
import os import os
import cardstring,gamesort,skeleton,variables import cardstring,gamesort,gameskel,variables
from pathlib import Path from pathlib import Path
from datetime import datetime,timedelta from datetime import datetime,timedelta
@ -11,13 +11,13 @@ home = str(Path.home())
def backlog(local=False): def backlog(local=False):
# delete existing file # delete existing file
if not os.path.isdir("build/backlog"): if not os.path.isdir("gamebuild/backlog"):
os.mkdir("build/backlog") os.mkdir("gamebuild/backlog")
if os.path.exists("build/backlog/index.html"): if os.path.exists("gamebuild/backlog/index.html"):
os.remove("build/backlog/index.html") os.remove("gamebuild/backlog/index.html")
# write header # write header
skeleton.headerwrite("build/backlog/index.html","backlog",local) gameskel.headerwrite("gamebuild/backlog/index.html","backlog",local)
output = "build/backlog/index.html" output = "gamebuild/backlog/index.html"
filewrite = open(output, "a") filewrite = open(output, "a")
filewrite.write(" <section>\n <div>\n <h1>Now Playing</h1>\n <div class=\"now-playing\">\n") filewrite.write(" <section>\n <div>\n <h1>Now Playing</h1>\n <div class=\"now-playing\">\n")
playingnow = [] 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=\"") 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: if local:
filewrite.write(variables.localpath + "build/library/index.html") filewrite.write(variables.localpath + "gamebuild/library/index.html")
else: else:
filewrite.write(variables.serverpath + "library") filewrite.write(variables.gameserverpath + "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") 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) 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=\"") filewrite.write(" </a></svg>\n </div>\n <div class=\"donut\">\n <svg viewBox=\"0 0 42 42\">\n <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/history/index.html") filewrite.write(variables.localpath + "gamebuild/history/index.html")
else: else:
filewrite.write(variables.serverpath + "history") filewrite.write(variables.gameserverpath + "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;\">") 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: if yeargames > 0:
@ -194,126 +194,126 @@ def backlog(local=False):
if gamesort.unplayed(gamesort.games) / maxvalue > 0.5: if gamesort.unplayed(gamesort.games) / maxvalue > 0.5:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-unplayed/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-unplayed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-unplayed") filewrite.write(variables.gameserverpath + "library/all-unplayed")
filewrite.write("\">\n <div>" + str(gamesort.unplayed(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.unplayed(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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") 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: else:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-unplayed/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-unplayed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-unplayed") filewrite.write(variables.gameserverpath + "library/all-unplayed")
filewrite.write("\">\n <div>" + str(gamesort.unplayed(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.unplayed(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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") 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: if gamesort.unfinished(gamesort.games) / maxvalue > 0.5:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-unfinished/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-unfinished/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-unfinished") filewrite.write(variables.gameserverpath + "library/all-unfinished")
filewrite.write("\">\n <div>" + str(gamesort.unfinished(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.unfinished(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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") 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: else:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-unfinished/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-unfinished/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-unfinished") filewrite.write(variables.gameserverpath + "library/all-unfinished")
filewrite.write("\">\n <div>" + str(gamesort.unfinished(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.unfinished(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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") 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: if gamesort.beaten(gamesort.games) / maxvalue > 0.5:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-beaten/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-beaten/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-beaten") filewrite.write(variables.gameserverpath + "library/all-beaten")
filewrite.write("\">\n <div>" + str(gamesort.beaten(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.beaten(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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") 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: else:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-beaten/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-beaten/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-beaten") filewrite.write(variables.gameserverpath + "library/all-beaten")
filewrite.write("\">\n <div>" + str(gamesort.beaten(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.beaten(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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") 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: if gamesort.completed(gamesort.games) / maxvalue > 0.5:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-completed/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-completed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-completed") filewrite.write(variables.gameserverpath + "library/all-completed")
filewrite.write("\">\n <div>" + str(gamesort.completed(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.completed(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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") 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: else:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-completed/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-completed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-completed") filewrite.write(variables.gameserverpath + "library/all-completed")
filewrite.write("\">\n <div>" + str(gamesort.completed(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.completed(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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") 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: if gamesort.endless(gamesort.games) / maxvalue > 0.5:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-endless/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-endless/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-endless") filewrite.write(variables.gameserverpath + "library/all-endless")
filewrite.write("\">\n <div>" + str(gamesort.endless(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.endless(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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)) + "% Endless</div>\n </div>\n </a>\n") 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)) + "% Endless</div>\n </div>\n </a>\n")
else: else:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-endless/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-endless/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-endless") filewrite.write(variables.gameserverpath + "library/all-endless")
filewrite.write("\">\n <div>" + str(gamesort.endless(gamesort.games)) + "</div>\n <div>\n <img src=\"") filewrite.write("\">\n <div>" + str(gamesort.endless(gamesort.games)) + "</div>\n <div>\n <img src=\"")
if local: if local:
filewrite.write(variables.localpath + "build/") filewrite.write(variables.localpath + "gamebuild/")
else: else:
filewrite.write(variables.serverpath) filewrite.write(variables.gameserverpath)
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)) + "% Endless</div>\n </div>\n </a>\n") 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)) + "% Endless</div>\n </div>\n </a>\n")
filewrite.write(" </div>\n </div>\n </div>\n") filewrite.write(" </div>\n </div>\n </div>\n")
@ -337,14 +337,14 @@ def backlog(local=False):
if ctotal > 0: if ctotal > 0:
filewrite.write(" <div class=\"platform-card\">\n <a href=\"") filewrite.write(" <div class=\"platform-card\">\n <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-all/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-all/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-all") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-all")
filewrite.write("\" class=\"title\">" + console["name"] + "</a>\n <a href=\"") filewrite.write("\" class=\"title\">" + console["name"] + "</a>\n <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-all/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-all/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-all") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-all")
filewrite.write("\"class=\"abbr\">" + console["shortname"] + "</a>\n <div class=\"bars\">\n") filewrite.write("\"class=\"abbr\">" + console["shortname"] + "</a>\n <div class=\"bars\">\n")
for game in consolegames: for game in consolegames:
try: try:
@ -367,47 +367,47 @@ def backlog(local=False):
if cunplayed > 0: if cunplayed > 0:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-unplayed/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-unplayed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-unplayed") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-unplayed")
filewrite.write("\" class=\"unplayed\" title=\"Unplayed\" style=\"flex: " + str(cunplayed) + " 1 0%;\">" + str(cunplayed) + "</a>\n") filewrite.write("\" class=\"unplayed\" title=\"Unplayed\" style=\"flex: " + str(cunplayed) + " 1 0%;\">" + str(cunplayed) + "</a>\n")
if cunfinished > 0: if cunfinished > 0:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-unfinished/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-unfinished/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-unfinished") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-unfinished")
filewrite.write("\" class=\"unfinished\" title=\"Unfinished\" style=\"flex: " + str(cunfinished) + " 1 0%;\">" + str(cunfinished) + "</a>\n") filewrite.write("\" class=\"unfinished\" title=\"Unfinished\" style=\"flex: " + str(cunfinished) + " 1 0%;\">" + str(cunfinished) + "</a>\n")
if cbeaten > 0: if cbeaten > 0:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-beaten/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-beaten/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-beaten") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-beaten")
filewrite.write("\"class=\"beaten\" title=\"Beaten\" style=\"flex: " + str(cbeaten) + " 1 0%;\">" + str(cbeaten) + "</a>\n") filewrite.write("\"class=\"beaten\" title=\"Beaten\" style=\"flex: " + str(cbeaten) + " 1 0%;\">" + str(cbeaten) + "</a>\n")
if ccompleted > 0: if ccompleted > 0:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-completed/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-completed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-completed") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-completed")
filewrite.write("\" class=\"completed\" title=\"Completed\" style=\"flex: " + str(ccompleted) + " 1 0%;\">" + str(ccompleted) + "</a>\n") filewrite.write("\" class=\"completed\" title=\"Completed\" style=\"flex: " + str(ccompleted) + " 1 0%;\">" + str(ccompleted) + "</a>\n")
if cendless > 0: if cendless > 0:
filewrite.write(" <a href=\"") filewrite.write(" <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-endless/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-endless/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-endless") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-endless")
filewrite.write("\" class=\"endless\" title=\"Endless\" style=\"flex: " + str(cendless) + " 1 0%;\">" + str(cendless) + "</a>\n") filewrite.write("\" class=\"endless\" title=\"Endless\" style=\"flex: " + str(cendless) + " 1 0%;\">" + str(cendless) + "</a>\n")
filewrite.write(" </div>\n <a href=\"") filewrite.write(" </div>\n <a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-all/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-all/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-all") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-all")
filewrite.write("\" class=\"total\">" + str(ctotal) + "\n <span>Total</span>\n </a>\n </div>\n") filewrite.write("\" class=\"total\">" + str(ctotal) + "\n <span>Total</span>\n </a>\n </div>\n")
filewrite.write(" </div>\n </div>\n </div>\n") filewrite.write(" </div>\n </div>\n </div>\n")
filewrite.close() filewrite.close()
skeleton.footerwrite("build/backlog/index.html") gameskel.footerwrite("gamebuild/backlog/index.html")
if __name__ == "__main__": if __name__ == "__main__":
backlog(True) backlog(True)

@ -15,27 +15,27 @@ def playcard(game,local=False,decay=False):
if game["console"] == console["code"]: if game["console"] == console["code"]:
cardstring += " <img src=\"" cardstring += " <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += console["img"] + ".png\" title=\"" + console["name"] + "\" alt=\"" + console["shortname"] + "\" class=\"bw\">\n" cardstring += console["img"] + ".png\" title=\"" + console["name"] + "\" alt=\"" + console["shortname"] + "\" class=\"bw\">\n"
cardstring += " </div>\n </div>\n <div class=\"status\">\n" cardstring += " </div>\n </div>\n <div class=\"status\">\n"
try: try:
if game["completed"]: if game["completed"]:
cardstring += " <img src=\"" cardstring += " <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "C.png\" alt=\"C\" title=\"Completed\">\n" cardstring += "C.png\" alt=\"C\" title=\"Completed\">\n"
except: except:
try: try:
if game["beaten"]: if game["beaten"]:
cardstring += " <img src=\"" cardstring += " <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "B.png\" alt=\"B\" title=\"Beaten\">\n" cardstring += "B.png\" alt=\"B\" title=\"Beaten\">\n"
except: except:
try: try:
@ -43,23 +43,23 @@ def playcard(game,local=False,decay=False):
if game["id"] in variables.endlessgames: if game["id"] in variables.endlessgames:
cardstring += " <img src=\"" cardstring += " <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "E.png\" alt=\"E\" title=\"Endless\">\n" cardstring += "E.png\" alt=\"E\" title=\"Endless\">\n"
else: else:
cardstring += " <img src=\"" cardstring += " <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "UF.png\" alt=\"UF\" title=\"Unfinished\">\n" cardstring += "UF.png\" alt=\"UF\" title=\"Unfinished\">\n"
except: except:
cardstring += " <img src=\"" cardstring += " <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "UP.png\" alt=\"UP\" title=\"Unplayed\">\n" cardstring += "UP.png\" alt=\"UP\" title=\"Unplayed\">\n"
cardstring += " </div>\n <div class=\"text\">\n <div class=\"title\">" + game["name"] + "</div>\n" cardstring += " </div>\n <div class=\"text\">\n <div class=\"title\">" + game["name"] + "</div>\n"
try: try:
@ -77,9 +77,9 @@ def playcard(game,local=False,decay=False):
else: else:
cardstring += " </div>\n <div class=\"priority\">\n <img src=\"" cardstring += " </div>\n <div class=\"priority\">\n <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "nowplaying.png\" alt=\"\" title=\"Now Playing\">\n </div>\n" cardstring += "nowplaying.png\" alt=\"\" title=\"Now Playing\">\n </div>\n"
else: else:
cardstring += " </div>\n <div class=\"priority\">\n <span title=\"Normal\"/>\n </div>\n" cardstring += " </div>\n <div class=\"priority\">\n <span title=\"Normal\"/>\n </div>\n"
@ -92,9 +92,9 @@ def playcard(game,local=False,decay=False):
else: else:
cardstring += " </div>\n <div class=\"priority\">\n <img src=\"" cardstring += " </div>\n <div class=\"priority\">\n <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "nowplaying.png\" alt=\"\" title=\"Now Playing\">\n </div>\n" cardstring += "nowplaying.png\" alt=\"\" title=\"Now Playing\">\n </div>\n"
else: else:
cardstring += " </div>\n <div class=\"priority\">\n <span title=\"Normal\"/>\n </div>\n" cardstring += " </div>\n <div class=\"priority\">\n <span title=\"Normal\"/>\n </div>\n"
@ -105,16 +105,16 @@ def playcard(game,local=False,decay=False):
else: else:
cardstring += " </div>\n <div class=\"priority\">\n <img src=\"" cardstring += " </div>\n <div class=\"priority\">\n <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "paused.png\" alt=\"\" title=\"Paused\">\n </div>\n" cardstring += "paused.png\" alt=\"\" title=\"Paused\">\n </div>\n"
else: else:
cardstring += " </div>\n <div class=\"priority\">\n <img src=\"" cardstring += " </div>\n <div class=\"priority\">\n <img src=\""
if local: if local:
cardstring += variables.localpath + "build/" cardstring += variables.localpath + "gamebuild/"
else: else:
cardstring += variables.serverpath cardstring += variables.gameserverpath
cardstring += "nowplaying.png\" alt=\"\" title=\"Now Playing\">\n </div>\n" cardstring += "nowplaying.png\" alt=\"\" title=\"Now Playing\">\n </div>\n"
except: except:
cardstring += " </div>\n <div class=\"priority\">\n <span title=\"Normal\"/>\n </div>\n" cardstring += " </div>\n <div class=\"priority\">\n <span title=\"Normal\"/>\n </div>\n"

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 885 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -3,31 +3,31 @@ import variables
from pathlib import Path from pathlib import Path
""" """
Generate the skeleton for an HTML page. Generate the skeleton for a games backlog HTML page.
""" """
home = str(Path.home()) home = str(Path.home())
def headerwrite(output,section,local=False): def headerwrite(output,section,local=False):
header = open(output, "a") header = open(output, "a")
rgb = colorsys.hls_to_rgb((variables.hue)/360,0.3,0.45) rgb = colorsys.hls_to_rgb((variables.gamehue)/360,0.3,0.45)
hexstring = "" hexstring = ""
for element in rgb: for element in rgb:
hexstring += str(hex(int(element * 255)))[2:] hexstring += str(hex(int(element * 255)))[2:]
header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--active-base: hsl(" + str(variables.hue) + ", 45%, 30%); --active-secondary: hsl(" + str(variables.hue) + ", 15%, 30%); --active-accent: hsl(" + str(variables.hue) + ", 90%, 70%);\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <meta name=\"theme-color\" content=\"#" + hexstring + "\">\n <title>Static backlog</title>\n <link rel=\"alternate\" type=\"application/rss+xml\" title=\"Static backlog\" href=\"" + variables.serverpath + "feed.xml\">\n <link href=\"") header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--active-base: hsl(" + str(variables.gamehue) + ", 45%, 30%); --active-secondary: hsl(" + str(variables.gamehue) + ", 15%, 30%); --active-accent: hsl(" + str(variables.gamehue) + ", 90%, 70%);\">\n <head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <meta name=\"theme-color\" content=\"#" + hexstring + "\">\n <title>Static backlog</title>\n <link rel=\"alternate\" type=\"application/rss+xml\" title=\"Static backlog\" href=\"" + variables.gameserverpath + "feed.xml\">\n <link href=\"")
if local: if local:
header.write(variables.localpath + "build/") header.write(variables.localpath + "gamebuild/")
else: else:
header.write(variables.serverpath) header.write(variables.gameserverpath)
header.write("backloggery.css\" rel=\"stylesheet\">\n </head>\n <body>\n <div id=\"app\">\n <div class=\"profile\">\n <aside>\n <div>\n <div id=\"about_note\">\n <h2>About</h2>\n <div class=\"markdown\"><p>" + variables.description + "</p></div>\n </div>\n </div>\n </aside>\n <main>\n <section>\n <div class=\"tabs\">\n") header.write("backloggery.css\" rel=\"stylesheet\">\n </head>\n <body>\n <div id=\"app\">\n <div class=\"profile\">\n <aside>\n <div>\n <div id=\"about_note\">\n <h2>About</h2>\n <div class=\"markdown\"><p>" + variables.gamedescription + "</p></div>\n </div>\n </div>\n </aside>\n <main>\n <section>\n <div class=\"tabs\">\n")
header.write(" <a href=\"") header.write(" <a href=\"")
if section == "backlog": if section == "backlog":
header.write("\" class=\"router-link-exact-active router-link-active\" aria-current=\"page") header.write("\" class=\"router-link-exact-active router-link-active\" aria-current=\"page")
else: else:
if local: if local:
header.write(variables.localpath + "build/backlog/index.html") header.write(variables.localpath + "gamebuild/backlog/index.html")
else: else:
header.write(variables.serverpath + "backlog") header.write(variables.gameserverpath + "backlog")
header.write("\">Backlog</a>\n <a ") header.write("\">Backlog</a>\n <a ")
if section == "library": if section == "library":
header.write("class=\"router-link-exact-active router-link-active\" aria-current=\"page\" href=\"") header.write("class=\"router-link-exact-active router-link-active\" aria-current=\"page\" href=\"")
@ -36,17 +36,17 @@ def headerwrite(output,section,local=False):
header.write("class=\"router-link-active\" aria-current=\"page\" ") header.write("class=\"router-link-active\" aria-current=\"page\" ")
header.write("href=\"") header.write("href=\"")
if local: if local:
header.write(variables.localpath + "build/library/index.html") header.write(variables.localpath + "gamebuild/library/index.html")
else: else:
header.write(variables.serverpath + "library") header.write(variables.gameserverpath + "library")
header.write("\">Library</a>\n <a href=\"") header.write("\">Library</a>\n <a href=\"")
if section == "history": if section == "history":
header.write("\" class=\"router-link-exact-active router-link-active\" aria-current=\"page") header.write("\" class=\"router-link-exact-active router-link-active\" aria-current=\"page")
else: else:
if local: if local:
header.write(variables.localpath + "build/history/index.html") header.write(variables.localpath + "gamebuild/history/index.html")
else: else:
header.write(variables.serverpath + "history") header.write(variables.gameserverpath + "history")
header.write("\">History</a>\n </div>\n") header.write("\">History</a>\n </div>\n")
header.close() header.close()
@ -56,5 +56,5 @@ def footerwrite(output):
footer.close() footer.close()
if __name__ == "__main__": if __name__ == "__main__":
headerwrite("build/backlog/index.html","backlog",True) headerwrite("gamebuild/backlog/index.html","backlog",True)
footerwrite("test.html") footerwrite("test.html")

@ -8,7 +8,7 @@ Load in the list of games from a set of .org files.
thisyear = datetime.now().strftime("%Y") thisyear = datetime.now().strftime("%Y")
year = variables.startyear - 1 year = variables.gamestartyear - 1
concernedfiles = [] concernedfiles = []

@ -1,26 +0,0 @@
import sys
import backlog
import library
import sublibrary
import history
try:
if sys.argv[1] == "local":
local = True
else:
local = False
except:
local = False
if __name__ == "__main__":
if local == True:
backlog.backlog(True)
library.library(True)
sublibrary.sublibrary(True)
history.history(True)
else:
backlog.backlog()
library.library()
sublibrary.sublibrary()
history.history()

@ -0,0 +1,26 @@
import sys,variables
try:
if sys.argv[1] == "local":
local = True
else:
local = False
except:
local = False
if variables.trackgames == True:
import backlog
import library
import sublibrary
import history
if __name__ == "__main__":
if local == True:
backlog.backlog(True)
library.library(True)
sublibrary.sublibrary(True)
history.history(True)
else:
backlog.backlog()
library.library()
sublibrary.sublibrary()
history.history()

@ -1,5 +1,5 @@
import os import os
import gamesort,skeleton,variables import gamesort,gameskel,variables
from datetime import datetime,timedelta from datetime import datetime,timedelta
""" """
@ -8,24 +8,24 @@ Generates history page and RSS feed
def history(local=False): def history(local=False):
# delete existing files # delete existing files
if not os.path.isdir("build/history"): if not os.path.isdir("gamebuild/history"):
os.mkdir("build/history") os.mkdir("gamebuild/history")
if os.path.exists("build/history/index.html"): if os.path.exists("gamebuild/history/index.html"):
os.remove("build/history/index.html") os.remove("gamebuild/history/index.html")
if os.path.exists("build/feed.xml"): if os.path.exists("gamebuild/feed.xml"):
os.remove("build/feed.xml") os.remove("gamebuild/feed.xml")
# write header # write header
skeleton.headerwrite("build/history/index.html","history",local) gameskel.headerwrite("gamebuild/history/index.html","history",local)
output = "build/history/index.html" output = "gamebuild/history/index.html"
filewrite = open(output, "a") filewrite = open(output, "a")
filewrite.write(" <section class=\"history\">\n <div class=\"list\">\n") filewrite.write(" <section class=\"history\">\n <div class=\"list\">\n")
feedwrite = open("build/feed.xml", "a") feedwrite = open("gamebuild/feed.xml", "a")
feedwrite.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n <channel>\n <atom:link href=\"" + variables.domain + variables.serverpath + "feed.xml\" rel=\"self\" type=\"application/rss+xml\" />\n <title>Static backlog</title>\n <link>" + variables.domain + variables.serverpath + "backlog</link>\n <description>Feed for gaming updates</description>\n <language>en-gb</language>") feedwrite.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n <channel>\n <atom:link href=\"" + variables.domain + variables.gameserverpath + "feed.xml\" rel=\"self\" type=\"application/rss+xml\" />\n <title>Static backlog</title>\n <link>" + variables.domain + variables.gameserverpath + "backlog</link>\n <description>Feed for gaming updates</description>\n <language>en-gb</language>")
theyear = int(gamesort.thisyear) theyear = int(gamesort.thisyear)
while theyear >= variables.startyear: while theyear >= variables.gamestartyear:
yearlist = [] yearlist = []
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")
@ -65,7 +65,7 @@ def history(local=False):
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")
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>" + variables.domain + variables.serverpath + "history</link>\n <guid isPermaLink=\"false\">" + event["action"] + "-" + event["name"].replace(" ","-") + "-" + event["console"] + "</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>" + variables.domain + variables.gameserverpath + "history</link>\n <guid isPermaLink=\"false\">" + event["action"] + "-" + event["name"].replace(" ","-") + "-" + event["console"] + "</guid>\n <description>" + event["action"] + " " + event["name"] + " (" + event["console"] + ")</description>\n </item>\n")
checkdate = event["date"] checkdate = event["date"]
theyear -= 1 theyear -= 1
@ -162,7 +162,7 @@ def history(local=False):
filewrite.write(" </div>\n </section>\n") filewrite.write(" </div>\n </section>\n")
filewrite.close() filewrite.close()
skeleton.footerwrite("build/history/index.html") gameskel.footerwrite("gamebuild/history/index.html")
if __name__ == "__main__": if __name__ == "__main__":
history(True) history(True)

@ -2,4 +2,9 @@ import variables
script = open("build.sh", "a") script = open("build.sh", "a")
script.write("#!/usr/bin/env bash\npython3 generate.py\nrclone copy build " + variables.rclonesiteroot + variables.serverpath + " -P") script.write("#!/usr/bin/env bash\n")
if variables.trackgames == True:
script.write("python3 generategames.py\nrclone copy gamebuild " + variables.rclonesiteroot + variables.serverpath + " -P")
script.close()

@ -7,47 +7,47 @@ Generates library page
def library(local=False): def library(local=False):
# delete existing file # delete existing file
if not os.path.isdir("build/library"): if not os.path.isdir("gamebuild/library"):
os.mkdir("build/library") os.mkdir("gamebuild/library")
if os.path.exists("build/library/index.html"): if os.path.exists("gamebuild/library/index.html"):
os.remove("build/library/index.html") os.remove("gamebuild/library/index.html")
# write header # write header
skeleton.headerwrite("build/library/index.html","library",local) skeleton.headerwrite("gamebuild/library/index.html","library",local)
output = "build/library/index.html" output = "gamebuild/library/index.html"
filewrite = open(output, "a") filewrite = open(output, "a")
filewrite.write(" <section id=\"library-top\" class=\"library\">\n <div>\n <div class=\"unibar\">\n <div>\n <span>Total Found</span> " + str(gamesort.total(gamesort.games)) + "\n </div>\n") filewrite.write(" <section id=\"library-top\" class=\"library\">\n <div>\n <div class=\"unibar\">\n <div>\n <span>Total Found</span> " + str(gamesort.total(gamesort.games)) + "\n </div>\n")
if gamesort.unplayed(gamesort.games) > 0: if gamesort.unplayed(gamesort.games) > 0:
filewrite.write(" <div class=\"unplayed\" style=\"flex: " + str(gamesort.unplayed(gamesort.games)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"unplayed\" style=\"flex: " + str(gamesort.unplayed(gamesort.games)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-unplayed/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-unplayed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-unplayed") filewrite.write(variables.serverpath + "library/all-unplayed")
filewrite.write("\">" + str(gamesort.unplayed(gamesort.games)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.unplayed(gamesort.games)) + "</a></div>\n")
if gamesort.unfinished(gamesort.games) > 0: if gamesort.unfinished(gamesort.games) > 0:
filewrite.write(" <div class=\"unfinished\" style=\"flex: " + str(gamesort.unfinished(gamesort.games)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"unfinished\" style=\"flex: " + str(gamesort.unfinished(gamesort.games)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-unfinished/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-unfinished/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-unfinished") filewrite.write(variables.serverpath + "library/all-unfinished")
filewrite.write("\">" + str(gamesort.unfinished(gamesort.games)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.unfinished(gamesort.games)) + "</a></div>\n")
if gamesort.beaten(gamesort.games) > 0: if gamesort.beaten(gamesort.games) > 0:
filewrite.write(" <div class=\"beaten\" style=\"flex: " + str(gamesort.beaten(gamesort.games)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"beaten\" style=\"flex: " + str(gamesort.beaten(gamesort.games)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-beaten/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-beaten/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-beaten") filewrite.write(variables.serverpath + "library/all-beaten")
filewrite.write("\">" + str(gamesort.beaten(gamesort.games)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.beaten(gamesort.games)) + "</a></div>\n")
if gamesort.completed(gamesort.games) > 0: if gamesort.completed(gamesort.games) > 0:
filewrite.write(" <div class=\"completed\" style=\"flex: " + str(gamesort.completed(gamesort.games)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"completed\" style=\"flex: " + str(gamesort.completed(gamesort.games)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-completed/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-completed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-completed") filewrite.write(variables.serverpath + "library/all-completed")
filewrite.write("\">" + str(gamesort.completed(gamesort.games)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.completed(gamesort.games)) + "</a></div>\n")
if gamesort.endless(gamesort.games) > 0: if gamesort.endless(gamesort.games) > 0:
filewrite.write(" <div class=\"endless\" style=\"flex: " + str(gamesort.endless(gamesort.games)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"endless\" style=\"flex: " + str(gamesort.endless(gamesort.games)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/all-endless/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-endless/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-endless") filewrite.write(variables.serverpath + "library/all-endless")
filewrite.write("\">" + str(gamesort.endless(gamesort.games)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.endless(gamesort.games)) + "</a></div>\n")
@ -59,7 +59,7 @@ def library(local=False):
filewrite.write(cardstring.playcard(game,local)) filewrite.write(cardstring.playcard(game,local))
filewrite.close() filewrite.close()
skeleton.footerwrite("build/library/index.html") skeleton.footerwrite("gamebuild/library/index.html")
if __name__ == "__main__": if __name__ == "__main__":
library(True) library(True)

@ -1,5 +1,5 @@
import os import os
import cardstring,gamesort,skeleton,variables import cardstring,gamesort,gameskel,variables
from pathlib import Path from pathlib import Path
""" """
@ -89,78 +89,78 @@ def sublibrary(local=False):
pass pass
except: except:
filterlist.append(game) filterlist.append(game)
if not os.path.isdir("build/library/" + console["shortname"].lower() + "-" + status): if not os.path.isdir("gamebuild/library/" + console["shortname"].lower() + "-" + status):
if len(filterlist) > 0: if len(filterlist) > 0:
os.mkdir("build/library/" + console["shortname"].lower() + "-" + status) os.mkdir("gamebuild/library/" + console["shortname"].lower() + "-" + status)
if os.path.exists("build/library/" + console["shortname"].lower() + "-" + status + "/index.html"): if os.path.exists("gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html"):
os.remove("build/library/" + console["shortname"].lower() + "-" + status + "/index.html") os.remove("gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html")
# write header # write header
if len(filterlist) > 0: if len(filterlist) > 0:
skeleton.headerwrite(("build/library/" + console["shortname"].lower() + "-" + status + "/index.html"),"sublibrary",local) gameskel.headerwrite(("gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html"),"sublibrary",local)
output = "build/library/" + console["shortname"].lower() + "-" + status + "/index.html" output = "gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html"
filewrite = open(output, "a") filewrite = open(output, "a")
filewrite.write(" <section id=\"library-top\" class=\"library\">\n <div>\n <div class=\"filters\">\n <div>Filtered by\n") filewrite.write(" <section id=\"library-top\" class=\"library\">\n <div>\n <div class=\"filters\">\n <div>Filtered by\n")
if console["shortname"] != "all": if console["shortname"] != "all":
filewrite.write(" <span class=\"item\"><a href=\"") filewrite.write(" <span class=\"item\"><a href=\"")
if status == "all": if status == "all":
if local: if local:
filewrite.write(variables.localpath + "build/library/index.html") filewrite.write(variables.localpath + "gamebuild/library/index.html")
else: else:
filewrite.write(variables.serverpath + "library") filewrite.write(variables.gameserverpath + "library")
else: else:
if local: if local:
filewrite.write(variables.localpath + "build/library/all-" + status + "/index.html") filewrite.write(variables.localpath + "gamebuild/library/all-" + status + "/index.html")
else: else:
filewrite.write(variables.serverpath + "library/all-" + status) filewrite.write(variables.gameserverpath + "library/all-" + status)
filewrite.write("\">1 Platform<span class=\"filter_clear\">x</span></a></span>\n") filewrite.write("\">1 Platform<span class=\"filter_clear\">x</span></a></span>\n")
if status != "all": if status != "all":
filewrite.write(" <span class=\"item\"><a href=\"") filewrite.write(" <span class=\"item\"><a href=\"")
if console["shortname"] == "all": if console["shortname"] == "all":
if local: if local:
filewrite.write(variables.localpath + "build/library/index.html") filewrite.write(variables.localpath + "gamebuild/library/index.html")
else: else:
filewrite.write(variables.serverpath + "library") filewrite.write(variables.gameserverpath + "library")
else: else:
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-all/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-all/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-all") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-all")
filewrite.write("\">1 Status<span class=\"filter_clear\">x</span></a></span>\n") filewrite.write("\">1 Status<span class=\"filter_clear\">x</span></a></span>\n")
filewrite.write(" </div>\n</div> <div class=\"unibar\">\n <div>\n <span>Total Found</span> " + str(gamesort.total(filterlist)) + "\n </div>\n") filewrite.write(" </div>\n</div> <div class=\"unibar\">\n <div>\n <span>Total Found</span> " + str(gamesort.total(filterlist)) + "\n </div>\n")
if gamesort.unplayed(filterlist) > 0: if gamesort.unplayed(filterlist) > 0:
filewrite.write(" <div class=\"unplayed\" style=\"flex: " + str(gamesort.unplayed(filterlist)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"unplayed\" style=\"flex: " + str(gamesort.unplayed(filterlist)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-unplayed/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-unplayed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-unplayed") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-unplayed")
filewrite.write("\">" + str(gamesort.unplayed(filterlist)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.unplayed(filterlist)) + "</a></div>\n")
if gamesort.unfinished(filterlist) > 0: if gamesort.unfinished(filterlist) > 0:
filewrite.write(" <div class=\"unfinished\" style=\"flex: " + str(gamesort.unfinished(filterlist)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"unfinished\" style=\"flex: " + str(gamesort.unfinished(filterlist)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-unfinished/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-unfinished/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-unfinished") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-unfinished")
filewrite.write("\">" + str(gamesort.unfinished(filterlist)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.unfinished(filterlist)) + "</a></div>\n")
if gamesort.beaten(filterlist) > 0: if gamesort.beaten(filterlist) > 0:
filewrite.write(" <div class=\"beaten\" style=\"flex: " + str(gamesort.beaten(filterlist)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"beaten\" style=\"flex: " + str(gamesort.beaten(filterlist)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-beaten/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-beaten/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-beaten") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-beaten")
filewrite.write("\">" + str(gamesort.beaten(filterlist)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.beaten(filterlist)) + "</a></div>\n")
if gamesort.completed(filterlist) > 0: if gamesort.completed(filterlist) > 0:
filewrite.write(" <div class=\"completed\" style=\"flex: " + str(gamesort.completed(filterlist)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"completed\" style=\"flex: " + str(gamesort.completed(filterlist)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-completed/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-completed/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-completed") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-completed")
filewrite.write("\">" + str(gamesort.completed(filterlist)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.completed(filterlist)) + "</a></div>\n")
if gamesort.endless(filterlist) > 0: if gamesort.endless(filterlist) > 0:
filewrite.write(" <div class=\"endless\" style=\"flex: " + str(gamesort.endless(filterlist)) + " 1 0%;\"><a href=\"") filewrite.write(" <div class=\"endless\" style=\"flex: " + str(gamesort.endless(filterlist)) + " 1 0%;\"><a href=\"")
if local: if local:
filewrite.write(variables.localpath + "build/library/" + console["shortname"].lower() + "-endless/index.html") filewrite.write(variables.localpath + "gamebuild/library/" + console["shortname"].lower() + "-endless/index.html")
else: else:
filewrite.write(variables.serverpath + "library/" + console["shortname"].lower() + "-endless") filewrite.write(variables.gameserverpath + "library/" + console["shortname"].lower() + "-endless")
filewrite.write("\">" + str(gamesort.endless(filterlist)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.endless(filterlist)) + "</a></div>\n")
filewrite.write(" </div>\n <div class=\"library-list sorted\">\n") filewrite.write(" </div>\n <div class=\"library-list sorted\">\n")
@ -170,7 +170,7 @@ def sublibrary(local=False):
filewrite.write(cardstring.playcard(game,local)) filewrite.write(cardstring.playcard(game,local))
filewrite.close() filewrite.close()
skeleton.footerwrite("build/library/" + console["shortname"].lower() + "-" + status + "/index.html") gameskel.footerwrite("gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html")
if __name__ == "__main__": if __name__ == "__main__":
sublibrary(True) sublibrary(True)

@ -2,23 +2,29 @@
User-defined variables live here. User-defined variables live here.
""" """
endlessgames = []
orgpath = "" orgpath = ""
localpath = "" localpath = ""
serverpath = ""
domain = "" domain = ""
rclonesiteroot = "" rclonesiteroot = ""
description = "" """
Games
"""
trackgames = False
startyear = gameserverpath = ""
endlessgames = []
hue = gamedescription = ""
gamestartyear = 0
gamehue = 0
consoles = [{"code":"ps5","name":"PlayStation 5","shortname":"PS5","img":"PS5"}, consoles = [{"code":"ps5","name":"PlayStation 5","shortname":"PS5","img":"PS5"},
{"code":"ps2","name":"PlayStation 2","shortname":"PS2","img":"PS2"}, {"code":"ps2","name":"PlayStation 2","shortname":"PS2","img":"PS2"},
@ -28,3 +34,11 @@ consoles = [{"code":"ps5","name":"PlayStation 5","shortname":"PS5","img":"PS5"},
{"code":"nintendo 3ds","name":"Nintendo 3DS","shortname":"3DS","img":"3DS"}, {"code":"nintendo 3ds","name":"Nintendo 3DS","shortname":"3DS","img":"3DS"},
{"code":"nintendo switch","name":"Nintendo Switch","shortname":"Switch","img":"Switch"}, {"code":"nintendo switch","name":"Nintendo Switch","shortname":"Switch","img":"Switch"},
{"code":"pc","name":"PC","shortname":"PC","img":"PC"}] {"code":"pc","name":"PC","shortname":"PC","img":"PC"}]
"""
Places
"""
trackplaces = False
placeserverpath = ""

Loading…
Cancel
Save