Add recent cards function

This commit is contained in:
mez 2025-08-09 20:20:40 +01:00
parent da586e7ca2
commit 481a23da05

View file

@ -1831,13 +1831,26 @@ def lsa():
theround = input("\nRound number: ")
lsaurl = input("Comment URL: ")
print("\n{\"event\":\"little spell academia " + theround + "\",\"date\":datetime.datetime(" + datetime.datetime.now().strftime("%Y,%-m,%-d") + "),\"url\":\"" + lsaurl + "\",\"received\":[\"" + "\",\"".join(holder) + "\"]}")
def recentpri():
recentcards = []
for card in colors.cardlist:
if datetime.datetime.strftime(card["received"],"%Y%m%d") == datetime.datetime.strftime(datetime.datetime.today(),"%Y%m%d") or card["received"] == datetime.datetime.strftime(datetime.datetime.today() - datetime.timedelta(days=1),"%Y%m%d"):
if card["priority"] < 4:
if card["colour"] != "sig":
recentcards.append(card["name"])
recentcards = sorted(recentcards)
if len(recentcards) > 0:
print(", ".join(recentcards))
else:
print("None received")
if __name__ == "__main__":
while True:
index = 0 # adapted from https://stackoverflow.com/a/64536882
indexValidList = []
print("Choose from the list:")
options = ["Generate next palette portfolio","Generate next monochrome portfolio","Generate Switch It Up request","Generate Swap Station request","Generate Go Fish comment","Generate Release Roulette comment","Generate Riku’s Favors comment","Generate Natsume’s Book of Cards comment","Generate Little Spell Academia comment","Generate art shop request","Generate art studio request","Check a trade offer","Propose a trade","Get a list of random cards from tradepile (excluding specials)","Get a list of random cards from tradepile (including specials)","Check a card in the collection","Check details of a deck","See decks mastered today","See most wanted character cards","See most wanted special cards","See some statistics about the collection"]
options = ["Generate next palette portfolio","Generate next monochrome portfolio","Generate Switch It Up request","Generate Swap Station request","Generate Go Fish comment","Generate Release Roulette comment","Generate Riku’s Favors comment","Generate Natsume’s Book of Cards comment","Generate Little Spell Academia comment","Generate art shop request","Generate art studio request","Check a trade offer","Propose a trade","Get a list of random cards from tradepile (excluding specials)","Get a list of random cards from tradepile (including specials)","Check a card in the collection","Check details of a deck","See decks mastered today","See most wanted character cards","See most wanted special cards","Show wanted cards gained yesterday + today","See some statistics about the collection"]
for optionName in options:
index = index + 1
indexValidList.extend([options.index(optionName)])
@ -1895,5 +1908,7 @@ if __name__ == "__main__":
natsume()
elif chosen == "Generate Little Spell Academia comment":
lsa()
elif chosen == "Show wanted cards gained yesterday + today":
recentpri()
print("\n")
input("Press Enter to continue or Ctrl-C to exit")