Allow mass collecting by series
This commit is contained in:
parent
26159685ce
commit
93de038712
3 changed files with 55 additions and 19 deletions
|
@ -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
|
- =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
|
- =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
|
- =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
|
- =anniversary= : list of current anniversary decks
|
||||||
- Run the following:
|
- Run the following:
|
||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
|
|
64
colors.py
64
colors.py
|
@ -27,6 +27,7 @@ with open("key.html") as decks:
|
||||||
decksoup = BeautifulSoup(decks, "html.parser")
|
decksoup = BeautifulSoup(decks, "html.parser")
|
||||||
soupdecks = decksoup.find("table",{"id":"colors"})
|
soupdecks = decksoup.find("table",{"id":"colors"})
|
||||||
souprows = soupdecks.find_all("tr")
|
souprows = soupdecks.find_all("tr")
|
||||||
|
souprows = souprows[1:]
|
||||||
for row in souprows:
|
for row in souprows:
|
||||||
soupcells = row.find_all("td")
|
soupcells = row.find_all("td")
|
||||||
deckname = soupcells[2].text.lower().replace(" ","").replace("'","").replace("ç","c").replace(".","").replace("politetness","politeness")
|
deckname = soupcells[2].text.lower().replace(" ","").replace("'","").replace("ç","c").replace(".","").replace("politetness","politeness")
|
||||||
|
@ -98,8 +99,38 @@ for event in log.log:
|
||||||
thecard["priority"] = 1
|
thecard["priority"] = 1
|
||||||
else:
|
else:
|
||||||
thecard["priority"] = 0
|
thecard["priority"] = 0
|
||||||
|
if card[0:4] == "sig_":
|
||||||
|
thecard["colour"] = "sig"
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
thecard["colour"] = deckkey[thedeck]["type"]
|
||||||
|
except:
|
||||||
|
if thedeck in variables.anniversary:
|
||||||
|
thecard["colour"] = "limited"
|
||||||
|
try:
|
||||||
|
if thecard["colour"]:
|
||||||
|
pass
|
||||||
|
except:
|
||||||
|
print("Warning: no colour found for " + thedeck)
|
||||||
|
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_":
|
if card[0:4] != "sig_":
|
||||||
for theme in variables.masscollect:
|
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:
|
try:
|
||||||
if thedeck in variables.masscollect[theme]["decks"]:
|
if thedeck in variables.masscollect[theme]["decks"]:
|
||||||
thecard["mass"].append(theme)
|
thecard["mass"].append(theme)
|
||||||
|
@ -114,20 +145,6 @@ for event in log.log:
|
||||||
thecard["priority"] = 2
|
thecard["priority"] = 2
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
if card[0:4] == "sig_":
|
|
||||||
thecard["colour"] = "sig"
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
thecard["colour"] = deckkey[thedeck]["type"]
|
|
||||||
except:
|
|
||||||
if thedeck in variables.anniversary:
|
|
||||||
thecard["colour"] = "limited"
|
|
||||||
try:
|
|
||||||
if thecard["colour"]:
|
|
||||||
pass
|
|
||||||
except:
|
|
||||||
print("Warning: no colour found for " + thedeck)
|
|
||||||
thecard["series"] = deckkey[thedeck]["series"]
|
|
||||||
if thecard["colour"] == "sig":
|
if thecard["colour"] == "sig":
|
||||||
if card[4:] == variables.name.lower():
|
if card[4:] == variables.name.lower():
|
||||||
thecard["priority"] = 5
|
thecard["priority"] = 5
|
||||||
|
@ -445,6 +462,11 @@ for deck in decks:
|
||||||
thedeck["mass"] = []
|
thedeck["mass"] = []
|
||||||
thedeck["massmaster"] = []
|
thedeck["massmaster"] = []
|
||||||
for theme in variables.masscollect:
|
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:
|
try:
|
||||||
if deck in variables.masscollect[theme]["decks"]:
|
if deck in variables.masscollect[theme]["decks"]:
|
||||||
thedeck["mass"].append(theme)
|
thedeck["mass"].append(theme)
|
||||||
|
@ -563,6 +585,20 @@ for deck in variables.lowpriority:
|
||||||
wantedlist.append(wantedcard)
|
wantedlist.append(wantedcard)
|
||||||
|
|
||||||
for theme in variables.masscollect:
|
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:
|
try:
|
||||||
for deck in variables.masscollect[theme]["decks"]:
|
for deck in variables.masscollect[theme]["decks"]:
|
||||||
if deck not in decknames:
|
if deck not in decknames:
|
||||||
|
|
|
@ -23,5 +23,5 @@ maxmastered = 20
|
||||||
firstmasteries = ["deckname","nameofdeck"]
|
firstmasteries = ["deckname","nameofdeck"]
|
||||||
misclink = {"link":"","text":""}
|
misclink = {"link":"","text":""}
|
||||||
donations = {"decks":[],"scrapbook":[]}
|
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"]
|
anniversary = ["deckname"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue