Page 1 of 1

Gatherer Indexer

PostPosted: 12 Feb 2009, 14:04
by Snacko
This doesn't really belong here but it doesn't fit into other forum sections either.

The attached scripts spider The Gatherer and build an SQLite database with all the cards and their revisions available from the gatherer.
It's a work in progress so the code quality is very low as it's mostly a slap together of my old crude scripts.
Might be useful for someone so I'm attaching it here
http://www.mediafire.com/download.php?ykmez5xy0j3.

Sample usage:
php main.php SetSymbol
ex. php main.php DD2
this will get all the cards in all languages from the Jace vs Chandra set

php postprocess.php SetSymbol
ex. php postprocess.php DD2
will set the color / picture number for the cards in the given Set

The set names / symbols have to be set in "sets.txt".
They have to correspond to the ones used by The Gatherer.

Database structure
Code: Select all
CREATE TABLE carddata (
    "id" PK INTEGER,
    "set" TEXT,
    "color" TEXT,
    "pt" TEXT,
    "rarity" TEXT,
    "cost" TEXT,
    "pic" INTEGER,
    "artist" TEXT,
    "collectorNumber" INTEGER
)

CREATE TABLE cards (
    "id" PK INTEGER,
    "internalId" INTEGER,
    "title" TEXT,
    "type" TEXT,
    "flavor" TEXT,
    "legal" TEXT,
    "language" TEXT
)
The carddata.id corresponds to cards.internalId. Also cards.id is the id used by the Gatherer and is unique for every card in every language.