Skip to content

Instantly share code, notes, and snippets.

@rossedman
Last active October 15, 2016 03:08
Show Gist options
  • Save rossedman/d13225357df2ee9b838e07a17605147c to your computer and use it in GitHub Desktop.
Save rossedman/d13225357df2ee9b838e07a17605147c to your computer and use it in GitHub Desktop.
MTG Cards
#!/bin/bash
#
# Use jq to curl down magic cards into individual files to process into DocumentDB in Azure
#
# List all sets to process
SETS=(MPS KLD DDR CN2 V16 EMN EMA SOI W16 DDQ OGW C15 EXP BFZ DDP V15)
for i in "${SETS[@]}"
do
curl "https://mtgjson.com/json/$SET" | jq -c -M '.cards[]' | \
while read line; do echo $line > cards/$i-$(pwgen 13 1).json; done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment