Add multi-pointer support to memes. - annna - Annna the nice friendly bot.
(HTM) git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
(DIR) commit 72a6826e21e68e70ee2993fb246a154d4a38b6c4
(DIR) parent d58bae51f639073fd9fbc75ac96893ef65882507
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
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(-)
---
(DIR) 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/null;
+
+ 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/${outfile}"
+ printf "%s\n" "${outpath}"
+ if [ -e "${outpath}" ];
+ then
+ inpath="${outpath}";
+ continue
+ fi
+ pointer "${inpath}" "${outpath}" 2>&1 >/dev/null;
+ inpath="${outpath}";
+ done | tail -n 1)"
+
+ if [ -e "${outpath}" ];
then
- annna-say -s "${server}" -c "${channel}" "*${tag#\#}: gophers://bitreich.org/9/memecache/filter/${outfile}"
+ outfile="$(basename "${outpath}")"
+ annna-say -s "${server}" -c "${channel}" "${origtag}: gophers://bitreich.org/9/memecache/filter/${outfile}"
fi
else
annna-say -s "${server}" -c "${channel}" "${tagline% *}: ${tagline#* }"
(DIR) 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