From ba63c42ed70d7f2766fa67c157e8ff5c07da4655 Mon Sep 17 00:00:00 2001 From: Anon Date: Wed, 16 Oct 2024 23:10:37 -0700 Subject: [PATCH] Added md5 blacklist feature --- boorubot_v2.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/boorubot_v2.sh b/boorubot_v2.sh index fdffb15..a46e202 100755 --- a/boorubot_v2.sh +++ b/boorubot_v2.sh @@ -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