Skip to content

alecrem/middleschool-cardlist

Repository files navigation

sdk sdk_version app_file
streamlit
1.25.0
Middle_School_Card_Search.py

middleschool-cardlist

Composes a list of Magic cards legal in the Middle School format.

List of Middle School legal cards

You can download the list of legal cards in the following formats:

The following versions of the list include banned cards with a banned column set to True:

The following versions include image URIs from Scryfall in addition to all the above:

Composing the list

Feel free to take a look at the Jupyter notebook for a quick idea of the process, but please keep in mind that it is outdated and still included only for quick reference purposes.

To actually compose the list, run the shell and python scripts in the list_scripts directory in order.

Adding Image URIs

To add Scryfall image URIs to the card list, run the 9_add_image_uris.py script:

python3 list_scripts/9_add_image_uris.py

This script:

  • Reads the card data from static/middleschool_extra_fields_with_banned.csv
  • Queries the Scryfall API to fetch small image URIs for each card
  • Respects Scryfall's rate limiting (max 10 requests per second)
  • Generates output files with an additional image_small column containing the image URLs

For testing purposes, you can run the script with a --test flag to process only the first 20 cards:

python3 list_scripts/9_add_image_uris.py --test

Note: The full script may take several minutes to complete due to API rate limiting.

Fixing Split Card Data

To fix split card data issues (missing colors and rules text), run the 10_fix_split_cards.py script:

python3 list_scripts/10_fix_split_cards.py

This script:

  • Reads the card data from static/middleschool_extra_fields_with_banned_images.csv
  • Identifies all split cards (cards with "//" in the name)
  • Fixes color representation by combining colors from both halves using MTG JSON data
  • Combines rules text from both halves with " // " separator
  • Fixes corrupted Japanese names for split cards
  • Generates corrected output files with accurate split card data

The script addresses issues where split cards like "Fire // Ice" only showed colors from the first half (red only) instead of both halves (red and blue).

Requirements

Command line utilities:

Python modules:

  • json
  • pandas
  • requests
  • requests_html

Streamlit web interface

This repository also hosts a web app where users can search for Middle School legal cards or check the legality of cards in a list.

The app is deployed here: alecrem-middleschool.hf.space.

To run the Streamlit app locally, install the streamlit module and run:

streamlit run Middle_School_Card_Search.py

Note: the Streamlit version is pinned to 1.25.0 because that's the latest version supported by Hugging Face.

Next.js web interface (deprecated)

About

A list of Magic cards legal in the Middle School format which allows searchs and checks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published