Created
January 28, 2010 04:47
-
-
Save imabuddha/288438 to your computer and use it in GitHub Desktop.
get new go games & rename files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# great src url: http://igo-kisen.hp.infoseek.co.jp/topics.html | |
SGF_SRC_LISTUsers/adrian/Go/Games/TWIG/urls.txt | |
SCRATCH_DIRtmp/twig | |
DESTINATION_DIRUsers/adrian/Go/Games/TWIG | |
mkdir $SCRATCH_DIR | |
cd $SCRATCH_DIR | |
if [ "$1" != "--process-only" ] | |
then | |
wget -r -l inf -t1 -nd -N -np -A.sgf -erobots=off -i "$SGF_SRC_LIST" | |
fi | |
if [ "$1" != "--download-only" ] | |
then | |
for sgfFile in $SCRATCH_DIR/*.sgf | |
do | |
pw=`mdls -raw -name com_breedingpinetrees_sgf_white "$sgfFile"` | |
pb=`mdls -raw -name com_breedingpinetrees_sgf_white "$sgfFile"` | |
dt=`mdls -raw -name com_breedingpinetrees_date_played "$sgfFile"` | |
dt{dt:0:10} | |
echo $dt-$pw-$pb | |
dest="$DESTINATION_DIR/$dt-$pw-$pb.sgf" | |
if [ -e "$dest" ] | |
then | |
# Do nothing | |
echo "Skipping $sgfFile" | |
else | |
#cp -v "$sgfFile" "$dest" | |
echo "Skipping $sgfFile" | |
fi | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment