Fix output to be the same everywhere. - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit e6ad1c8bb837268f7e2ed67d1943aa52ef56674c | |
parent 01d96c9afbf853e71878dc9410576cbff9a4e5a0 | |
Author: Annna Robert-Houdin <[email protected]> | |
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(-) | |
--- | |
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;\(mobi… | |
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,ti… | |
then | |
nuri="$(printf '%s\n' "${uri}" | sed -… | |
- nuris="$(printf 'gopherpedia: %s \n' "… | |
+ nuris="$(printf 'gopherpedia: %s\n' "$… | |
fetch-uri "${nuri}" > "${tmpf}" | |
+ nocuri=0 | |
fi | |
;; | |
*www.reddit.com*) | |
nuri="$(printf '%s\n' "${uri}" | sed "s;www.re… | |
- 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/… | |
fi | |
- nuris="${nuri}; gopherdit: ${guri} " | |
+ nuris="${nuri} ; gopherdit: ${guri}" | |
fi | |
+ nocuri=0 | |
;; | |
*github.com/*/blob/*) | |
urltitle="" | |
nuris="$(printf '%s' "${uri}" | sed 's/blob/ra… | |
+ nocuri=0 | |
;; | |
*) | |
mimetype="$(file -b --mime-type "${tmpf}")" | |
@@ -145,13 +149,13 @@ annna_common() { | |
then | |
curi="$(9 htmlfmt < "${tmpf}" … | |
fi | |
- outputstr="${outputstr}content: ${curi… | |
+ outputstr="${outputstr} content: ${cur… | |
fi | |
- [ -n "${nuris}" ] && outputstr="${outputstr}; … | |
- [ -n "${urititle}" ] && outputstr="${outputstr… | |
- [ -n "${suri}" ] && outputstr="${outputstr}; s… | |
- [ -n "${sturi}" ] && outputstr="${outputstr}; … | |
+ [ -n "${nuris}" ] && outputstr="${outputstr} $… | |
+ [ -n "${urititle}" ] && outputstr="${outputstr… | |
+ [ -n "${suri}" ] && outputstr="${outputstr} sc… | |
+ [ -n "${sturi}" ] && outputstr="${outputstr} s… | |
annna-say -c "${channel}" "${outputstr}" | |
fi | |
rm -f "${tmpf}" |