Closed taw closed 6 years ago
A reasonable JSON format might look something like this:
Deck Name.json
{
"Card Name 1": "SET",
"Card Name 2": {
"set": "SET",
"number": 123,
"count": 10
},
⋮
}
With the collector number for cards that appear multiple times in the set (e.g. basic lands), and count for cards that appear multiple times in the deck.
Right now we can do something like Liliana, Death Wielder.json
:
{
"name": "Liliana, Death Wielder",
"type": "Planeswalker Deck",
"set_name": "Amonkhet",
"set_code": "AKH",
"cards": [
{
"name": "Swamp",
"count": 11,
"set_code": "AKH"
},
...
],
"sideboard": []
}
Set from which each card is will generally be possible to infer (since normally all cards are from same set, exceptions like Coldsnap Theme Decks are rare).
I don't think there's any reasonable way to figure out which card variant is included. Decklists on wizards site don't have it.
Gatherer set codes should be enough, are there any precons with sets not on Gatherer?
If there are, we can just use MTG JSON set codes.
We can figure out variants for some of the decks by looking at unboxing videos (this is something I have done before to document token cards included in a deck) and add them manually to those decks.
There's over 400 precon decks, looking at unboxing videos is not terribly realistic.
You can try bundle exec bin/build_jsons > decks.json
now.
I just discovered that all Commander decklists script got are missing commander. Oh well.
Mass import got to 109 decks already (they still need some cleanup, like missing commanders, and *
), and it even does usable json export. I think this project can go somewhere useful.
So we now have 536 decklists with validated card names and JSON export (as described by README).
It's definitely the highest quality machine readable source of this information anywhere.
There's some minor silliness like deck name capitalization (many are ALL UPPERCASE on wizards site), but it's really all ready for use by mtg.wtf, or any other program which might want to do so.
What's not included: any information which card version (set and variant) it actually is. With that many decklists I wanted to keep the scope realistically bound. At some point I might write tooling to deal with at least some of these (like Commander decks version is totally obvious), and then we'll see how many cases would be left over.
It all works now. I'm sure there are mistakes somewhere, but it's great success!
.cod
is just what my current scripts do, not super useful~ It's now more traditional.txt
format.