README This small script takes any decklist from an MTGO list and pulls all card images as jpg or png files into your directory. If you like this project or have comments, feel free to reach out on twitter @izzitmichaela! https://twitter.com/izzitmichaela INSTRUCTIONS FOR USE CREATING THE PYTHON ENVIRONMENT: First, you need python. For this, I installed anaconda, which is a python package that gives you all the tools you need to run programs. You can download the environment here: https://www.anaconda.com/products/individual Within the Anaconda package is a program called Spyder. This is what I used to write and run the program. Open it up, and ensure it is working (you can either go in anaconda and launch spyder from there or simply press your windows or program key and start typing Spyder and it'll show up). Now you are ready to begin! Don't worry, the rest is much less involved! RUNNING THE PROGRAM 0-Download files included in the project. There should be 3 - a deck txt file and two python runner files 1-Go to https://scryfall.com/docs/api/bulk-data 2-Download the 'All Cards' File from the list. 3-Ensure that the name of the file is "all-cards.json". 4-Place file in the SAME folder as the other files. 5-Update the Deck txt file to include whatever cards you would wish. NOTE: Be sure they are in MTGO format, and be sure that only cards with single digit quantities are present This means you cannot have '15 Abrade' but you can have '9 Abrade' 6-Open the python file of choice in Spyder and click the 'run' arrow in the top (ir looks like a normal 'play' button to run the python file. If you want the little white corners cropped off, select the Runner_croppedBorders program instead. This stores them as png files rather than jpgs and are larger - but they look cleaner. The jpg files should appear in your directory after a moment or two! Enjoy! Note, if you are experiencing an error involving it not recognizing the 'requests' module, you may need to install the library using the tutorial below. If you installed anaconda and spyder correctly however, you shouldn't need to worry. https://www.agiratech.com/install-requests-library-in-python
A small script I made that takes any standard Decklist of magic the gathering cards and pulls all card images from scryfall at once!
README This small script takes any decklist from an MTGO list and pulls all card images as jpg or png files into your directory. If you like this pr
Information
Category: Python / Security related resources |
Watchers: 1 |
Star: 13 |
Fork: 2 |
Last update: Jan 15, 2022 |
Resource links
1 Open
More issues
Closed
Hi Michaela,
I saw your script and decided to contribute some changes:
- Use regex for grabbing card names. The "can't have more than 9 copies of a card in the deck" restriction felt exclusionary to Persistent Petitioners players, so I decided to relax that constraint by using a regular expression to grab the card name. Regular expressions are bonkers, but this tool helps explain what's going on (though it isn't processing the newline characters right so I got rid of them for the demonstration).
- Use web request to grab card info. Making people go and fetch the all-cards JSON isn't necessary, and it's a little inconvenient -- they'd have to go get it again every time they want to make a video about new cards. So instead, I'm using the Scryfall /cards/collections endpoint to fetch the card data for all the cards in the user's deck at runtime.
- Handle double-faced cards. The way the Scryfall API handles fellows like Delver of Secrets (here) wasn't getting parsed correctly -- you'll note this card doesn't have an
images_uris
property, and instead it has acard_faces
property which is a list of faces where each face has image URIs. So I added the appropriate parsing for that case. - Changes to the README. It's a Markdown file now, so it has fancy styling and whatnot. Also I made a requirements.txt file so people can install the requests package from the command line with a simple command I've included in the README.
- Save card images to sub-folder. Maybe just a personal preference thing, but I think it's nicer.
- Select deck file with OS file dialog. Just a quality-of-life improvement so people don't have to copy-paste into Deck.txt :)
Please let me know if you have any questions, and thanks for putting this together!
opened Jan 13, 2022 by Ragaxus 0
Open
Added a link to the README for where to install python
opened Jan 13, 2022 by Ragaxus 0
Contents
Share this repo