Move portfolios to log

master
trémeur 2 weeks ago
parent e286f18542
commit 6a21a3541a

@ -24,9 +24,9 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
- =tradepost=: URL of your trade post on Dreamwidth
- =faves=: a list of cards to showcase on the index page
- =headerbackground=: an HTML colour to display behind your header image and set as a theme colour
- =british=: True if you want “grey” to display on the site, False if you want “gray”
- =british=: =True= if you want “grey” to display on the site, =False= if you want “gray”
- =collectthreshold=: minimum number of owned cards for putting a deck in the “collecting” category
- =keepsig=: True if you always want to keep one copy of your signature, False if you want to make them all available for trading
- =keepsig=: =True= if you always want to keep one copy of your signature, =False= if you want to make them all available for trading
- =tradestatement=: statement to place on your trading page
- =maxmastered=: maximum number of most recently mastered decks to show on the index page
- Run the following:
@ -39,9 +39,10 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
- Add level images manually to =build/assets/levels/=
- Add custom CSS to =build/user.css=
*** Updating and building
- For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"= that arent relevant).
- For each transaction, add a dictionary ={}= to the =log= list like in the example (removing any of ="received"=, ="lost"=, ="crayons"=, ="decks"= that arent relevant).
- Run =./build.sh= in this directory to download the relevant card images and then upload everything to the server.
** Currently unaccounted for
- Portfolios
- Duplicates
- Masteries
- Duplicates (should be fine but not checked)
- Coupons
- Card search
- Date to level needs redone

