wut-get-waterfall-range Download a range of waterfalls

master
cv server 2020-01-02 15:12:19 -07:00
parent 8a47cd20af
commit 5d8bf90f6c
1 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,54 @@
#!/bin/bash
# wut-get-waterfall-range
# Usage:
# wut-get-waterfall-range [Observation ID Minumum] [Observation ID Maximum]
# Example:
# wut-get-waterfall-range 1292461 1470525
# Download Observation: JSON and waterfall. Not audio or data files.
# This will download the observation on the command line and every one before it.
#
# The last observation to start in 2019 was 1470525
# The last observation to start in 2019-11 was 1292461
# NOTE! Observations are not in numerical order by chronology.
# It looks like it is ordered by scheduling, so an older observation can have
# a higher observation ID.
#
# So to get mostly all of the observations in December, 2019, run:
# wut-get-waterfall-range 1292461 1470525
DOWNDIR="download"
cd $DOWNDIR || exit
# XXX Should check input is sane...
OBSIDMIN="$1"
OBSIDMAX="$2"
OBSID=$OBSIDMAX
# Download JSON
while [ $OBSID -gt $OBSIDMIN ]
do echo "Observation ID: $OBSID"
mkdir -p $OBSID
cd $OBSID
# Download if is isn't there already
[ ! -f $OBSID.json ] && curl \
--http2 --ipv4 \
--silent \
--output $OBSID.json \
"https://network.satnogs.org/api/observations/?id=$OBSID&ground_station=&satellite__norad_cat_id=&transmitter_uuid=&transmitter_mode=&transmitter_type=&vetted_status=&vetted_user=&start=&end="
WATERURL=`cat $OBSID.json | jq --compact-output '.[0] | {waterfall}' | cut -f 2- -d : | sed -e 's/}//g' -e 's/http:/https:/g' -e 's/"//g'`
WATERFILE=`basename $WATERURL`
[ ! -f $WATERFILE ] && \
curl \
--silent \
--http2 --ipv4 \
--continue-at - \
--remote-time \
--output $WATERFILE \
$WATERURL && sleep 1
cd ..
let OBSID=$OBSID-1
done
exit 0