Added test to download from brickinstructions if lego.com is unavailable

This commit is contained in:
Frederik Baerentsen 2020-06-25 15:56:06 +02:00
parent 8c31492779
commit affb4bb441

View File

@ -134,13 +134,31 @@
else else
echo "ERROR!" echo "ERROR!"
if [[ $error_level = 1 || $error_level = 2 ]]; then if [[ $error_level = 1 || $error_level = 2 ]]; then
echo "--> Not downloaded. Try again manually..." echo "--> Not downloaded. Try again manually..."
echo "$filename was not downloaded. Check CURL" >> $logfile echo "$filename was not downloaded. Check CURL" >> $logfile
fi
fi fi
#random sleep in order to not look like a script #random sleep in order to not look like a script
sleep $(( ( RANDOM % 5 ) + 1 )) sleep $(( ( RANDOM % 5 ) + 1 ))
fi else
#test
biLink="https://lego.brickinstructions.com/pdfdrop/"
if validate_url "$biLink$tID.pdf"; then
echo -ne "Found on BrickInstructions... Downloading..."
curl -H "Mozilla/5.0 (platform; rv:75.0) Gecko/20100101 Firefox/75.0" -L "$biLink$tID.pdf" --silent --output "$downloadFolder/$filename"
if [ -f "$downloadFolder/$filename" ]; then
echo "Done! > $filename"
else
echo "ERROR!"
if [[ $error_level = 1 || $error_level = 2 ]]; then
echo "--> Not downloaded. Try again manually..."
echo "$filename was not downloaded. Check CURL" >> $logfile
fi
fi
#random sleep in order to not look like a script
sleep $(( ( RANDOM % 5 ) + 1 ))
fi
fi
else else
if [[ $error_level = 1 || $error_level = 2 ]]; then if [[ $error_level = 1 || $error_level = 2 ]]; then
echo "-> $tID is not available. Skipping..." echo "-> $tID is not available. Skipping..."