use any meme as an antidepressant - 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 --- DIR commit a1d236f604cfd1390b49bf9034ebbd425c611211 DIR parent 5e1cee6573257f87cf7c27d113692c6993491826 HTML Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 20 Oct 2021 17:01:45 +0200 use any meme as an antidepressant Signed-off-by: Annna Robert-Houdin <annna@bitreich.org> Diffstat: M annna-message-common | 10 +++++++++- A antidepressant | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -777,6 +777,7 @@ case "${text}" in | head -n 1)" annna-say -c "${channel}" "${user}, I think ${pick} is the best option." ;; +"${botname}, please antidepressant #"*) "${botname}, please amsterdamify #"*|\ "${botname}, please banjo #"*|\ "${botname}, please bounce #"*|\ @@ -809,7 +810,14 @@ case "${text}" in [ -f "${outpath}" -a ! -s "${outpath}" ] && rm "${outpath}" - ffmpeg-effect "${filter}" "${inpath}" "${outpath}" + case "${filter}" in + antidepressant) + outfile="${outfile%.*}.jpg" + outpath="${outpath%.*}.jpg" + antidepressant "${inpath}" "${outpath}";; + *) + ffmpeg-effect "${filter}" "${inpath}" "${outpath}";; + esac if [ "${recipient}" != "${text}" ]; then DIR diff --git a/antidepressant b/antidepressant @@ -0,0 +1,26 @@ +#!/bin/sh + +die() { + printf '%s\n' "$1" >&2 + exit 1 +} + +if test $# -ne 2; then + die "usage: ${0##*/} <file> <outimagefile>" +fi + +mimetype="$(file -ib "$1")" +case "$mimetype" in + video/*) + in="$(mktemp).jpg" + ffmpeg -i "$1" -frames:v 1 "$in";; + image/*) + in="$1";; + *) + die "file type '${mimetype}' not supported";; +esac + +convert /br/gopher/memecache/c++-anti-depressant.jpg \ + \( "${in}" -resize 200x100 \) \ + -gravity center -geometry -240+200 \ + -composite "$2"