Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sirselim/mtg-markdown-generator
A Python script to generate markdown tables for Magic: The Gathering cards using the Scryfall API.
https://github.com/sirselim/mtg-markdown-generator
Last synced: 27 days ago
JSON representation
A Python script to generate markdown tables for Magic: The Gathering cards using the Scryfall API.
- Host: GitHub
- URL: https://github.com/sirselim/mtg-markdown-generator
- Owner: sirselim
- Created: 2024-01-15T04:47:12.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-17T23:02:22.000Z (12 months ago)
- Last Synced: 2024-10-18T12:22:34.897Z (3 months ago)
- Language: Python
- Size: 23.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MTG Markdown Decklist Generator
## Overview
This Python script generates a decklist in Markdown format using card data from the Scryfall API. It supports specifying commanders and sorting cards by type.
## Features
1. Card Data Retrieval
- The script uses the Scryfall API to retrieve detailed information about Magic: The Gathering cards.2. Image Download
- Downloads card images from Scryfall based on the retrieved card data.3. Markdown Decklist Generation
- Generates a decklist in Markdown format.4. Commander Support
- Supports the specification of commander cards.
- Commander cards are listed separately at the top of the generated decklist.5. Type-based Sorting
- Provides an option to sort cards by their types (e.g., creatures, artifacts, enchantments).6. Verbose Output
- Offers a `--verbose` option to enable detailed output during the script's execution.7. Concurrent Processing:
- Uses concurrent processing with `ThreadPoolExecutor` to speed up the retrieval of card data.8. Progress Bar
- Displays a progress bar using the tqdm library when processing batches.9. Output to Markdown File
- Can output the generated decklist as a Markdown file named `decklist.md`.10. Customizable Desired Order
- Allows defining a desired order for card types in the decklist.11. Case-Insensitive Commander Matching
- Ensures case-insensitive matching for commander names, avoiding issues with case discrepancies.## Usage
### Prerequisites
- Python 3.x
- Required Python packages (install using `pip install -r requirements.txt`):
- requests
- tqdm### Command-line Usage
```bash
./mtg_markdown_generator.py [--sort-by-type] [--verbose] [--markdown] [--commander ]
```- : Path to a text file containing card names (one per line).
- --sort-by-type: Sort cards by type in the generated decklist.
- --verbose: Enable verbose output.
- --markdown: Output the decklist as a Markdown file (`decklist.md`).
- --commander : Specify commander card(s) (separate multiple commanders with spaces).### Example
```bash
./mtg_markdown_generator.py my_deck.txt --sort-by-type --verbose --markdown --commander "Krark, the Thumbless" "Kydele, Chosen of Kruphix"
```This example generates a decklist from my_deck.txt, sorting cards by type, including verbose output, specifying commanders "Krark, the Thumbless" and "Kydele, Chosen of Kruphix" and saving the result as `decklist.md`.
## Acknowledgments
- The script uses the [Scryfall API](https://scryfall.com/) for retrieving card data.
- `tqdm` is used for progress bars in concurrent processing.## License
This project is licensed under the MIT License - see the LICENSE file for details.