#!/bin/bash
set -eux

. mkp4a.common

echo '### prepare cardsets'

if [ ! -f ${cardsets_file} ]; then
  echo '### downloading cardsets'
  wget https://netix.dl.sourceforge.net/project/pysolfc/PySolFC-Cardsets/minimal/${cardsets_file}
fi

if [ ! -d ${cardsets_dir} ]; then
  echo '### extracting cardsets'
  tar -xf ${cardsets_file}
fi

echo '### processing cardsets'
(
  cd ${cardsets_dir}
  ../../scripts/cardconv gif png
  for i in cardset-*-png; do
    rm -rf `basename $i -png`
  done
)

echo '### end cardsets'
