#!/bin/sh
#
# skinsplit.sh takes a winamp-skin-file (.wsz or .zip) and extracts
#              buttons for use with picbook.sh in gif format into a
#              new directory with the name of the skin-file.
#
# usage: skinsplit.sh [skin-file]
#
# last update: 16 Nov 2000
#
# (c) 2000 Peter_Hanssen@writeme.com
# 
####################################################################

skin_dir=`basename $1 '.[wz][si][zp]'`

if [ -d ${skin_dir} ]; then
 echo "\n!!! ${skin_dir} already exists !!!"
 echo "!!! I might overwright some older skins !!!"
else
 mkdir ${skin_dir}
 chmod 755 ${skin_dir}
fi

for BMP_FILE in cbuttons.bmp shufrep.bmp volume.bmp 
do
 BMP_FILE_BASE=`basename ${BMP_FILE} .bmp`
 unzip -L -o -qq -p $1 ${BMP_FILE} | \
   convert - /tmp/${BMP_FILE_BASE}.gif

# for GIF_FILE in first_off.gif next_off.gif 
# if [ -f ${skin_dir}/first.gif ]; then
#  echo "!!! I'm replacing ${skin_dir}/first.gif !!!"
# fi
# convert -crop 23x18+0+0 /tmp/${BMP_FILE_BASE}.gif \
#         ${skin_dir}/first.gif

done

#rm /tmp/cbuttons.gif /tmp/shufrep.gif /tmp/volume.gif

