cleanup etterna dl script
This commit is contained in:
parent
975bbd13ad
commit
abc8967339
1 changed files with 3 additions and 7 deletions
|
@ -2,19 +2,15 @@
|
||||||
min_diff=${1:-0}
|
min_diff=${1:-0}
|
||||||
max_diff=${2:-99}
|
max_diff=${2:-99}
|
||||||
max_size_bytes=${3:-$((512 * 1024 * 1024))}
|
max_size_bytes=${3:-$((512 * 1024 * 1024))}
|
||||||
ETTERNA_PATH=~/Desktop/Etterna
|
ETTERNA_PATH=~/.etterna
|
||||||
|
|
||||||
if [ $(cat /sys/class/net/wlo1/carrier) -eq 0 ] && [ $(cat /sys/class/net/enp*/carrier) -eq 0 ]; then
|
|
||||||
echo 'No internet'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
PACKS=$(curl --silent 'https://api.etternaonline.com/v2/packs')
|
PACKS=$(curl --silent 'https://api.etternaonline.com/v2/packs')
|
||||||
DL_LINK=$(echo $PACKS | jq ".data | .[] | select(.attributes.average >= $min_diff and .attributes.average <= $max_diff and .attributes.size <= $max_size_bytes) | .attributes.name + \";\" + .attributes.download" | fzf -d ";" --with-nth 1 --bind 'enter:become(echo {2})')
|
SEL_PACK=$(echo $PACKS | jq ".data | .[] | select(.attributes.average >= $min_diff and .attributes.average <= $max_diff and .attributes.size <= $max_size_bytes) | .attributes.name" | fzf)
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Abort"
|
echo "Abort"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
DL_LINK=$(echo $PACKS | jq -r ".data.[] | select(.attributes.name == $SEL_PACK) | .attributes.download")
|
||||||
cd $ETTERNA_PATH/Songs
|
cd $ETTERNA_PATH/Songs
|
||||||
wget --no-check-certificate "$DL_LINK" && {
|
wget --no-check-certificate "$DL_LINK" && {
|
||||||
unzip *.zip && rm *.zip
|
unzip *.zip && rm *.zip
|
||||||
|
|
Loading…
Reference in a new issue