global/zsh: add censor-audio function

This commit is contained in:
Infinidoge 2024-11-20 03:10:02 -05:00
parent 5730650e12
commit 472f6bd9b4
Signed by: Infinidoge
SSH key fingerprint: SHA256:oAMyvotlNFraMmZmr+p6AxnNfW/GioTs1pOn3V4tQ7A

View file

@ -83,6 +83,28 @@
git clone "$location" "$dir" "$@"
\builtin cd "$dir"
}
censor-audio() {
file="$1"
shift 1
if [ 2 -gt $# ]; then
echo "Not enough arguments"
exit 1
fi
filters=""
while [[ "$1" =~ ^"[0-9]+\.?[0-9]*-[0-9]+\.?[0-9]*"$ ]]; do
if [ $filters != "" ]; then
filters+=", "
fi
filters+="volume=enable='between(t,''${1/-/,})':volume=0"
shift 1
done
ffmpeg -i "$file" -vcodec copy -af "$filters" "$@"
}
'';
dotDir = ".config/zsh";