Compare commits
3 commits
557f006884
...
dea672a13a
Author | SHA1 | Date | |
---|---|---|---|
dea672a13a | |||
ee0879ef79 | |||
e179b011f2 |
7 changed files with 49 additions and 27 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,6 +4,8 @@ build/index.html
|
||||||
build/decks/*/*.gif
|
build/decks/*/*.gif
|
||||||
build/decks/*/type
|
build/decks/*/type
|
||||||
build/assets/banner.png
|
build/assets/banner.png
|
||||||
|
build/assets/fonts/*
|
||||||
|
!build/assets/fonts/04b24.ttf
|
||||||
build/assets/header.png
|
build/assets/header.png
|
||||||
build/assets/levels/*.gif
|
build/assets/levels/*.gif
|
||||||
build/assets/sketch/*.gif
|
build/assets/sketch/*.gif
|
||||||
|
|
16
README.org
16
README.org
|
@ -4,9 +4,12 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
|
||||||
** Instructions
|
** Instructions
|
||||||
*** Requirements
|
*** Requirements
|
||||||
- =python3= (needs the following libraries: =bs4, collections, datetime, itertools, os, random, re, requests=)
|
- =python3= (needs the following libraries: =bs4, collections, datetime, itertools, os, random, re, requests=)
|
||||||
- server space
|
- either:
|
||||||
- subdomain pointing to your site root on the server
|
- server space
|
||||||
- =rclone= with your server set up as a remote
|
- 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
|
*** Setup
|
||||||
- Download and create the initial files by running:
|
- Download and create the initial files by running:
|
||||||
#+BEGIN_SRC bash
|
#+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
|
cp trade-template.py trade.py
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
- Edit =variables.py= to set the variables as follows:
|
- Edit =variables.py= to set the variables as follows:
|
||||||
- =servername=: name set for your remote in =rclone=
|
- =neocities=: set to =True= if you will be using the neocities CLI
|
||||||
- =serverpath=: path to the site root on the server (with leading slash, without trailing slash)
|
- =servername=: name set for your remote in =rclone= (if not using the neocities CLI)
|
||||||
- =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)
|
- =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://=
|
- =url=: URL of your site index page including =https://=
|
||||||
- =name=: the name you use in the game
|
- =name=: the name you use in the game
|
||||||
- =hovertext=: text to display when hovering over the header image
|
- =hovertext=: text to display when hovering over the header image
|
||||||
|
|
7
build/font.css
Normal file
7
build/font.css
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
@font-face {
|
||||||
|
src: url("/assets/fonts/04b24.ttf");
|
||||||
|
font-display: swap;
|
||||||
|
font-family: "04b24";
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
|
@ -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 */
|
/* basic colours */
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
|
|
29
colors.py
29
colors.py
|
@ -6,22 +6,24 @@ import log,variables
|
||||||
values = ["red","orange","yellow","green","blue","purple","brown","gray","special","limited"]
|
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"]
|
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 = {}
|
deckkey = {}
|
||||||
|
|
||||||
request = requests.get("https://colors-tcg.eu/cards.php?view=alpha")
|
try:
|
||||||
alldecks = open("key.html","w")
|
request = requests.get("https://colors-tcg.eu/cards.php?view=alpha")
|
||||||
alldecks.write(request.text)
|
print("Getting list of deck colours")
|
||||||
alldecks.close()
|
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:
|
with open("key.html","r") as file:
|
||||||
filedata = file.read()
|
filedata = file.read()
|
||||||
filedata = filedata.replace("</td></td>","</td>")
|
filedata = filedata.replace("</td></td>","</td>")
|
||||||
with open("key.html","w") as file:
|
with open("key.html","w") as file:
|
||||||
file.write(filedata)
|
file.write(filedata)
|
||||||
|
except:
|
||||||
|
print("Using cached version of decklist")
|
||||||
|
|
||||||
with open("key.html") as decks:
|
with open("key.html") as decks:
|
||||||
decksoup = BeautifulSoup(decks, "html.parser")
|
decksoup = BeautifulSoup(decks, "html.parser")
|
||||||
|
@ -665,6 +667,9 @@ if variables.keepsig == True:
|
||||||
def headerwrite(thefile,pagename):
|
def headerwrite(thefile,pagename):
|
||||||
header = open(thefile,"a")
|
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=\"")
|
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:
|
if len(variables.subfolder) > 0:
|
||||||
header.write("/" + variables.subfolder)
|
header.write("/" + variables.subfolder)
|
||||||
header.write("/style.css\">\n <link rel=\"stylesheet\" href=\"")
|
header.write("/style.css\">\n <link rel=\"stylesheet\" href=\"")
|
||||||
|
|
13
setup.py
13
setup.py
|
@ -2,8 +2,19 @@ import os
|
||||||
import variables
|
import variables
|
||||||
|
|
||||||
buildscript = open("build.sh","w")
|
buildscript = open("build.sh","w")
|
||||||
buildscript.write("#!/usr/bin/env bash && python3 colors.py\n\nrclone copy build " + variables.servername + ":" + variables.serverpath + " -P -L")
|
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.close()
|
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"):
|
if not os.path.exists("build/user.css"):
|
||||||
open("build/user.css","x")
|
open("build/user.css","x")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
neocities = False
|
||||||
servername = ""
|
servername = ""
|
||||||
serverpath = ""
|
serverpath = ""
|
||||||
subfolder = ""
|
subfolder = ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue