import os import cardstring,gamesort,gameskel,variables """ Generates library page """ def library(local=False): # delete existing file if not os.path.isdir("gamebuild/library"): os.mkdir("gamebuild/library") if os.path.exists("gamebuild/library/index.html"): os.remove("gamebuild/library/index.html") # write header gameskel.headerwrite("gamebuild/library/index.html","library",local) output = "gamebuild/library/index.html" filewrite = open(output, "a") filewrite.write("
\n
\n
\n
\n Total Found " + str(gamesort.total(gamesort.games)) + "\n
\n") if gamesort.unplayed(gamesort.games) > 0: filewrite.write(" \n") if gamesort.unfinished(gamesort.games) > 0: filewrite.write(" \n") if gamesort.beaten(gamesort.games) > 0: filewrite.write(" \n") if gamesort.completed(gamesort.games) > 0: filewrite.write(" \n") if gamesort.endless(gamesort.games) > 0: filewrite.write(" \n") filewrite.write("
\n
\n") newgames = sorted(gamesort.games,key=lambda d: d["id"]) for game in newgames: filewrite.write(cardstring.playcard(game,local)) filewrite.close() gameskel.footerwrite("gamebuild/library/index.html") if __name__ == "__main__": library(True)