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

This commit is contained in:
Frederik Baerentsen 2020-06-25 20:41:34 +02:00
parent 68ddb6bf86
commit a4ce27e947

View File

@ -1,10 +1,9 @@
#!/bin/bash
##############################
#
# NOTE: There is still some small errors with sets with multiple booklets
#
# This scripts uses the brickset instructions file to get links and set numbers.
# In order to get themes, we get themes from rebrickable.
# If a booklet isn't available on lego.com, then brickinstructions.com is tested.
#
# Files are saved as:
# $tID""$setDESC""${setNAME// /_}"_("$setTHEME"_"$setYEAR").pdf"
@ -123,10 +122,9 @@
fi
else
if [[ "$tDESC" = "{No longer listed at LEGO.com}" ]] ; then
echo -ne "-> $tID testing link."
echo -ne "LEGO.com <$tLINK>..."
echo -ne "-> $tID testing links..."
if validate_url $tLINK; then
echo -ne "Found on lego.com... Downloading..."
echo -ne "Found on LEGO.com... Downloading..."
curl -H "Mozilla/5.0 (platform; rv:75.0) Gecko/20100101 Firefox/75.0" -L $tLINK --silent --output "$downloadFolder/$filename"
if [ -f "$downloadFolder/$filename" ]; then
echo "Done! > $filename"
@ -144,9 +142,8 @@
biID=$(sed -e 's/[^0-9_]/_/g' <<< $tID)
biLink="https://lego.brickinstructions.com/pdfdrop/"
echo -ne "BrickInstructions <$biLink$biID.pdf>..."
if validate_url "$biLink$biID.pdf"; then
echo -ne "Found on BrickInstructions... Downloading..."
echo -ne "Found on BrickInstructions.com... 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"