Introduction
Introduction Statistics Contact Development Disclaimer Help
Improved recipe search and results - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit fda3c41881dbea823ab82a10f69ff569794e41c6
parent 221c0f28a1d48b22fca699d611750647b5f23f91
Author: Scarlett McAllister <[email protected]>
Date: Tue, 26 Mar 2024 20:39:37 -0300
Improved recipe search and results
Signed-off-by: Annna Robert-Houdin <[email protected]>
Diffstat:
M annna-message-common | 2 +-
M fridge-recipe-search | 18 +++++++++++++++---
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/annna-message-common b/annna-message-common
@@ -499,7 +499,7 @@ case "${text}" in
results="$(fridge-recipe-search "${ingredients}")"
if [ -n "${results}" ];
then
- puri="$(printf "%s\n" "${results}" | bitreich-paste)"
+ puri="$(printf "%s\n" "${results}" | bitreich-paste | sed 's,/…
annna-say -s "${server}" -c "${channel}" "${user}, here are so…
else
annna-say -s "${server}" -c "${channel}" "${user}, I could not…
diff --git a/fridge-recipe-search b/fridge-recipe-search
@@ -7,8 +7,20 @@ then
fi
ingredients="$@"
-printf "/recipes?%s\r\n" "${ingredients}" \
+
+# A note about the awk script below. I chose to hardcode the port, 70,
+# because I couldn't figure out how to remove what I think is null
+# character at the end of each line. This bastard of char was causing the
+# ']' to be shown on the next line.
+moar=$(printf "/~bencollver/recipes/search?%s\r\n" "${ingredients}" \
+ | nc tilde.pink 70 \
+ | grep "^0" \
+ | sed 's,^0,,' \
+ | awk -F '\t' '{ printf "[0|%s|%s|%s|%s]\n", $1, $2, $3, 70; }')
+adc=$(printf "/recipes?%s\r\n" "${ingredients}" \
| nc adamsgaard.dk 70 \
| grep "^0" \
- | sed 's,\r$,,; s,\(.\)\([^\t]*\)\t\([^\t]*\)\t\([^\t]*\)\t\([^\t]*\).…
-
+ | sed 's,^0,,' \
+ | awk -F '\t' '{ printf "[0|%s|%s|%s|%s]\n", $1, $2, $3, 70; }')
+all=$( printf "%s\n%s" "$moar" "$adc" | sort )
+printf "%s" "$all"
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.