Corrections

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

@ -24,9 +24,10 @@ In =variables.py=, edit:
- =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)
** Testing
- Run =python3 generategames.py local= to build in =gamebuild=.
* First run * First run
- Run =python3 init.py= and then =chmod +x build.sh=. - Run =python3 init.py= and then =chmod +x build.sh=.
- Create directories on the server corresponding to any =*serverpath= variables you have set.. - Create directories on the server corresponding to any =*serverpath= variables you have set..
* Generating the files * Building
- 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,10 +1,10 @@
import variables import variables
script = open("build.sh", "a") script = open("build.sh", "w")
script.write("#!/usr/bin/env bash\n") script.write("#!/usr/bin/env bash\n")
if variables.trackgames == True: if variables.trackgames == True:
script.write("python3 generategames.py\nrclone copy gamebuild " + variables.rclonesiteroot + variables.serverpath + " -P") script.write("python3 generategames.py\nrclone copy gamebuild " + variables.rclonesiteroot + variables.gameserverpath + " -P")
script.close() script.close()

@ -1,5 +1,5 @@
import os import os
import cardstring,gamesort,skeleton,variables import cardstring,gamesort,gameskel,variables
""" """
Generates library page Generates library page
@ -12,7 +12,7 @@ def library(local=False):
if os.path.exists("gamebuild/library/index.html"): if os.path.exists("gamebuild/library/index.html"):
os.remove("gamebuild/library/index.html") os.remove("gamebuild/library/index.html")
# write header # write header
skeleton.headerwrite("gamebuild/library/index.html","library",local) gameskel.headerwrite("gamebuild/library/index.html","library",local)
output = "gamebuild/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")
@ -21,35 +21,35 @@ def library(local=False):
if local: if local:
filewrite.write(variables.localpath + "gamebuild/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("\">" + 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 + "gamebuild/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("\">" + 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 + "gamebuild/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("\">" + 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 + "gamebuild/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("\">" + 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 + "gamebuild/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("\">" + str(gamesort.endless(gamesort.games)) + "</a></div>\n") filewrite.write("\">" + str(gamesort.endless(gamesort.games)) + "</a></div>\n")
filewrite.write(" </div>\n <div class=\"library-list sorted\">\n") filewrite.write(" </div>\n <div class=\"library-list sorted\">\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("gamebuild/library/index.html") gameskel.footerwrite("gamebuild/library/index.html")
if __name__ == "__main__": if __name__ == "__main__":
library(True) library(True)

Loading…
Cancel
Save