Added test to download from brickinstructions if lego.com is unavailable
This commit is contained in:
parent
68ddb6bf86
commit
a4ce27e947
11
lego_dl.sh
11
lego_dl.sh
@ -1,10 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/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.
|
# This scripts uses the brickset instructions file to get links and set numbers.
|
||||||
# In order to get themes, we get themes from rebrickable.
|
# 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:
|
# Files are saved as:
|
||||||
# $tID""$setDESC""${setNAME// /_}"_("$setTHEME"_"$setYEAR").pdf"
|
# $tID""$setDESC""${setNAME// /_}"_("$setTHEME"_"$setYEAR").pdf"
|
||||||
@ -123,10 +122,9 @@
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [[ "$tDESC" = "{No longer listed at LEGO.com}" ]] ; then
|
if [[ "$tDESC" = "{No longer listed at LEGO.com}" ]] ; then
|
||||||
echo -ne "-> $tID testing link."
|
echo -ne "-> $tID testing links..."
|
||||||
echo -ne "LEGO.com <$tLINK>..."
|
|
||||||
if validate_url $tLINK; then
|
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"
|
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
|
if [ -f "$downloadFolder/$filename" ]; then
|
||||||
echo "Done! > $filename"
|
echo "Done! > $filename"
|
||||||
@ -144,9 +142,8 @@
|
|||||||
|
|
||||||
biID=$(sed -e 's/[^0-9_]/_/g' <<< $tID)
|
biID=$(sed -e 's/[^0-9_]/_/g' <<< $tID)
|
||||||
biLink="https://lego.brickinstructions.com/pdfdrop/"
|
biLink="https://lego.brickinstructions.com/pdfdrop/"
|
||||||
echo -ne "BrickInstructions <$biLink$biID.pdf>..."
|
|
||||||
if validate_url "$biLink$biID.pdf"; then
|
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"
|
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
|
if [ -f "$downloadFolder/$filename" ]; then
|
||||||
echo "Done! > $filename"
|
echo "Done! > $filename"
|
||||||
|
Loading…
Reference in New Issue
Block a user