Start work on Fio splitter.

This commit is contained in:
Dominik Pantůček 2023-07-29 09:49:38 +02:00
parent b5bd14a477
commit fff8d4b65f
2 changed files with 111 additions and 1 deletions

View file

@ -125,6 +125,7 @@ download_file() {
tmpfname="$fname.tmp"
oldfname="$fname.old"
for i in `seq 1 3` ; do
echo "$url"
if wget -q "$url" -O "$tmpfname" ; then
if [ -s "$tmpfname" ] ; then
log Download OK
@ -139,6 +140,7 @@ download_file() {
log Retrying in 5 s.
fi
else
cat "$tmpfname"
log Failed download, retrying in 5 s.
sleep 5
fi
@ -151,10 +153,10 @@ download_file() {
# $2 - year
# $3 - destination file name
download_year() {
log "Downloading ${APIURI}/periods/.../$year-01-01/$year-12-31/transactions.csv to $fname"
apikey="$1"
year="$2"
fname="$3"
log "Downloading ${APIURI}/periods/.../$year-01-01/$year-12-31/transactions.csv to $fname"
download_file "${APIURI}/periods/$apikey/$year-01-01/$year-12-31/transactions.csv" "$fname"
}