Skip to content

Instantly share code, notes, and snippets.

@phaufe
Created February 11, 2014 10:20
Show Gist options
  • Save phaufe/8932387 to your computer and use it in GitHub Desktop.
Save phaufe/8932387 to your computer and use it in GitHub Desktop.
android netrunner cards
#!/bin/bash
# Constants
CARD_ID_PREFIX=bc0f047c-01b1-427f-a439-d451eda
GAME_ID=0f38e453-26df-4c04-9d67-6d43de939c77
TMPDIR=tmp_builddir
BASE_URL="http://netrunnerdb.com/web/bundles/netrunnerdbcards/images/cards/en"
# Positional params
ZIP_NAME=${1}
SET_ID=${2}
shift 2
CARD_IDS=${*}
# Derivative vars
SET_PATH=${GAME_ID}/Sets/${SET_ID}/Cards
# Prep the build environment
rm -rf ${TMPDIR}
mkdir ${TMPDIR}
cd ${TMPDIR}
mkdir -p ${SET_PATH}
# Download and convert the cards
for CARD in ${CARD_IDS}; do
wget ${BASE_URL}/${CARD}.png
convert ${CARD}.png ${SET_PATH}/${CARD_ID_PREFIX}${CARD}.jpg
done
# Create the zip archive
zip -r ANR-${ZIP_NAME} ${GAME_ID}
# Rename and move zip archive to directory from which we launched
cd -
mv ${TMPDIR}/ANR-${ZIP_NAME}.zip ANR-${ZIP_NAME}.o8c
# Clean up after ourselves
rm -rf ${TMPDIR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment