Fix output to be the same everywhere. - 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 e6ad1c8bb837268f7e2ed67d1943aa52ef56674c
(DIR) parent 01d96c9afbf853e71878dc9410576cbff9a4e5a0
(HTM) Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Sun, 14 Jun 2020 19:07:36 +0200
Fix output to be the same everywhere.
Diffstat:
M annna-start-services | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
---
(DIR) diff --git a/annna-start-services b/annna-start-services
@@ -57,7 +57,7 @@ annna_common() {
# Replacement URI.
nuri=""
# Replacement URI display string.
- snuri=""
+ nuris=""
# html2text content.
curi=""
# Set to 0, if some URI content should be shown.
@@ -85,30 +85,32 @@ annna_common() {
case "${uri}" in
*youtube.com/*|*youtu.be/*)
nuri="https://invidio.us/${uri#https*://*/}"
- nuris="${nuri}"
fetch-uri "${nuri}" > "${tmpf}"
urititle="$(curl-grabtitle "${nuri}")"
sturi="$(subtitle-paste "${uri}")"
nuris="invidious: ${nuri}"
+ nocuri=0
;;
*twitter.com*)
nuri="$(printf "%s\n" "${uri}" | sed 's;\(mobile\.\)\{0,1\}twitter\.com;nitter\.net;')"
fetch-uri "${nuri}" > "${tmpf}"
urititle="$(curl-grabtitle "${nuri}")"
suri="$(screenshot-paste "${nuri}")"
- nuris="nitter: ${nuris} "
+ nuris="nitter: ${nuris}"
+ nocuri=0
;;
*en.wikipedia.org/wiki*)
if ! regeximatch "$uri" '\.(jpg,bmp,gif,png,tiff,avi,mp4,webm,mkv,pdf,ps,eps)$';
then
nuri="$(printf '%s\n' "${uri}" | sed -e "s;.*en.wikipedia.org/wiki;gopher://gopherpedia.com/0;" -e "s;#.*$;;")"
- nuris="$(printf 'gopherpedia: %s \n' "${nuri}")"
+ nuris="$(printf 'gopherpedia: %s\n' "${nuri}")"
fetch-uri "${nuri}" > "${tmpf}"
+ nocuri=0
fi
;;
*www.reddit.com*)
nuri="$(printf '%s\n' "${uri}" | sed "s;www.reddit.com;old.reddit.com;")"
- nuris="old.reddit: ${nuri} "
+ nuris="old.reddit: ${nuri}"
fetch-uri "${nuri}" > "${tmpf}"
if [ -n "${uri#*www.reddit.com/r/*}" ];
then
@@ -120,12 +122,14 @@ annna_common() {
else
guri="gopher://gopherddit.com/1/cgi-bin/reddit.cgi?menu&${subreddit}&10"
fi
- nuris="${nuri}; gopherdit: ${guri} "
+ nuris="${nuri} ; gopherdit: ${guri}"
fi
+ nocuri=0
;;
*github.com/*/blob/*)
urltitle=""
nuris="$(printf '%s' "${uri}" | sed 's/blob/raw/')"
+ nocuri=0
;;
*)
mimetype="$(file -b --mime-type "${tmpf}")"
@@ -145,13 +149,13 @@ annna_common() {
then
curi="$(9 htmlfmt < "${tmpf}" | /br/bin/bitreich-paste)"
fi
- outputstr="${outputstr}content: ${curi} "
+ outputstr="${outputstr} content: ${curi} ;"
fi
- [ -n "${nuris}" ] && outputstr="${outputstr}; ${nuri}"
- [ -n "${urititle}" ] && outputstr="${outputstr}; title: ${urititle} "
- [ -n "${suri}" ] && outputstr="${outputstr}; screen: ${suri} "
- [ -n "${sturi}" ] && outputstr="${outputstr}; subtitles: ${sturi} "
+ [ -n "${nuris}" ] && outputstr="${outputstr} ${nuris} ;"
+ [ -n "${urititle}" ] && outputstr="${outputstr} title: ${urititle} ;"
+ [ -n "${suri}" ] && outputstr="${outputstr} screen: ${suri} ;"
+ [ -n "${sturi}" ] && outputstr="${outputstr} subtitles: ${sturi} ;"
annna-say -c "${channel}" "${outputstr}"
fi
rm -f "${tmpf}"