Add page for masteries, get deck types from a file, some refactoring
parent
448b2187c6
commit
113461ce19
@ -0,0 +1,43 @@
|
||||
import datetime,os
|
||||
import log,variables,skel,tcgcore
|
||||
|
||||
def masteredgen(colour=False):
|
||||
if not os.path.isdir("build/mastered"):
|
||||
os.mkdir("build/mastered")
|
||||
if colour:
|
||||
if not os.path.isdir("build/mastered/" + colour):
|
||||
os.mkdir("build/mastered/" + colour)
|
||||
thefile = "build/mastered/" + colour + "/index.html"
|
||||
else:
|
||||
thefile = "build/mastered/index.html"
|
||||
if os.path.exists(thefile):
|
||||
os.remove(thefile)
|
||||
skel.headerwrite(thefile,"mastered")
|
||||
content = open(thefile,"a")
|
||||
content.write("<h1>mastered decks</h1>\n")
|
||||
decksofinterest = []
|
||||
for card in tcgcore.ownedcards():
|
||||
if card[0:4] != "sig_":
|
||||
if colour:
|
||||
if tcgcore.cardtype(card) == colour:
|
||||
decksofinterest.append(card[:-2])
|
||||
else:
|
||||
decksofinterest.append(card[:-2])
|
||||
decksofinterest = sorted(list(dict.fromkeys(decksofinterest)))
|
||||
mastereddecks = []
|
||||
for deck in decksofinterest:
|
||||
if tcgcore.deckmastered(deck):
|
||||
mastereddecks.append(deck)
|
||||
content.write(tcgcore.filterwrite("mastered",colour))
|
||||
for deck in mastereddecks:
|
||||
content.write(tcgcore.printdeck(deck))
|
||||
content.close()
|
||||
skel.footerwrite(thefile)
|
||||
|
||||
def masteredall():
|
||||
masteredgen()
|
||||
for type in tcgcore.typelist:
|
||||
masteredgen(type)
|
||||
|
||||
if __name__ == "__main__":
|
||||
masteredall()
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue