remove the need of the .image suffix

This commit is contained in:
Adithya 2023-10-15 14:18:20 +05:30
parent ca50ae3606
commit daf4c74af6
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
2 changed files with 5 additions and 5 deletions

View file

@ -10,7 +10,7 @@ fi
random_paper() {
if [ -d "$DIR" ] ; then
find -L "${DIR}"/ -type f -regextype egrep -regex ".*\.(jpe?g|png|image)$" | shuf -n1
find -L "${DIR}"/ -type f -regextype egrep -regex ".*\.(jpe?g|png)$" | shuf -n1
elif [ -f "$DIR" ] ; then
echo "$DIR"
fi

View file

@ -79,9 +79,9 @@ CURL_CMD="${CURL_BASE_CMD} \"${WALLHAVEN_BASE_URL}/w/${ID}\""
IMAGE_META=$(eval ${CURL_CMD})
IMAGE_URL="$(printf "${IMAGE_META}" | jq -r '.data.path')"
IMAGE_ID="$(printf "${IMAGE_META}" | jq -r '.data.id')"
FILENAME="wallhaven-${IMAGE_ID}"
FILENAME="${IMAGE_URL##*/}"
notify-send -u normal -a Wallpapers -i information -t 2000 "Wallpapers" "Downloading image: ${IMAGE_URL}"
curl --silent -L --output "${DIR}/${FILENAME}.image" "${IMAGE_URL}"
notify-send -u normal -a Wallpapers -i information -t 2000 "Wallpapers" "Downloaded image: ${DIR}/${FILENAME}.image"
echo "${DIR}/${FILENAME}.image"
curl --silent -L --output-dir "${DIR}" -o "${FILENAME}" "${IMAGE_URL}"
notify-send -u normal -a Wallpapers -i information -t 2000 "Wallpapers" "Downloaded image: ${DIR}/${FILENAME}"
echo "${DIR}/${FILENAME}"