Skip to content

Query Magic the Gathering card data (stored in XML) using Python expressions

Notifications You must be signed in to change notification settings

zephyrfalcon/magicquery

Repository files navigation

Query Magic the Gathering card data (stored in XML) using Python expressions.

Quick setup:

- Download XML from http://projects.flowsnake.org/mtgxml.html and unpack it
  somewhere.
- Edit config.txt and point the 'xmldir' to the directory where you just
  unpacked the XML.
- Run: python magicquery.py
- Optional: short set names can be used as arguments:
  python magicquery.py ZEN WWK ROE
  (only load cards from the Zendikar block)

N.B. Shortnames can be found at: 
http://github.com/zephyrfalcon/magicripper2/blob/master/sets.py

Quick example queries:

# find all red cards
> red

# find all artifact creatures
> type('artifact') and type('creature')

# find all blue creatures with power > 10
> blue and power > 10

(but much, MUCH more is possible... see magiccards.py.)

~

Will write docs and such later. Code is very "dirty" right now, must be
cleaned up first. For now, study magiccard.py to see what is possible.

It's gonna take a while, but eventually this should be more powerful than
Gatherer or MagicCards.info. It should also be the first MtG search engine
that can find, say, all cards with flying, all instants that grant trample,
all creatures that produce green mana, or all creatures with protection from
red... just to name a few things. (No, you cannot reliably do this by
searching the rules text.)

Related projects:

MagicRipper2: http://github.com/zephyrfalcon/magicripper2
MTGXML: http://projects.flowsnake.org/mtgxml.html

About

Query Magic the Gathering card data (stored in XML) using Python expressions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages