Added multi-selection for tracks

This commit is contained in:
Medvidek77 2025-04-22 15:01:28 +02:00
parent 3c78296e58
commit e1599f840c

View file

@ -2,7 +2,7 @@
. tidler.conf # Load ENVs from config file
version="0.3.2"
version="0.3.2-beta2"
if [ -n "$PROXY_URL" ]; then
@ -182,19 +182,29 @@ searchTrack() {
if [ "${#tracks_list[@]}" -eq 1 ]; then
echo "No tracks found :("
exit 1
fi
else
PS3="Please select a track: "
select t in "${tracks_list[@]}"; do
if [ -n "$t" ]; then
track_id=$(echo "$t" | awk -F ' - ' '{print $1}')
echo "You selected: $t"
i=0
while [ "$i" -lt "${#tracks_list[@]}" ]; do
echo "$((i + 1))) ${tracks_list["$i"]}"
i=$(( i + 1 ))
done
read -a inp
echo "${inp[0]}"
i=0
while [ "$i" -lt "${#inp[@]}" ]; do
inp2=$(("${inp[i]}" - 1))
if [ "$inp2" -ge 0 ] && [ "$inp2" -lt "${#tracks_list[@]}" ]; then
track_id=$(echo "${tracks_list["$inp2"]}" | awk -F ' - ' '{print $1}')
downloadTrack "$track_id"
break
else
echo "Invalid selection. Please try again."
fi
i=$(( i + 1 ))
done
fi
}
@ -373,3 +383,11 @@ else
searchAlbum
fi
fi
if [ "$option" -eq 1 ]; then
downloadTrack
elif [ "$option" -eq 2 ]; then
searchTrack
elif [ "$option" -eq 3 ]; then
searchAlbum
fi
fi