Added random sleep time

This commit is contained in:
Medvidek77 2025-03-22 00:08:00 +01:00
parent cf02ca95ff
commit fca39791af

View file

@ -4,6 +4,7 @@
version="0.3.0" version="0.3.0"
if [ -n "$PROXY_URL" ]; then if [ -n "$PROXY_URL" ]; then
proxy_url="$PROXY_URL" proxy_url="$PROXY_URL"
else else
@ -102,7 +103,7 @@ downloadTrack() {
if [ "$success" = false ]; then if [ "$success" = false ]; then
echo "Attempt $attempt_num failed. Retrying..." echo "Attempt $attempt_num failed. Retrying..."
((attempt_num++)) ((attempt_num++))
sleep 1 # TODO: random sleep time sleep "1.$(tr -cd 0-9 </dev/urandom | head -c 5)"
fi fi
done done
@ -204,7 +205,7 @@ downloadAlbum() {
else else
echo "Attempt $attempt_num failed. Retrying..." echo "Attempt $attempt_num failed. Retrying..."
((attempt_num++)) ((attempt_num++))
sleep 1 sleep "1.$(tr -cd 0-9 </dev/urandom | head -c 5)"
fi fi
done done
@ -241,7 +242,7 @@ searchAlbum() {
if [ "${#albums_list[@]}" -eq 0 ]; then if [ "${#albums_list[@]}" -eq 0 ]; then
echo "No albums found. Retrying... (Attempt $attempt_num/$max_attempts)" echo "No albums found. Retrying... (Attempt $attempt_num/$max_attempts)"
((attempt_num++)) ((attempt_num++))
sleep 1 sleep "1.$(tr -cd 0-9 </dev/urandom | head -c 5)"
else else
PS3="Please select an album: " PS3="Please select an album: "
select t in "${albums_list[@]}"; do select t in "${albums_list[@]}"; do