#! /bin/sh
version=1.0

##this script transfer swac-shtooka ressources at the good place
##author Bernadette Perrin-Riou

adresse=download.shtooka.net
 
cd `dirname $0`/..
wimshome=`pwd`
swac=$wimshome/public_html/scripts/data/swac
cd $swac ; 
packs=`ls -d */`
echo "$version" > version.tmp;
for i in $packs; do
  u=`basename $i` ;
  j=${u}_mp3 ;
  wget http://$adresse/$j.tar;
  tar xf $j.tar;
  mkdir -p $swac/$u; cp -r $swac/$j/* $swac/$u ; rm $swac/$j.tar ; rm -r $swac/$j;
  echo "$u" >> version.tmp ;
done ;

cd $swac ; cp version.tmp version ; rm version.tmp; 
./mkindex ; 
