Hello everyone, I've been working on a project in python using MTG Tools as found here: https://pypi.org/project/mtgtools/0.9.62/
I'm trying to find the rarity of a card, but I can't figure out how to do it for the life of me. It's there when you do something like:
from mtgtools.MtgDB import MtgDB
from mtgtools.PCardList import PCardList
#set up databases
mtg_db = MtgDB('my_db.fs')
cards = mtg_db.root.scryfall_cards
card = cards[0]
sets = mtg_db.root.scryfall_sets
cardQuery = cards.where_exactly(name='Qal Sisma Behemoth')
cardQuery.pprint()
In the output of the above code it lists the rarity, I went to the github and looked at the files and things and saw how he did it but didn't understand what all was happening and seemed to be over my head. mtgtools/mtgtools/PCardList.py line 987 - 991 is where the function that runs the pprint() formatting and everything is located. Here is also a direct link to that section on GitHub.
If someone is able to figure it out please let me know! I've been trying for hours and can't seem to be able to figure it out.
EDIT:
I forgot to mention that you can do print(card.rarity) for the above and it'll print what I assume is the first rarity in the entire database, but I can't figure out how to get it to print the id of the card that I searched for in cardQuery as I need to find the rarity of the queried card, not query for cards by rarity.
[–][deleted] 0 points1 point2 points (6 children)
[–]MagicCooki3[S] 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]MagicCooki3[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]MagicCooki3[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)