Fix new video filter and make it more modular. - 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 0a57b109407cb6a9440cebc3c411c983cfad41a1
DIR parent 63e3baa4192174b82f3376aebd2a9b13c6949ac7
HTML Author: Annna Robert-Houdin <annna@bitreich.org>
Date: Wed, 19 May 2021 19:18:02 +0200
Fix new video filter and make it more modular.
Diffstat:
M annna-message-common | 14 +++++++++++---
M ffmpeg-effect | 10 ++++------
2 files changed, 15 insertions(+), 9 deletions(-)
---
DIR diff --git a/annna-message-common b/annna-message-common
@@ -663,9 +663,17 @@ case "${text}" in
origext="$(grep -E "^#${hashtag} " "${hashtagfile}" | sed 's/.*\.//')"
{
filter="$(printf '%s\n' "${text}" | cut -d' ' -f3)"
- if outfile="$(ffmpeg-effect "$filter" "/br/gopher/memecache/${hashtag}.${origext}")"; then
- mv "$outfile" "/br/gopher/memecache/filter/${outfile}" && \
- annna-say -c "${channel}" "${user}, gopher://bitreich.org/9/memecache/filter/${outfile}"
+ outfile="${filter}-${hashtag}.mkv"
+ outpath="/br/gopher/memecache/filter/${outfile}"
+ inpath="/br/gopher/memecache/${hashtag}.${origext}"
+
+ [ ! -f "${inpath}" ] && exit 0
+
+ ffmpeg-effect "${filter}" "${inpath}" "${outpath}"
+
+ if [ -f "${outpath}" ];
+ then
+ annna-say -c "${channel}" "${user}, gopher://bitreich.org/9/memecache/filter/${outfile}"
fi
} &
exit 0
DIR diff --git a/ffmpeg-effect b/ffmpeg-effect
@@ -7,7 +7,7 @@ ffmpeg_common="ffmpeg -n -loglevel error"
repeats=5
usage() {
- printf 'usage: %s [-n REPEATS] FILTER file\n' "${0##*/}" 1>&2
+ printf 'usage: %s [-n REPEATS] FILTER infile outfile\n' "${0##*/}" 1>&2
printf 'where FILTER is one of: wide, thin, speedup, ' 1>&2
printf 'slowdown, reverse, loop, bounce.\n' 1>&2
printf 'For loop and bounce, option -n sets the number of repeats (default %d).\n' "$repeats" 1>&2
@@ -62,15 +62,13 @@ while getopts 'hn:' opt; do
esac
done
shift $((OPTIND - 1))
-if test "$#" -lt 2 -o ! -r "$2"; then
+if test "$#" -lt 3 -o ! -r "$2"; then
usage
fi
-n=$((n - 1))
-base="$(basename "$2")"
-out="${1}-${base%.*}.mkv"
-if process_filter "$1" "$2" "$out"; then
+if process_filter "$1" "$2" "$3"; then
printf '%s\n' "$out"
else
exit $?
fi
+