@ -167,6 +167,8 @@ p#masteredcarousel img {
/* portfolios */
a:has(div.foliocase) {
text-decoration: none;
width: 230px;
display: block;
}
div.foliocase {
@ -196,6 +198,11 @@ table.portfolio tr:last-of-type {
text-align: right;
}
table.portfolio a {
color: unset;
text-decoration: none;
}
table.portfolio.palette {
background: url("/assets/portfolio/palette.png");
background-repeat: no-repeat;

@ -34,8 +34,7 @@ def collectinggen(colour=False):
elif deck in variables.medpriority:
medpriority.append(deck)
else:
if tcgcore.collecting(deck):
lowpriority.append(deck)
lowpriority.append(deck)
content.write(tcgcore.filterwrite("collecting",colour))
if len(highpriority) > 0:
content.write("<div>\n<h2 class=\"collectingheader\">High priority</h2>\n")

@ -226,7 +226,7 @@ def indexgen():
if sketch > 19:
content.write("<td align=\"center\">" + str(int(sketch / 20)) + " completed</td>\n")
content.write("</tr>\n</tbody>\n</table>")
if len(variables.portfolios) > 0:
if len(tcgcore.getpalettes()) + len(tcgcore.getmonochrome()) > 0:
content.write("<a href=\"/portfolios\">\n<div class=\"foliocase\">\n")
if len(tcgcore.getpalettes()) > 0:
content.write(tcgcore.portfoliogen(tcgcore.getpalettes()[-1],"palette",len(tcgcore.getpalettes())))

@ -7,5 +7,6 @@ log = [
"received":["card01","card02"],
"lost":["card03","card04"],
"crayons":{"red":1,"orange":2,"yellow":-3}
"decks":["deck1","deck2","deck3","deck4","deck5","deck6","deck7","deck8"] # only if "event":"portfolio"
}
]

@ -27,100 +27,101 @@ def loggen():
content.write("<h1>log</h1>\n")
thelog = log.log[::-1]
for event in thelog:
content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code> <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>: ")
try:
if event["received"]:
content.write("Received ")
receivedlist = sorted(event["received"])
position = 1
for card in receivedlist:
content.write(tcgcore.cardtext(card))
if len(receivedlist) != position:
content.write(", ")
position += 1
content.write(".")
try:
if event["lost"]:
content.write(" ")
except:
if event["event"] != "portfolio":
content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code> <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>: ")
try:
if event["received"]:
content.write("Received ")
receivedlist = sorted(event["received"])
position = 1
for card in receivedlist:
content.write(tcgcore.cardtext(card))
if len(receivedlist) != position:
content.write(", ")
position += 1
content.write(".")
try:
if event["lost"]:
content.write(" ")
except:
try:
if event["crayons"]:
content.write(" ")
except:
pass
except:
pass
try:
if event["lost"]:
content.write("Lost ")
lostlist = sorted(event["lost"])
position = 1
for card in lostlist:
content.write(tcgcore.cardtext(card))
if len(lostlist) != position:
content.write(", ")
position += 1
content.write(".")
try:
if event["crayons"]:
content.write(" ")
except:
pass
except:
pass
try:
if event["lost"]:
content.write("Lost ")
lostlist = sorted(event["lost"])
position = 1
for card in lostlist:
content.write(tcgcore.cardtext(card))
if len(lostlist) != position:
content.write(", ")
position += 1
content.write(".")
try:
if event["crayons"]:
content.write(" ")
except:
pass
except:
pass
try:
if event["crayons"]:
content.write("Crayons: ")
try:
content.write(crayonlog("red",event))
if list(event["crayons"])[-1] != "red":
content.write(", ")
except:
pass
try:
content.write(crayonlog("orange",event))
if list(event["crayons"])[-1] != "orange":
content.write(", ")
except:
pass
try:
content.write(crayonlog("yellow",event))
if list(event["crayons"])[-1] != "yellow":
content.write(", ")
except:
pass
try:
content.write(crayonlog("green",event))
if list(event["crayons"])[-1] != "green":
content.write(", ")
except:
pass
try:
content.write(crayonlog("blue",event))
if list(event["crayons"])[-1] != "blue":
content.write(", ")
except:
pass
try:
content.write(crayonlog("purple",event))
if list(event["crayons"])[-1] != "purple":
content.write(", ")
except:
pass
try:
content.write(crayonlog("brown",event))
if list(event["crayons"])[-1] != "brown":
content.write(", ")
except:
pass
try:
content.write(crayonlog("gray",event))
except:
pass
content.write(".")
except:
pass
content.write("</p>\n")
except:
pass
try:
if event["crayons"]:
content.write("Crayons: ")
try:
content.write(crayonlog("red",event))
if list(event["crayons"])[-1] != "red":
content.write(", ")
except:
pass
try:
content.write(crayonlog("orange",event))
if list(event["crayons"])[-1] != "orange":
content.write(", ")
except:
pass
try:
content.write(crayonlog("yellow",event))
if list(event["crayons"])[-1] != "yellow":
content.write(", ")
except:
pass
try:
content.write(crayonlog("green",event))
if list(event["crayons"])[-1] != "green":
content.write(", ")
except:
pass
try:
content.write(crayonlog("blue",event))
if list(event["crayons"])[-1] != "blue":
content.write(", ")
except:
pass
try:
content.write(crayonlog("purple",event))
if list(event["crayons"])[-1] != "purple":
content.write(", ")
except:
pass
try:
content.write(crayonlog("brown",event))
if list(event["crayons"])[-1] != "brown":
content.write(", ")
except:
pass
try:
content.write(crayonlog("gray",event))
except:
pass
content.write(".")
except:
pass
content.write("</p>\n")
content.close()
skel.footerwrite(thefile)

@ -15,7 +15,7 @@ def portfoliosgen(colour=False):
skel.headerwrite(thefile,"portfolios")
content = open(thefile,"a")
content.write("<h1>portfolios</h1>\n")
if len(variables.portfolios) > 0:
if len(tcgcore.getpalettes()) + len(tcgcore.getmonochrome()) > 0:
if len(tcgcore.getpalettes()) > 0:
content.write("<div class=\"foliocase\">\n")
portnumber = 1

@ -2,7 +2,7 @@ import variables
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=\"/style.css\">\n <link rel=\"stylesheet\" href=\"/user.css\">\n <meta name=\"theme-color\" content=\"" + variables.headerbackground + "\">\n <title>" + variables.name + "s card collection :: " + pagename + "</title>\n </head>\n <body>\n <aside>\n \n </aside>\n <nav>\n <ul>\n <li>")
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=\"/style.css\">\n <link rel=\"stylesheet\" href=\"/user.css\">\n <meta name=\"theme-color\" content=\"" + variables.headerbackground + "\">\n <title>" + variables.name + "s card collection :: " + pagename + "</title>\n </head>\n <body class=\"" + pagename + "\">\n <aside>\n \n </aside>\n <nav>\n <ul>\n <li>")
if pagename == "index":
header.write("home")
else:

