Added download folder location

This commit is contained in:
FrederikBaerentsen 2020-06-23 15:09:56 +02:00
parent a464e9014a
commit 709881566a

View File

@ -3,7 +3,7 @@
echo "----> Starting Download of all LEGO instructions from https://brickset.com/exportscripts/instructions" echo "----> Starting Download of all LEGO instructions from https://brickset.com/exportscripts/instructions"
firstline=0 firstline=0
logfile="lego_errors.log" logfile="lego_errors.log"
downloadFolder="Instructions"
#error_level: #error_level:
# 0 no errors reported # 0 no errors reported
# 1 Download errors reported # 1 Download errors reported
@ -37,7 +37,7 @@ do
tADDED=$(sed -e 's/^"//' -e 's/"$//' <<<"$ADDED") tADDED=$(sed -e 's/^"//' -e 's/"$//' <<<"$ADDED")
tDESC=$(sed -e 's/^"//' -e 's/"$//' <<<"$DESC") tDESC=$(sed -e 's/^"//' -e 's/"$//' <<<"$DESC")
filename=$tID"_"${tNAME// /_}"_("${tDESC// /_}")_"$tADDED".pdf" filename=$tID"_"${tNAME// /_}"_("${tDESC// /_}")_"$tADDED".pdf"
if [ -f "$filename" ]; then if [ -f "$downloadFolder/$filename" ]; then
echo "-> $tID exists. Skipping..." echo "-> $tID exists. Skipping..."
if [[ $error_level = 2 ]]; then if [[ $error_level = 2 ]]; then
echo "$filename exists." >> $logfile echo "$filename exists." >> $logfile
@ -50,8 +50,8 @@ do
fi fi
else else
echo -ne "--> $tID downloading now..." echo -ne "--> $tID downloading now..."
curl $tLINK --silent --output $filename curl $tLINK --silent --output "Instructions/$filename"
if [ -f "$filename" ]; then if [ -f "$downloadFolder/$filename" ]; then
echo "Done!" echo "Done!"
else else
echo "ERROR!" echo "ERROR!"