Prepare for adding other trackers
This commit is contained in:
parent
6a8a0c40e6
commit
29ab288b65
29 changed files with 224 additions and 201 deletions
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
import cardstring,gamesort,skeleton,variables
|
||||
import cardstring,gamesort,gameskel,variables
|
||||
from pathlib import Path
|
||||
|
||||
"""
|
||||
|
@ -89,78 +89,78 @@ def sublibrary(local=False):
|
|||
pass
|
||||
except:
|
||||
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:
|
||||
os.mkdir("build/library/" + console["shortname"].lower() + "-" + status)
|
||||
if os.path.exists("build/library/" + console["shortname"].lower() + "-" + status + "/index.html"):
|
||||
os.remove("build/library/" + console["shortname"].lower() + "-" + status + "/index.html")
|
||||
os.mkdir("gamebuild/library/" + console["shortname"].lower() + "-" + status)
|
||||
if os.path.exists("gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html"):
|
||||
os.remove("gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html")
|
||||
# write header
|
||||
if len(filterlist) > 0:
|
||||
skeleton.headerwrite(("build/library/" + console["shortname"].lower() + "-" + status + "/index.html"),"sublibrary",local)
|
||||
output = "build/library/" + console["shortname"].lower() + "-" + status + "/index.html"
|
||||
gameskel.headerwrite(("gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html"),"sublibrary",local)
|
||||
output = "gamebuild/library/" + console["shortname"].lower() + "-" + status + "/index.html"
|
||||
filewrite = open(output, "a")
|
||||
filewrite.write(" <section id=\"library-top\" class=\"library\">\n <div>\n <div class=\"filters\">\n <div>Filtered by\n")
|
||||
if console["shortname"] != "all":
|
||||
filewrite.write(" <span class=\"item\"><a href=\"")
|
||||
if status == "all":
|
||||
if local:
|
||||
filewrite.write(variables.localpath + "build/library/index.html")
|
||||
filewrite.write(variables.localpath + "gamebuild/library/index.html")
|
||||
else:
|
||||
filewrite.write(variables.serverpath + "library")
|
||||
filewrite.write(variables.gameserverpath + "library")
|
||||
else:
|
||||
if local:
|
||||
filewrite.write(variables.localpath + "build/library/all-" + status + "/index.html")
|
||||
filewrite.write(variables.localpath + "gamebuild/library/all-" + status + "/index.html")
|
||||
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")
|
||||
if status != "all":
|
||||
filewrite.write(" <span class=\"item\"><a href=\"")
|
||||
if console["shortname"] == "all":
|
||||
if local:
|
||||
filewrite.write(variables.localpath + "build/library/index.html")
|
||||
filewrite.write(variables.localpath + "gamebuild/library/index.html")
|
||||
else:
|
||||
filewrite.write(variables.serverpath + "library")
|
||||
filewrite.write(variables.gameserverpath + "library")
|
||||
else:
|
||||
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:
|
||||
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(" </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:
|
||||
filewrite.write(" <div class=\"unplayed\" style=\"flex: " + str(gamesort.unplayed(filterlist)) + " 1 0%;\"><a href=\"")
|
||||
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:
|
||||
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")
|
||||
if gamesort.unfinished(filterlist) > 0:
|
||||
filewrite.write(" <div class=\"unfinished\" style=\"flex: " + str(gamesort.unfinished(filterlist)) + " 1 0%;\"><a href=\"")
|
||||
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:
|
||||
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")
|
||||
if gamesort.beaten(filterlist) > 0:
|
||||
filewrite.write(" <div class=\"beaten\" style=\"flex: " + str(gamesort.beaten(filterlist)) + " 1 0%;\"><a href=\"")
|
||||
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:
|
||||
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")
|
||||
if gamesort.completed(filterlist) > 0:
|
||||
filewrite.write(" <div class=\"completed\" style=\"flex: " + str(gamesort.completed(filterlist)) + " 1 0%;\"><a href=\"")
|
||||
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:
|
||||
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")
|
||||
if gamesort.endless(filterlist) > 0:
|
||||
filewrite.write(" <div class=\"endless\" style=\"flex: " + str(gamesort.endless(filterlist)) + " 1 0%;\"><a href=\"")
|
||||
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:
|
||||
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(" </div>\n <div class=\"library-list sorted\">\n")
|
||||
|
||||
|
@ -170,7 +170,7 @@ def sublibrary(local=False):
|
|||
filewrite.write(cardstring.playcard(game,local))
|
||||
|
||||
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__":
|
||||
sublibrary(True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue