diff --git a/.gitignore b/.gitignore index a44f07e..79522fa 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ build/index.html build/decks/*/*.gif build/decks/*/type build/assets/banner.png +build/assets/fonts/* +!build/assets/fonts/04b24.ttf build/assets/header.png build/assets/levels/*.gif build/assets/sketch/*.gif diff --git a/README.org b/README.org index 890cf43..c952b7b 100644 --- a/README.org +++ b/README.org @@ -4,9 +4,12 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards ** Instructions *** Requirements - =python3= (needs the following libraries: =bs4, collections, datetime, itertools, os, random, re, requests=) -- server space -- subdomain pointing to your site root on the server -- =rclone= with your server set up as a remote +- either: + - server space + - subdomain pointing to your site root on the server + - =rclone= with your server set up as a remote +- or: + - a neocities account with the [[https://neocities.org/cli][neocities CLI]] installed *** Setup - Download and create the initial files by running: #+BEGIN_SRC bash @@ -17,9 +20,10 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards cp trade-template.py trade.py #+END_SRC - Edit =variables.py= to set the variables as follows: - - =servername=: name set for your remote in =rclone= - - =serverpath=: path to the site root on the server (with leading slash, without trailing slash) - - =subfolder=: subfolder under your (sub)domain in which the TCG pages will be located (leave as an empty string if they are at the top level) + - =neocities=: set to =True= if you will be using the neocities CLI + - =servername=: name set for your remote in =rclone= (if not using the neocities CLI) + - =serverpath=: path to the site root on the server (if not using the neocities CLI; with leading slash, without trailing slash) + - =subfolder=: subfolder under your (sub)domain in which the TCG pages will be located (leave as an empty string if they are at the top level; if using the neocities CLI this will not work and the pages will be uploaded to the site root) - =url=: URL of your site index page including =https://= - =name=: the name you use in the game - =hovertext=: text to display when hovering over the header image diff --git a/build/font.css b/build/font.css new file mode 100644 index 0000000..49c5495 --- /dev/null +++ b/build/font.css @@ -0,0 +1,7 @@ +@font-face { + src: url("/assets/fonts/04b24.ttf"); + font-display: swap; + font-family: "04b24"; + font-style: normal; + font-weight: 400; +} diff --git a/build/style.css b/build/style.css index 78ba97e..00d0186 100644 --- a/build/style.css +++ b/build/style.css @@ -1,11 +1,3 @@ -@font-face { - src: url("/assets/fonts/04b24.ttf"); - font-display: swap; - font-family: "04b24"; - font-style: normal; - font-weight: 400; -} - /* basic colours */ :root { diff --git a/colors.py b/colors.py index 797f766..7f95b9f 100644 --- a/colors.py +++ b/colors.py @@ -6,22 +6,24 @@ import log,variables values = ["red","orange","yellow","green","blue","purple","brown","gray","special","limited"] numbers = ["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20"] -print("Getting list of deck colours") - deckkey = {} -request = requests.get("https://colors-tcg.eu/cards.php?view=alpha") -alldecks = open("key.html","w") -alldecks.write(request.text) -alldecks.close() +try: + request = requests.get("https://colors-tcg.eu/cards.php?view=alpha") + print("Getting list of deck colours") + alldecks = open("key.html","w") + alldecks.write(request.text) + alldecks.close() -# need to correct some html issues + # need to correct some html issues -with open("key.html","r") as file: - filedata = file.read() -filedata = filedata.replace("","") -with open("key.html","w") as file: - file.write(filedata) + with open("key.html","r") as file: + filedata = file.read() + filedata = filedata.replace("","") + with open("key.html","w") as file: + file.write(filedata) +except: + print("Using cached version of decklist") with open("key.html") as decks: decksoup = BeautifulSoup(decks, "html.parser") @@ -665,6 +667,9 @@ if variables.keepsig == True: def headerwrite(thefile,pagename): header = open(thefile,"a") header.write("\n\n
\n \n \n 0: + header.write("/" + variables.subfolder) + header.write("/font.css\">\n 0: header.write("/" + variables.subfolder) header.write("/style.css\">\n 0: + header.write("/" + variables.subfolder) +fontloc.write("/assets/fonts/04b24.ttf\");\n font-display: swap;\n font-family: \"04b24\";\n font-style: normal;\n font-weight: 400;\n}\n") +fontloc.close() + if not os.path.exists("build/user.css"): open("build/user.css","x") diff --git a/variables-template.py b/variables-template.py index 0ed904e..b32da46 100644 --- a/variables-template.py +++ b/variables-template.py @@ -1,3 +1,4 @@ +neocities = False servername = "" serverpath = "" subfolder = ""