diff --git a/README.org b/README.org index 2519d7f..46726fd 100644 --- a/README.org +++ b/README.org @@ -20,7 +20,6 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards - =serverpath=: path to the site root on the server (with leading slash, without trailing slash) - =name=: the name you use in the game - =highpriority=: a list of high priority decks you’re collecting - - =mediumpriority=: a list of other decks you’re collecting - =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 @@ -31,6 +30,7 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards - =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 + - =masscollect=: list (python dict) of series/themes being mass collected and which decks to include in each one - Run the following: #+BEGIN_SRC bash python3 setup.py diff --git a/generate.py b/generate.py index c5e2b94..4d57a41 100644 --- a/generate.py +++ b/generate.py @@ -1,5 +1,5 @@ import sys -import download,indexgen,collectinggen,ownedgen,wantedgen,loggen,levelsgen,tradegen,masteredgen,portfoliosgen,searchgen +import download,indexgen,collectinggen,ownedgen,wantedgen,loggen,levelsgen,tradegen,masteredgen,portfoliosgen,searchgen,massgen print("Checking for new decks … ",end="") sys.stdout.flush() @@ -9,6 +9,9 @@ sys.stdout.flush() indexgen.indexgen() print(" done\nBuilding collecting page …",end="") sys.stdout.flush() +massgen.massall() +print(" done\nBuilding mass decks pages …",end="") +sys.stdout.flush() collectinggen.collectingall() print(" done\nBuilding owned page …",end="") sys.stdout.flush() diff --git a/massgen.py b/massgen.py new file mode 100644 index 0000000..f12c8e0 --- /dev/null +++ b/massgen.py @@ -0,0 +1,59 @@ +import datetime,os +import log,skel,tcgcore,variables + +massdecks = dict(sorted(variables.masscollect.items())) +massowned = {} +for series in massdecks: + ownedlist = [] + for card in tcgcore.ownedcards(): + if card[:-2] in massdecks[series]: + ownedlist.append(card) + if len(ownedlist) > 0: + massowned[series] = ownedlist + +def massindexgen(): + if not os.path.isdir("build/mass"): + os.mkdir("build/mass") + thefile = "build/mass/index.html" + if os.path.exists(thefile): + os.remove(thefile) + skel.headerwrite(thefile,"mass") + content = open(thefile,"a") + content.write("
") + for card in massowned[series]: + content.write(tcgcore.printcard(card)) + content.write("
\n") + content.close() + skel.footerwrite(thefile) + +def massall(): + massindexgen() + massindex = 1 + for series in massowned: + massseriesgen(series,massindex) + massindex += 1 + +if __name__ == "__main__": + massall() diff --git a/skel.py b/skel.py index 506fac4..bfbd054 100644 --- a/skel.py +++ b/skel.py @@ -13,6 +13,11 @@ def headerwrite(thefile,pagename): else: header.write("collecting") header.write("\nI’m probably also interested in anything I’m mass collecting.
\n") content.close() skel.footerwrite(thefile)