Skip to content

Deck Price Checker & Card Image Downloader for Magic: The Gathering

Notifications You must be signed in to change notification settings

Scstechr/MTGDPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTGDPC

Magic the Gathering Deck Price Checker (mainly for JPN Players).

Consists of mtgdpc.py and carddl.py, which carddl.py could be utilized independently.
mtgdpc.py calls carddl.py within process if -s(--save) argument is triggered.
Both of them supports --help option in order to check arguments and its individual function.

cardset.py added for searching card sets with its code, name, or playable format.
This later will be expanded to search for prices of each boxes.

About

MTGDPC (mtgdpc) enables users to search the cheapest price for a given card name via Wisdom Guild.
If -s(--save) option is triggered, it scrapes card image contained in the decklist via:

  • mtgsdk (official API)
  • scryfall.com (if -h(--high, high-res option) is active).

Requirements

  • Python 3.6 (or above)

  • Beautiful Soup

  • lxml

  • tqdm

  • requests

  • mtgsdk

Simply, pip install -r requirements.txt to install above mentioned modules.

How to use

1. Prepare decklist

  • .txt file of decklist must fit either Format (A) or (B).
  • decklist/ directory contains some sample .txt files.

Format (A) Basic Format

Note that card name must be in English.

<# of cards> <card name>
...

Sideboard
<# of cards> <card name>
...

Also, other format will be automatically converted to this format.

Format (B) M:TG Wiki Style

If you copy and paste from M:TG Wiki, some will look like:

<deck name>[?]
土地 (#)
<# of cards>	<card name [JPN]/[EN]>
クリーチャー (#)
<# of cards>	<card name [JPN]/[EN]>
呪文 (#)
<# of cards>	<card name [JPN]/[EN]>
サイドボード (#)
<# of cards>	<card name [JPN]/[EN]>

In this case, mtgdpc will automatically convert it and replace it with Basic Format.

2. Execute mtgdpc.py with argument of prepared .txt file

$ python mtgdpc.py <.txt file>
------------------------------ MAIN DECK ------------------------------

<price> x <# of cards> = <price of card(s)> <Card Name(JPN)/(EN)>
...

main ) price: < (A) total price of main deck >

------------------------------ SIDEBOARD ------------------------------

<price> x <# of cards> = <price of card(s)> <Card Name(JPN)/(EN)>
...

side ) price: < (B) total price of sideboard >

total price (main + side): (A) + (B)

Sample Decklist & Output

decklist/MoMa.txt

4 Tundra
4 Volcanic Island
3 City of Brass
4 Ancient Tomb
4 Tolarian Academy
4 Lotus Petal
4 Mox Diamond
4 Mana Vault
3 Voltaic Key
2 Scroll Rack
3 Mind Over Matter
4 Windfall
4 Time Spiral
3 Abeyance
3 Intuition
3 Power Sink
4 Stroke of Genius

Sideboard
4 Gorilla Shaman
4 Chill
2 Red Elemental Blast
1 Arcane Denial
4 Wasteland

Output

MoMa_Snapshot

decklist/BlueMonoMerfolk.txt

This example shows when -s (with -h) is triggered.
Also, if you set format (e.g., -f modern), results of cards will be reflected.

BlueMonoMerfolk_Snapshot

Future Enhancements

  • Introduce:
    • Pandasto manage it withDataFrames`.
    • Click` for better CUI experience.
  • Handle more format of decklists.
  • Refactoring for a more sophisticated structure.
  • Add:
    • Card info screen with capability of searching individual prices.
    • Mana info such as ratio and pie.

About

Deck Price Checker & Card Image Downloader for Magic: The Gathering

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages