exit when the response has no images
This commit is contained in:
parent
9b756835a2
commit
c746f33c74
1 changed files with 4 additions and 0 deletions
|
@ -72,6 +72,10 @@ URL="${WALLHAVEN_BASE_URL}/search?${TAGS}${CATEGORIES}${PURITY}${SIZE}${RATIOS}$
|
||||||
CURL_CMD="${CURL_BASE_CMD} \"${URL}\""
|
CURL_CMD="${CURL_BASE_CMD} \"${URL}\""
|
||||||
RESULT="$(eval ${CURL_CMD})"
|
RESULT="$(eval ${CURL_CMD})"
|
||||||
NO_OF_IMAGES="$(printf "${RESULT}" | jq -r '.meta.total')"
|
NO_OF_IMAGES="$(printf "${RESULT}" | jq -r '.meta.total')"
|
||||||
|
if [ "${NO_OF_IMAGES}" -eq 0 ]; then
|
||||||
|
notify-send -u normal -a Wallpapers -i information -t 5000 "Wallpapers" "No images available for current configuration."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
RANDOM_ITEM="$(shuf -i 0-$((NO_OF_IMAGES-1)) -n 1 --random-source=/dev/urandom)"
|
RANDOM_ITEM="$(shuf -i 0-$((NO_OF_IMAGES-1)) -n 1 --random-source=/dev/urandom)"
|
||||||
ITEM_PAGE=$((RANDOM_ITEM/24))
|
ITEM_PAGE=$((RANDOM_ITEM/24))
|
||||||
ITEM_NUMBER=$((RANDOM_ITEM%24))
|
ITEM_NUMBER=$((RANDOM_ITEM%24))
|
||||||
|
|
Loading…
Reference in a new issue