@ -191,28 +191,22 @@ def filterwrite(page,colour=False,sigs=False):
def getpalettes():
palette = []
if len(variables.portfolios) > 0:
for portfolio in variables.portfolios:
if portfolio["type"] == "palette":
thepalette = {}
for deck in portfolio["decks"]:
thepalette[cardtype(deck + "01")] = deck
palette.append(thepalette)
for event in log.log:
if event["event"] == "portfolio":
if cardtype(event["decks"][0] + "01") != cardtype(event["decks"][1] + "01"):
for deck in event["decks"]:
event[cardtype(deck + "01")] = deck
palette.append(event)
return palette
def getmonochrome():
monochrome = []
if len(variables.portfolios) > 0:
for portfolio in variables.portfolios:
if portfolio["type"] == "monochrome":
themonochrome = {}
colourdecks = []
for deck in portfolio["decks"]:
colourdecks.append(deck)
colourdecks = sorted(colourdecks)
themonochrome["colour"] = cardtype(colourdecks[0] + "01")
themonochrome["decks"] = colourdecks
monochrome.append(themonochrome)
for event in log.log:
if event["event"] == "portfolio":
if cardtype(event["decks"][0] + "01") == cardtype(event["decks"][1] + "01"):
event["colour"] = cardtype(event["decks"][0] + "01")
event["decks"] = sorted(event["decks"])
monochrome.append(event)
return monochrome
def portfoliogen(portfolio,thetype,portnumber):
@ -321,12 +315,12 @@ def portfoliogen(portfolio,thetype,portnumber):
else:
portstring += ""
portstring += " " + portfolio["special"]
portstring += "</td>\n</tr>\n<tr>\n<td colspan=\"2\">palette portfolio "
portstring += "</td>\n</tr>\n<tr>\n<td colspan=\"2\"><a href=\"" + portfolio["url"] + "\">palette portfolio "
if portnumber < 10:
portstring += "0" + str(portnumber)
else:
portstring += str(portnumber)
portstring += "</td>\n</tr>\n</tbody>\n</table>\n"
portstring += "</a></td>\n</tr>\n</tbody>\n</table>\n"
elif thetype == "monochrome":
portstring = "<table class=\"" + portfolio["colour"] + " portfolio\">\n<tbody>\n<tr>\n<td colspan=\"2\">" + variables.name.lower() + "</td>\n</tr>\n<tr>\n<td class=\"deck1\">"
if deckmastered(portfolio["decks"][0]):
@ -368,10 +362,10 @@ def portfoliogen(portfolio,thetype,portnumber):
portstring += ""
else:
portstring += ""
portstring += " " + portfolio["decks"][7] + "</td>\n</tr>\n<tr>\n<td colspan=\"2\">monochrome portfolio "
portstring += " " + portfolio["decks"][7] + "</td>\n</tr>\n<tr>\n<td colspan=\"2\"><a href=\"" + portfolio["url"] + "\">monochrome portfolio "
if portnumber < 10:
portstring += "0" + str(portnumber)
else:
portstring += str(portnumber)
portstring += "</td>\n</tr>\n</tbody>\n</table>\n"
portstring += "</a></td>\n</tr>\n</tbody>\n</table>\n"
return portstring

@ -11,4 +11,3 @@ collectthreshold = 2
keepsig = False
tradestatement = ""
maxmastered = 20
portfolios = [{"type":"palette","decks":["one","two","three","four","five","six","seven","eight"]}]

Loading…
Cancel
Save