Introduction
Introduction Statistics Contact Development Disclaimer Help
Adding #network tag. - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit edc97536595c67bc8a79b64b7c099cc2c851d9f5
parent d1f9a008ca39d112c62e17eb926dd89af65030b8
Author: Annna Robert-Houdin <[email protected]>
Date: Tue, 19 May 2020 19:29:02 +0200
Adding #network tag.
Diffstat:
M annna-add-hashtag | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/annna-add-hashtag b/annna-add-hashtag
@@ -5,6 +5,7 @@ set -x
memecachedir="/br/gopher/memecache"
hashtagdb="/home/annna/bin/modules/hashtags/hashtags.txt"
unprocessed="/home/annna/bin/modules/hashtags/unprocessed.txt"
+memeindex="/br/gopher/memecache/meme.index"
[ ! -e "${hashtagdb}" ] && touch "${hashtagdb}"
@@ -95,6 +96,33 @@ inserttag() {
chmod 664 "${hashtagdb}"
}
+inserttag() {
+ tag="$1"
+ uri="$2"
+
+ grep "${tag} " $memeindex >/dev/null
+ if [ $? -eq 0 ];
+ then
+ printf "tag '%s' already in index.\n" "${tag}" >&2
+ return 1
+ fi
+
+ stag="$(printf "${tag}\n" | cut -c 2-)"
+ cd "${memecachedir}"
+ tagfile="$(basename "$(find . -name "${stag}.*" | grep -v .orig)")"
+ checksum="$(sha512sum "${tagfile}" | cut -d' ' -f 1)"
+ tagtype="$(get-tagtype "${tagfile}")"
+ memecacheuri="gopher://bitreich.org/${tagtype}/memecache/${tagfile}"
+
+ printf "%s %s %s\n" "${tag}" "${memecacheuri}" "${checksum}" >> "${mem…
+ printf "tag '%s' added as '%s' to meme index.\n" "${tag}" "${memecache…
+ LC_ALL=C sort -t ' ' -k1,1 "${memeindex}" > "${memeindex}.sort"
+ mv "$memeindex.sort" "${memeindex}"
+ # keep permissions shared.
+ chown ':bitreich' "${memeindex}"
+ chmod 664 "${memeindex}"
+}
+
addtag() {
tag="$1"
uri="$2"
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.