Added random sleep time
This commit is contained in:
parent
cf02ca95ff
commit
fca39791af
1 changed files with 4 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue