74 lines
2.3 KiB
Bash
Executable File
74 lines
2.3 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
|
|
#
|
|
# APPROXIMATE:
|
|
# Observations 2015: 1-86
|
|
# Observations 2016: 87-613. Many in 15,000 range too
|
|
# Observations 2017: 614-55551
|
|
# Observations 2018: 55551-388962
|
|
# Observations 2019: 388963-1470939
|
|
# Observations 2020: 1470940-3394851
|
|
# Observations 2021: 3394852-5231193
|
|
# Observations 2022-01 2022-04: 5231194-5712616
|
|
# Observations 2022-05 5712617-6021303
|
|
# Observations 2022-06 6021304-6154227
|
|
# Observations 2022-07 6154228-6283338
|
|
#
|
|
# 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 the above list is rough, not exact.
|
|
# Also, there are exceptions, such as observations with IDs far higher than
|
|
# others that year.
|
|
#
|
|
# 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
|
|
|