Add multi-pointer support to memes. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 72a6826e21e68e70ee2993fb246a154d4a38b6c4 | |
parent d58bae51f639073fd9fbc75ac96893ef65882507 | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sun, 19 Feb 2023 13:24:57 +0100 | |
Add multi-pointer support to memes. | |
Diffstat: | |
M annna-message-common | 33 +++++++++++++++++++++++++----… | |
M pointer | 2 +- | |
2 files changed, 28 insertions(+), 7 deletions(-) | |
--- | |
diff --git a/annna-message-common b/annna-message-common | |
@@ -1147,7 +1147,7 @@ esac | |
printf '%s' "$text" | awk -v taglimit="$printnhashtags" ' | |
$0 !~ /#nospoil/ { | |
- while (match($0, /[#*][^#^* /"'\'',?!;$\001]+/)) { | |
+ while (match($0, /[#*]+[^#^* /"'\'',?!;$\001]+/)) { | |
tag = substr($0, RSTART, RLENGTH) | |
$0 = substr($0, RSTART + RLENGTH) | |
sub(/[.]*$/, "", tag) | |
@@ -1157,9 +1157,11 @@ $0 !~ /#nospoil/ { | |
}' | while read -r tag; | |
do | |
[ "${tag}" == "#expand" ] && continue | |
+ | |
+ origtag="${tag}" | |
case "${tag}" in | |
"*"*) | |
- tag="#${tag#\*}" | |
+ tag="#$(printf "%s\n" "${tag}" | sed "s,^[\*]*,,")" | |
pointer=1;; | |
*) | |
pointer=0;; | |
@@ -1171,13 +1173,32 @@ do | |
then | |
if [ $pointer -eq 1 ]; | |
then | |
- outfile="*${tag#\#}.jpg" | |
- outpath="/br/gopher/memecache/filter/${outfile… | |
inpath="/br/gopher/memecache/${tagline##*/}" | |
[ ! -f "${inpath}" ] && exit 0 | |
- if pointer "${inpath}" "${outpath}" 2>&1 >/dev… | |
+ | |
+ outfile="${tag#\#}.jpg" | |
+ # pointy pointers | |
+ outpath="$(printf "%s\n" "${origtag}" \ | |
+ | sed 's,\*,&\n,g' \ | |
+ | grep "^*" \ | |
+ | while read -r asterisk; | |
+ do | |
+ outfile="*${outfile}" | |
+ outpath="/br/gopher/memecache/filter/$… | |
+ printf "%s\n" "${outpath}" | |
+ if [ -e "${outpath}" ]; | |
+ then | |
+ inpath="${outpath}"; | |
+ continue | |
+ fi | |
+ pointer "${inpath}" "${outpath}" 2>&1 … | |
+ inpath="${outpath}"; | |
+ done | tail -n 1)" | |
+ | |
+ if [ -e "${outpath}" ]; | |
then | |
- annna-say -s "${server}" -c "${channel… | |
+ outfile="$(basename "${outpath}")" | |
+ annna-say -s "${server}" -c "${channel… | |
fi | |
else | |
annna-say -s "${server}" -c "${channel}" "${ta… | |
diff --git a/pointer b/pointer | |
@@ -53,10 +53,10 @@ convert \ | |
-pointsize 50 -fill white \ | |
-stroke black -strokewidth 1 \ | |
-gravity southwest \ | |
- -draw "text +10,+10 '${n}'" \ | |
-gravity northeast \ | |
-draw "text -422,+20 '*${n}'" \ | |
"$tmp" | |
+# -draw "text +10,+10 '${n}'" \ | |
exitcode=$? | |
if [ $exitcode -eq 0 ]; | |
then |