fridge-recipe-search - annna - Annna the nice friendly bot.
HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
DIR Log
DIR Files
DIR Refs
DIR Tags
DIR README
---
fridge-recipe-search (792B)
---
1 #!/bin/sh
2
3 if [ $# -lt 1 ];
4 then
5 printf "usage: %s ingredient\n" "$(basename "$0")" >&2
6 exit 1
7 fi
8
9 ingredients="$@"
10
11 # A note about the awk script below. I chose to hardcode the port, 70,
12 # because I couldn't figure out how to remove what I think is null
13 # character at the end of each line. This bastard of char was causing the
14 # ']' to be shown on the next line.
15 moar=$(printf "/~bencollver/recipes/search?%s\r\n" "${ingredients}" \
16 | nc tilde.pink 70 \
17 | grep "^0" \
18 | sed 's,^0,,' \
19 | awk -F '\t' '{ printf "0%s %s %s %s\n", $1, $2, $3, 70; }')
20 adc=$(printf "/recipes?%s\r\n" "${ingredients}" \
21 | nc adamsgaard.dk 70 \
22 | grep "^0" \
23 | sed 's,^0,,' \
24 | awk -F '\t' '{ printf "0%s %s %s %s\n", $1, $2, $3, 70; }')
25 all=$( printf "%s\n%s" "$moar" "$adc" | sort )
26 printf "%s" "$all"