made script consistent with readme

This commit is contained in:
2024-10-12 09:57:56 -07:00
parent 0ec0045301
commit bf18c0a9cc
2 changed files with 16 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
import sqlite3 as sql
import subprocess
import subprocess, traceback
# get all maps in database
def getmaps(database):
@@ -32,11 +32,11 @@ def renderindex(template):
def main():
template = ""
with open("templates/overview.html", 'r') as fin:
with open("overview.html", 'r') as fin:
template = fin.read()
renderindex(template)
maps = getmaps("db/cts.db")
with open("templates/map.html", 'r') as fin:
with open("map.html", 'r') as fin:
template = fin.read()
# for each map generate an html file.
for game_map in maps:
@@ -53,9 +53,15 @@ def main():
table=table)
)
# fout.write(template % (title, map_name, table))
pass
return True
if __name__ == "__main__":
print("allmaps.py - Generating .html files for all maps.")
main()
success = False
try:
main()
except FileNotFoundError:
traceback.print_exc()
print("\n\t The script probably didn't find the page templates needed to generate a page. You can copy minimal working examples from the repository at templates/.")
if success:
print("allmaps.py - Generated pages for all maps.")
pass