58 lines
1.7 KiB
Bash
Executable File
58 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# wut-water-range
|
|
# Usage:
|
|
# wut-water-range [Observation ID Minumum] [Observation ID Maximum]
|
|
# Example:
|
|
# wut-water-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-water-range 1292461 1470525
|
|
# Resume:
|
|
# wut-water-range 1359119 1470525
|
|
#
|
|
# XXX Should check input is sane...
|
|
|
|
APIURL="https://network.satnogs.org/api"
|
|
DOWNDIR="/srv/satnogs/download"
|
|
OBSIDMIN="$1"
|
|
OBSIDMAX="$2"
|
|
OBSID=$OBSIDMIN
|
|
|
|
cd $DOWNDIR || exit
|
|
|
|
# Download JSON
|
|
while [ $OBSID -lt $OBSIDMAX ]
|
|
do echo "ID: $OBSID"
|
|
mkdir -p $OBSID
|
|
cd $OBSID
|
|
# Download if is isn't there already
|
|
[ ! -f $OBSID.json ] && curl \
|
|
--http2 --ipv4 \
|
|
--silent \
|
|
--output $OBSID.json \
|
|
"$APIURL/observations/?id=$OBSID&ground_station=&satellite__norad_cat_id=&transmitter_uuid=&transmitter_mode=&transmitter_type=&vetted_status=&vetted_user=&start=&end=" && sleep `echo $((0 + RANDOM % 1))`
|
|
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 `echo $((0 + RANDOM % 1))`
|
|
cd ..
|
|
let OBSID=$OBSID+1
|
|
done
|
|
|
|
exit 0
|
|
|