don't download already downloaded images

This commit is contained in:
Adithya 2024-05-22 00:26:55 +05:30
parent 794f868933
commit 428425bab7
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C

View file

@ -97,6 +97,8 @@ if [ "${ITEM_PAGE}" -gt 0 ]; then
fi
IMAGE_URL="$(echo "${RESULT}" | jq -r ".data[${ITEM_NUMBER}].path")"
FILENAME="${IMAGE_URL##*/}"
curl --silent -L --output-dir "${DIR}" -o "${FILENAME}" "${IMAGE_URL}"
if [ ! -f "${DIR}/${FILENAME}" ]; then
curl --silent -L --output-dir "${DIR}" -o "${FILENAME}" "${IMAGE_URL}"
fi
echo "${DIR}/${FILENAME}"