Allow mass collecting by series

This commit is contained in:
mez 2025-07-27 12:07:57 +01:00
parent 26159685ce
commit 93de038712
3 changed files with 55 additions and 19 deletions

View file

@ -42,7 +42,7 @@ Python scripts to generate a mobile-friendly static site for tracking tcg cards
- =firstmasteries=: a list of decks you mastered first
- =misclink=: under ="link"=, a link to any page you choose, and under ~"text"~, text to display as the link
- =donations= : lists of donated decks and individual scrapbook cards
- =masscollect=: list (python dict) of series/themes being mass collected, each containing at least one of ="decks"= specifying a list of decks, or ="singles"= specifying a list of individual cards
- =masscollect=: list (python dict) of series/themes being mass collected, each containing at least one of ="series"= specifying a list of series from the online decklist, ="decks"= specifying a list of decks, or ="singles"= specifying a list of individual cards
- =anniversary= : list of current anniversary decks
- Run the following:
#+BEGIN_SRC bash

View file

@ -27,6 +27,7 @@ with open("key.html") as decks:
decksoup = BeautifulSoup(decks, "html.parser")
soupdecks = decksoup.find("table",{"id":"colors"})
souprows = soupdecks.find_all("tr")
souprows = souprows[1:]
for row in souprows:
soupcells = row.find_all("td")
deckname = soupcells[2].text.lower().replace(" ","").replace("'","").replace("ç","c").replace(".","").replace("politetness","politeness")
@ -98,22 +99,6 @@ for event in log.log:
thecard["priority"] = 1
else:
thecard["priority"] = 0
if card[0:4] != "sig_":
for theme in variables.masscollect:
try:
if thedeck in variables.masscollect[theme]["decks"]:
thecard["mass"].append(theme)
if thecard["priority"] == 0:
thecard["priority"] = 3
except KeyError:
pass
try:
if card in variables.masscollect[theme]["singles"]:
thecard["mass"].append(theme)
if thecard["priority"] == 0:
thecard["priority"] = 2
except KeyError:
pass
if card[0:4] == "sig_":
thecard["colour"] = "sig"
else:
@ -127,7 +112,39 @@ for event in log.log:
pass
except:
print("Warning: no colour found for " + thedeck)
thecard["series"] = deckkey[thedeck]["series"]
try:
thecard["series"] = deckkey[thedeck]["series"]
except:
if thedeck in variables.anniversary:
thecard["series"] = "Colors Universe"
try:
if thecard["series"]:
pass
except:
print("Warning: no series found for " + thedeck)
if card[0:4] != "sig_":
for theme in variables.masscollect:
try:
if thecard["series"].lower() in (series.lower() for series in variables.masscollect[theme]["series"]):
thecard["mass"].append(theme)
if thecard["priority"] == 0:
thecard["priority"] = 3
except KeyError:
pass
try:
if thedeck in variables.masscollect[theme]["decks"]:
thecard["mass"].append(theme)
if thecard["priority"] == 0:
thecard["priority"] = 3
except KeyError:
pass
try:
if card in variables.masscollect[theme]["singles"]:
thecard["mass"].append(theme)
if thecard["priority"] == 0:
thecard["priority"] = 2
except KeyError:
pass
if thecard["colour"] == "sig":
if card[4:] == variables.name.lower():
thecard["priority"] = 5
@ -445,6 +462,11 @@ for deck in decks:
thedeck["mass"] = []
thedeck["massmaster"] = []
for theme in variables.masscollect:
try:
if thedeck["series"].lower() in (series.lower() for series in variables.masscollect[theme]["series"]):
thedeck["mass"].append(theme)
except KeyError:
pass
try:
if deck in variables.masscollect[theme]["decks"]:
thedeck["mass"].append(theme)
@ -563,6 +585,20 @@ for deck in variables.lowpriority:
wantedlist.append(wantedcard)
for theme in variables.masscollect:
try:
for series in variables.masscollect[theme]["series"]:
for deck in deckkey:
if deck not in decknames:
if deckkey[deck]["series"].lower() == series.lower():
for number in numbers:
wantedcard = {}
wantedcard["name"] = deck + number
wantedcard["colour"] = deckkey[deck]["type"]
wantedcard["series"] = deckkey[deck]["series"]
wantedcard["priority"] = 3
wantedlist.append(wantedcard)
except KeyError:
pass
try:
for deck in variables.masscollect[theme]["decks"]:
if deck not in decknames:

View file

@ -23,5 +23,5 @@ maxmastered = 20
firstmasteries = ["deckname","nameofdeck"]
misclink = {"link":"","text":""}
donations = {"decks":[],"scrapbook":[]}
masscollect = {"series":{"decks":["firstdeck","seconddeck"],"singles":["card01","card02"]}}
masscollect = {"series":{"series":["a series","another series"],"decks":["firstdeck","seconddeck"],"singles":["card01","card02"]}}
anniversary = ["deckname"]