pick a random image from the list
This commit is contained in:
parent
47ec309886
commit
b72a8926cf
1 changed files with 4 additions and 1 deletions
|
@ -70,7 +70,10 @@ fi
|
||||||
notify-send -r 9897 -i information -t 1000 "Wallpapers" "Downloading..."
|
notify-send -r 9897 -i information -t 1000 "Wallpapers" "Downloading..."
|
||||||
URL="${WALLHAVEN_BASE_URL}/search?${TAGS}${CATEGORIES}${PURITY}${SIZE}${RATIOS}${COLORS}${AI_FILTER}${SORTING}${RANGE}"
|
URL="${WALLHAVEN_BASE_URL}/search?${TAGS}${CATEGORIES}${PURITY}${SIZE}${RATIOS}${COLORS}${AI_FILTER}${SORTING}${RANGE}"
|
||||||
CURL_CMD="${CURL_BASE_CMD} \"${URL}\""
|
CURL_CMD="${CURL_BASE_CMD} \"${URL}\""
|
||||||
ID="$(eval ${CURL_CMD} | jq -r '.data[0].id')"
|
RESULT="$(eval ${CURL_CMD})"
|
||||||
|
NO_OF_IMAGES="$(printf "${RESULT} | jq -r '.data | length')"
|
||||||
|
RANDOM="$(shuf -i 1-${NO_OF_IMAGES} -n 1 --random-source=/dev/urandom)"
|
||||||
|
ID="$(printf "${RESULT}" | jq -r ".data[${RANDOM}].id")"
|
||||||
CURL_CMD="${CURL_BASE_CMD} \"${WALLHAVEN_BASE_URL}/w/${ID}\""
|
CURL_CMD="${CURL_BASE_CMD} \"${WALLHAVEN_BASE_URL}/w/${ID}\""
|
||||||
IMAGE_META=$(eval ${CURL_CMD})
|
IMAGE_META=$(eval ${CURL_CMD})
|
||||||
IMAGE_URL="$(printf "${IMAGE_META}" | jq -r '.data.path')"
|
IMAGE_URL="$(printf "${IMAGE_META}" | jq -r '.data.path')"
|
||||||
|
|
Loading…
Reference in a new issue