summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-03-15 18:49:08 +0100
committeremkael <emkael@tlen.pl>2020-03-15 18:49:08 +0100
commit1216f583b1e62f6ca4b00246417880d5e04905ad (patch)
tree0ea4262833a9fc3737e4a493aac0aff63a365712
parent1837bd95f56b41a22e1dbaa8c6d50d0e27778a41 (diff)
Non-harcoded tournament params
-rw-r--r--scrape.sh19
1 files changed, 12 insertions, 7 deletions
diff --git a/scrape.sh b/scrape.sh
index 489ecf4..8d7639a 100644
--- a/scrape.sh
+++ b/scrape.sh
@@ -1,13 +1,18 @@
-rm scores.sql
-rm *.pbn
-for RND in {1..3}
+#!/bin/bash
+set -xe
+PREFIX=$1
+ROUNDS=$2
+SEGMENTS=$3
+BOARDS=$4
+echo '' > ${PREFIX}_scores.sql
+for RND in `seq 1 $ROUNDS`
do
- for SEGMENT in {1..2}
+ for SEGMENT in `seq 1 $SEGMENTS`
do
- for BOARD in {1..8}
+ for BOARD in `seq 1 $BOARDS`
do
- python scrape-scores.py ../ivld_www/ivld_rr1_${RND}b-$((($SEGMENT - 1) * 8 + $BOARD)).html $RND $SEGMENT $BOARD >> scores.sql
+ python scrape-scores.py ${PREFIX}${RND}b-$((($SEGMENT - 1) * $BOARDS + $BOARD)).html $RND $SEGMENT $BOARD >> ${PREFIX}_scores.sql
done
- python scrape-boards.py ../ivld_www/ivld_rr1_${RND}t1-${SEGMENT}.html > ${RND}-${SEGMENT}.pbn
+ python scrape-boards.py ${PREFIX}${RND}t1-${SEGMENT}.html > ${PREFIX}_${RND}-${SEGMENT}.pbn
done
done