use any meme as an antidepressant - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit a1d236f604cfd1390b49bf9034ebbd425c611211 | |
parent 5e1cee6573257f87cf7c27d113692c6993491826 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Wed, 20 Oct 2021 17:01:45 +0200 | |
use any meme as an antidepressant | |
Signed-off-by: Annna Robert-Houdin <[email protected]> | |
Diffstat: | |
M annna-message-common | 10 +++++++++- | |
A antidepressant | 26 ++++++++++++++++++++++++++ | |
2 files changed, 35 insertions(+), 1 deletion(-) | |
--- | |
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}" "${outpa… | |
+ esac | |
if [ "${recipient}" != "${text}" ]; | |
then | |
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" |