Updated to make image selections more random

This commit is contained in:
Anon 2024-04-16 21:00:13 -07:00
parent 693abf5cb7
commit 1fa0bdc78a

View File

@ -53,10 +53,13 @@ TAGS_FMT=`echo "$TAGS" | tr ' ' '\n' | xargs echo | tr ' ' '+'`
TAGS_BLK_FMT=`xargs -a "$TAGS_BLACKLIST" echo | sed 's|\ |+-|g'`
TAGS_SEARCH="${TAGS_FMT}+sort:random+-${TAGS_BLK_FMT}"
RESULT=`curl -s --get "https://${BOORU_URL}/index.php" -d "page=dapi&s=post&q=index&json=1&limit=1&tags=${TAGS_SEARCH}"`
# RESULT=`curl -s --get "https://${BOORU_URL}/index.php" -d "page=dapi&s=post&q=index&json=1&limit=1&tags=${TAGS_SEARCH}"`
RESULT=`curl -s --get "https://${BOORU_URL}/index.php" -d "page=dapi&s=post&q=index&json=1&tags=${TAGS_SEARCH}"`
URL_FILE="$(echo "$RESULT" | jq -r '. | .post[0].file_url')"
RATING="$(echo "$RESULT" | jq -r '. | .post[0].rating')"
LENGTH="$(echo "$RESULT" | jq -r '. | .post | length')"
SELECTED=`shuf -i 0-$(expr $LENGTH - 1) -n 1`
URL_FILE="$(echo "$RESULT" | jq -r '. | .post['"$SELECTED"'].file_url')"
RATING="$(echo "$RESULT" | jq -r '. | .post['"$SELECTED"'].rating')"
NSFW="--nsfw"
TEXT="$MSG_NSFW"