49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# wut-water
|
|
# Usage:
|
|
# wut-water [Observation ID] [Observation ID] [Observation ID] ...
|
|
# Example:
|
|
# wut-water 1446272 1456893
|
|
# Download Observation: JSON and waterfall. Not audio or data files.
|
|
|
|
APIURL="https://network.satnogs.org/api"
|
|
DOWNDIR="/srv/satnogs/download"
|
|
|
|
cd $DOWNDIR || exit
|
|
|
|
# XXX Should check input is sane...
|
|
OBS="$@"
|
|
|
|
# Download JSON
|
|
for OBSID in $OBS
|
|
do 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="
|
|
cd ..
|
|
done
|
|
|
|
# Download Waterfall
|
|
OBS="$@"
|
|
for OBSWATER in $OBS
|
|
do cd $OBSWATER
|
|
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
|
|
cd ..
|
|
done
|
|
|
|
exit 0
|
|
|