Added md5 blacklist feature

This commit is contained in:
Anon 2024-10-16 23:10:37 -07:00
parent 7e9f611fca
commit ba63c42ed7

View File

@ -39,6 +39,7 @@ POS_ARGS=8
echo " blacklist - A text list of newline deliminated tags to blacklist" &&\
echo " md5_history - md5 history file to write to in order to avoid excessive duplicates" &&\
echo " md5_tail_history - the number of history items to blacklist" &&\
echo " md5_blacklist - A permanent blacklist file" &&\
echo " searchtags - The tags to search for" &&\
echo " msg_sfw - Display message if image is safe for work" &&\
echo " msg_nsfw - Display message if image is not safe for work" &&\
@ -49,9 +50,10 @@ DEFAULT_KEYFILE="$2"
TAGS_BLACKLIST="$3"
MD5_HISTORY="$4"
MD5_NUM="$5"
TAGS="$6"
MSG_SFW="$7"
MSG_NSFW="$8"
MD5_BLACKLIST="$6"
TAGS="$7"
MSG_SFW="$8"
MSG_NSFW="$9"
shift $POS_ARGS
TMP=$(mktemp)
@ -77,6 +79,7 @@ for i in $SELECTION;do
MD5="$(echo "$RESULT" | jq -r '. | .post['"$i"'].md5')"
[ -z "$MD5" ] && continue
grep -q "$MD5" "$TMP" && continue
grep -q "$MD5" "$MD5_BLACKLIST" && continue
URL_FILE="$(echo "$RESULT" | jq -r '. | .post['"$i"'].file_url')"
RATING="$(echo "$RESULT" | jq -r '. | .post['"$i"'].rating')"
@ -85,9 +88,6 @@ for i in $SELECTION;do
PICKED="/tmp/$(basename "$URL_FILE")"
# This may be quirk of gelbooru
[ "$PICKED" = "/tmp/null" ] && continue
# Always delete the temporary file
trap "rm ${PICKED} ${TMP}" EXIT