A set of mtg collection-related scripts for inventory management and price comparisons
python load_collection.py data/inputfile.txt
update_csv.py requires cards to be stored in a specific csv file format where each row is: card_name, card_quantity, card_price This is not how many services/exports provide cards so this script reads an mtgo-style export txt file and generates a csv with the same filename as the provided txt file and sets all prices to 0.0 Script assumes cards are one-per-row and in the format of "4x Island" - others will not work
python update_csv.py data/inputfile [-r] [-p] [-g]
update_csv.py given a csv file of cards located in a /data directory (this will become adjustable in upcomming release)
It's a pain to keep a MTG card collection up to date with prices if you're accurately trying to evaluate their overall worth. While some websites will now host a collection for you, update_csv puts the power entirely in your hands. Once your initial collection is logged in a csv, periodically running it against update_csv.py will update your entire collection's worth, card by card, and sort them from most to least expensive. And if cards have changed dramatically in value, it'll print those changes to the terminal for easy analysis. The idea here is to not only get an accurate tally of what your collection is worth, but also more information on what your payout would look like to sell the whole thing.
[-r] prevents price pulling, but will consolidate multiple copies of a card if they're found on different rows [-p] doesn't consolidate but pulls prices. I don't really know why this option exists but it seemed a good idea at the time... [-g] with google api downloaded, uploads inputfile.csv to specified path on google drive for backup purposes
Script printout can be adjusted by the following 4 variables:
- MIN_DELT: smallest absolute change in price you want for cards printed to terminal
- MIN_MOD: smallest absolute percentage change in price you want for cards printed to terminal
- BULK_CEILING: highest price on cards you want evaluated as bulk for total collection price evaluation purposes (this affects the math at the end)
- BULK_RATE: Rate at which bulk is priced per 1,000 cards
Any cards with a price of "0" upon script run will be tallied seperately to provide a value of "new cards since last run", an easier way to see just how much those new commander cards or a box contents' are worth.
delete_card.py data/inputfile cards_to_remove.txt
To limit manual exposure to your collection CSV, and manual searching - delete_cards.py searches through a provided csv and removes one copy of every card in a provided txt file, or returns a "not found" error per card. Future versions will include the ability to specify how many copies you want removed.
fixup_collection.py valuefile bulkfile
With an adjustable threshold value, BULK_CEILING, given two filepaths, throws all the cards from both lists together and sorts everything above BULK_CEILING into the first provided file and everything under or equal to into the other. This allows you to maximize readability of your cards holding actual value and still store the information of your bulk.