2023-08-01 12:31:20 +05:00
|
|
|
#!/usr/bin/bash
|
|
|
|
min_diff=${1:-0}
|
|
|
|
max_diff=${2:-99}
|
|
|
|
max_size_bytes=${3:-$((512 * 1024 * 1024))}
|
2024-06-01 20:53:57 +05:00
|
|
|
ETTERNA_PATH=~/.etterna
|
2023-08-01 12:31:20 +05:00
|
|
|
|
|
|
|
PACKS=$(curl --silent 'https://api.etternaonline.com/v2/packs')
|
2024-06-01 20:53:57 +05:00
|
|
|
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)
|
2023-08-01 12:31:20 +05:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Abort"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-06-01 20:53:57 +05:00
|
|
|
DL_LINK=$(echo $PACKS | jq -r ".data.[] | select(.attributes.name == $SEL_PACK) | .attributes.download")
|
2023-08-01 12:31:20 +05:00
|
|
|
cd $ETTERNA_PATH/Songs
|
|
|
|
wget --no-check-certificate "$DL_LINK" && {
|
|
|
|
unzip *.zip && rm *.zip
|
|
|
|
}
|