#!/bin/sh
## script to generate contents.jpeg files
## and to create relative links from artist dirs
## to tar.gz archives
#
## usage:
## n=3 && for i in *; do ./gen.sh $i $n && ((n=n+1)); done
#
## if you're just here to download stuff
## you DO NOT NEED THIS SCRIPT

CWD=`pwd`
pushd "$1"

montage -verbose -label '%f' -font Liberation-Sans-Bold -pointsize 12 -background '#000000' -fill 'gray' -define jpeg:size=200x200 -geometry 200x200+2+2 -auto-orient *.??? contents.jpeg

tar cf `basename "$1"`.tar --exclude=contents.jpeg *

gzip `basename "$1"`.tar

mv `basename "$1"`.tar.gz $CWD/"$2".tar.gz

ln -rsf ../"$2".tar.gz -t .

popd
