From a4ce27e947f6d97e268cb05b6f7e78b4825bc053 Mon Sep 17 00:00:00 2001 From: Frederik Baerentsen Date: Thu, 25 Jun 2020 20:41:34 +0200 Subject: [PATCH] Added test to download from brickinstructions if lego.com is unavailable --- lego_dl.sh | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lego_dl.sh b/lego_dl.sh index a6ebfe3..cc44d9f 100644 --- a/lego_dl.sh +++ b/lego_dl.sh @@ -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"