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 - =tradepost=: URL of your trade post on Dreamwidth
- =faves=: a list of cards to showcase on the index page - =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 - =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 - =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 - =tradestatement=: statement to place on your trading page
- =maxmastered=: maximum number of most recently mastered decks to show on the index page - =maxmastered=: maximum number of most recently mastered decks to show on the index page
- Run the following: - 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 level images manually to =build/assets/levels/=
- Add custom CSS to =build/user.css= - Add custom CSS to =build/user.css=
*** Updating and building *** 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. - Run =./build.sh= in this directory to download the relevant card images and then upload everything to the server.
** Currently unaccounted for ** Currently unaccounted for
- Portfolios - Duplicates (should be fine but not checked)
- Duplicates - Coupons
- Masteries - Card search
- Date to level needs redone

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

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

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

@ -7,5 +7,6 @@ log = [
"received":["card01","card02"], "received":["card01","card02"],
"lost":["card03","card04"], "lost":["card03","card04"],
"crayons":{"red":1,"orange":2,"yellow":-3} "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") content.write("<h1>log</h1>\n")
thelog = log.log[::-1] thelog = log.log[::-1]
for event in thelog: for event in thelog:
content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code> <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>: ") if event["event"] != "portfolio":
try: content.write("<p><code>" + event["date"].strftime("%Y-%m-%d") + "</code> <a href=\"" + event["url"] + "\">[" + event["event"] + "]</a>: ")
if event["received"]: try:
content.write("Received ") if event["received"]:
receivedlist = sorted(event["received"]) content.write("Received ")
position = 1 receivedlist = sorted(event["received"])
for card in receivedlist: position = 1
content.write(tcgcore.cardtext(card)) for card in receivedlist:
if len(receivedlist) != position: content.write(tcgcore.cardtext(card))
content.write(", ") if len(receivedlist) != position:
position += 1 content.write(", ")
content.write(".") position += 1
try: content.write(".")
if event["lost"]: try:
content.write(" ") if event["lost"]:
except: 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: try:
if event["crayons"]: if event["crayons"]:
content.write(" ") content.write(" ")
except: except:
pass pass
except: except:
pass pass
try: try:
if event["lost"]: if event["crayons"]:
content.write("Lost ") content.write("Crayons: ")
lostlist = sorted(event["lost"]) try:
position = 1 content.write(crayonlog("red",event))
for card in lostlist: if list(event["crayons"])[-1] != "red":
content.write(tcgcore.cardtext(card)) content.write(", ")
if len(lostlist) != position: except:
content.write(", ") pass
position += 1 try:
content.write(".") content.write(crayonlog("orange",event))
try: if list(event["crayons"])[-1] != "orange":
if event["crayons"]: content.write(", ")
content.write(" ") except:
except: pass
pass try:
except: content.write(crayonlog("yellow",event))
pass if list(event["crayons"])[-1] != "yellow":
try: content.write(", ")
if event["crayons"]: except:
content.write("Crayons: ") pass
try: try:
content.write(crayonlog("red",event)) content.write(crayonlog("green",event))
if list(event["crayons"])[-1] != "red": if list(event["crayons"])[-1] != "green":
content.write(", ") content.write(", ")
except: except:
pass pass
try: try:
content.write(crayonlog("orange",event)) content.write(crayonlog("blue",event))
if list(event["crayons"])[-1] != "orange": if list(event["crayons"])[-1] != "blue":
content.write(", ") content.write(", ")
except: except:
pass pass
try: try:
content.write(crayonlog("yellow",event)) content.write(crayonlog("purple",event))
if list(event["crayons"])[-1] != "yellow": if list(event["crayons"])[-1] != "purple":
content.write(", ") content.write(", ")
except: except:
pass pass
try: try:
content.write(crayonlog("green",event)) content.write(crayonlog("brown",event))
if list(event["crayons"])[-1] != "green": if list(event["crayons"])[-1] != "brown":
content.write(", ") content.write(", ")
except: except:
pass pass
try: try:
content.write(crayonlog("blue",event)) content.write(crayonlog("gray",event))
if list(event["crayons"])[-1] != "blue": except:
content.write(", ") pass
except: content.write(".")
pass except:
try: pass
content.write(crayonlog("purple",event)) content.write("</p>\n")
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() content.close()
skel.footerwrite(thefile) skel.footerwrite(thefile)

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

@ -2,7 +2,7 @@ import variables
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=\"/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": if pagename == "index":
header.write("home") header.write("home")
else: else:

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

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

Loading…
Cancel
Save