MTG decklist decoder and encoder library and application
mtgdeck is an application and library for decoding and encoding various
decklist formats for Magic: The Gathering.
Automatically determine input format in standard input and encode using default encoder (text) to standard output:
mtgdeck < input.mws > output.txtThe same as above, but from Python:
import sys
import mtgdeck
mtgdeck.dump(mtgdeck.load(sys.stdin), sys.stdout)Decode a Cockatrice decklist and encode to OCTGN, specifying files:
mtgdeck -d cod -e octgn -i input.cod -o output.o8dAnd in Python:
import mtgdeck
src = open('input.cod')
target = open('output.o8d', 'w')
decklist = mtgdeck.load(src, cls=mtgdeck.CockatriceDecoder)
mtgdeck.dump(decklist, target, cls=mtgdeck.OCTGNEncoder)mtgdeck currently supports the following formats:
| Magic online: | text (.txt and .dec) |
|---|---|
| Magic Workstation: | mws (.mwDeck) |
| OCTGN: | o8d (.o8d) |
| Cockatrice: | cod (.cod) |
The default decoder is auto: it tries to infer the correct decklist format.
The default encoder is text.
pip install mtgdeck
mtgdeck --help # or python -m mtgdeck --helpSee the Contribution guidelines file.