Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 56 lines (39 sloc) 937 Bytes
#!/bin/sh
set -e -u
PATH="$PATH:/usr/games"
if test ! -e ~/.twic2scidrc ; then
echo "Can't find configfile ~/.twic2scidrc"
echo 1
fi
. ~/.twic2scidrc
if test -z "$dbdir" -o -z "$dbname" -o -z "$ratefile" ; then
echo undefined dbdir and/or dbname and/or ratefile
exit 1
fi
if test ! -e "$dbdir/twic.latest" ; then
echo "$dbdir/twic.latest not found"
exit 1
fi
tempdir="`mktemp -t -d twic2scid.XXXXXXXXXX`"
latest="`cat $dbdir/twic.latest`"
cd $tempdir
while true; do
temp="`expr $latest + 1`"
wget http://www.chesscenter.com/twic/zips/twic${temp}g.zip -qO - >> twic.pgn.gz || break
latest="$temp"
done
if test ! -s twic.pgn.gz ; then
exit 0
fi
gunzip twic.pgn.gz
pgnscid twic.pgn
rm twic.pgn
sc_spell twic $ratefile
scmerge $dbdir/__twic $dbdir/$dbname twic
for w in sg4 si4 sn4 ; do
mv $dbdir/__twic.$w $dbdir/$dbname.$w
done
rm twic.sg4 twic.si4 twic.sn4
cd -
rmdir $tempdir
echo $latest > $dbdir/twic.latest