Compare commits

..

No commits in common. "dea672a13ab09b58f578ad0af83fc1eb6fa69066" and "557f0068847b05680b4f0f09a59ccfc03f65e460" have entirely different histories.

7 changed files with 27 additions and 49 deletions

2
.gitignore vendored
View file

@ -4,8 +4,6 @@ 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

View file

@ -4,12 +4,9 @@ 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=)
- 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
- server space
- subdomain pointing to your site root on the server
- =rclone= with your server set up as a remote
*** Setup
- Download and create the initial files by running:
#+BEGIN_SRC bash
@ -20,10 +17,9 @@ 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:
- =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)
- =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)
- =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

View file

@ -1,7 +0,0 @@
@font-face {
src: url("/assets/fonts/04b24.ttf");
font-display: swap;
font-family: "04b24";
font-style: normal;
font-weight: 400;
}

View file

@ -1,3 +1,11 @@
@font-face {
src: url("/assets/fonts/04b24.ttf");
font-display: swap;
font-family: "04b24";
font-style: normal;
font-weight: 400;
}
/* basic colours */
:root {

View file

@ -6,24 +6,22 @@ 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 = {}
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()
request = requests.get("https://colors-tcg.eu/cards.php?view=alpha")
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("</td></td>","</td>")
with open("key.html","w") as file:
file.write(filedata)
except:
print("Using cached version of decklist")
with open("key.html","r") as file:
filedata = file.read()
filedata = filedata.replace("</td></td>","</td>")
with open("key.html","w") as file:
file.write(filedata)
with open("key.html") as decks:
decksoup = BeautifulSoup(decks, "html.parser")
@ -667,9 +665,6 @@ if variables.keepsig == True:
def headerwrite(thefile,pagename):
header = open(thefile,"a")
header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--headbg:" + variables.headerbackground + ";\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"")
if len(variables.subfolder) > 0:
header.write("/" + variables.subfolder)
header.write("/font.css\">\n <link rel=\"stylesheet\" href=\"")
if len(variables.subfolder) > 0:
header.write("/" + variables.subfolder)
header.write("/style.css\">\n <link rel=\"stylesheet\" href=\"")

View file

@ -2,19 +2,8 @@ import os
import variables
buildscript = open("build.sh","w")
buildscript.write("#!/usr/bin/env bash && python3 colors.py\n\n")
if variables.neocities:
buildscript.write("neocities push")
else:
buildscript.write("rclone copy build " + variables.servername + ":" + variables.serverpath + " -P -L")
buildscript.write("#!/usr/bin/env bash && python3 colors.py\n\nrclone copy build " + variables.servername + ":" + variables.serverpath + " -P -L")
buildscript.close()
fontloc = open("build/font.css","w")
fontloc.write("@font-face {\n src: url(\"")
if len(variables.subfolder) > 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")

View file

@ -1,4 +1,3 @@
neocities = False
servername = ""
serverpath = ""
subfolder = ""