Updated shebang and added multiple album download

This commit is contained in:
Medvidek77 2025-04-21 17:51:58 +02:00
parent 4080cadbc7
commit 3c78296e58

View file

@ -1,8 +1,8 @@
#!/bin/bash #!/usr/bin/env bash
. tidler.conf # Load ENVs from config file . tidler.conf # Load ENVs from config file
version="0.3.1" version="0.3.2"
if [ -n "$PROXY_URL" ]; then if [ -n "$PROXY_URL" ]; then
@ -44,10 +44,10 @@ if [ -n "$MAX_ATTEMPTS" ]; then
echo "Bad MAX_ATTEMPTS option. Allowed are numbers from 1 to 100." echo "Bad MAX_ATTEMPTS option. Allowed are numbers from 1 to 100."
echo "Using default value..." echo "Using default value..."
max_attempts="15" # Default value max_attempts="10" # Default value
fi fi
else else
max_attempts="15" # Default value max_attempts="10" # Default value
fi fi
@ -136,6 +136,7 @@ downloadTrack() {
if [ -n "$DOWNLOADS_DIR" ]; then if [ -n "$DOWNLOADS_DIR" ]; then
download_dir="$DOWNLOADS_DIR" download_dir="$DOWNLOADS_DIR"
else else
echo "Using current path..."
download_dir="$(pwd)" download_dir="$(pwd)"
fi fi
@ -268,18 +269,27 @@ searchAlbum() {
((attempt_num++)) ((attempt_num++))
sleep "1.$(tr -cd 0-9 </dev/urandom | head -c 5)" sleep "1.$(tr -cd 0-9 </dev/urandom | head -c 5)"
else else
PS3="Please select an album: " i=0
select t in "${albums_list[@]}"; do while [ "$i" -lt "${#albums_list[@]}" ]; do
if [ -n "$t" ]; then echo "$((i + 1))) ${albums_list["$i"]}"
album_id=$(echo "$t" | awk -F ': ' '{print $1}')
echo "You selected: $t" 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 "${#albums_list[@]}" ]; then
album_id=$(echo "${albums_list["$inp2"]}" | awk -F ': ' '{print $1}')
downloadAlbum "$album_id" downloadAlbum "$album_id"
success=true
break
else else
echo "Invalid selection. Please try again." echo "Invalid selection. Please try again."
fi fi
i=$(( i + 1 ))
done done
success=true
if [ "$success" = true ]; then if [ "$success" = true ]; then
break break
fi fi
@ -363,4 +373,3 @@ else
searchAlbum searchAlbum
fi fi
fi fi