You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
2 months ago
|
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()
|