summaryrefslogtreecommitdiff
path: root/backup-tc.sh
blob: d1b76daa5ebee88eb6d86951bcee9f5f47f87a15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

URL=$1
[[ $URL =~ (/?(index\.html)?(\#.*)?$) ]] && \
    echo $BASH_REMATCH && URL=${URL/%$BASH_REMATCH/}

OUTPUT_DIR="$2"
if [ -z "$OUTPUT_DIR" ]
then
    OUTPUT_DIR="."
fi

mkdir -p "$OUTPUT_DIR"

wget --mirror --page-requisites --no-parent --no-directories --directory-prefix="$OUTPUT_DIR" "$URL/"

for FILE in settings.json results.json vp.json butler.json cs.json
do
    wget -N --directory-prefix="$OUTPUT_DIR" "$URL/$FILE"
done

for LANG in pl en
do
    wget -N --directory-prefix="$OUTPUT_DIR/language" "$URL/language/$LANG.json"
done

python backup-tc.py "$URL" "$OUTPUT_DIR"