From 37a3d9450ea1237fe24f468e54590deb11e75bee Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 30 Apr 2023 16:02:32 -0400 Subject: [PATCH] fish: Update config - Added opus function - Moved ex function to separate file --- fish/.config/fish/config.fish | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish index d26a2f85..67e32f90 100644 --- a/fish/.config/fish/config.fish +++ b/fish/.config/fish/config.fish @@ -52,9 +52,16 @@ function wav2flac echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" end -# Easily extract files and remove the archive -function ex - unar "$argv"; and rm -i "$argv" +# Convert wav/flac to opus +function opus + set ORIGINAL_SIZE (du -hs | cut -f1) + + fd -e wav -e flac -x ffmpeg -i "{}" -c:a libopus -b:a 128K -loglevel quiet -stats "{.}.opus" + fd -e wav -e flac -X rm -I + + set NEW_SIZE (du -hs | cut -f1) + + echo "Done. Reduced file size from $ORIGINAL_SIZE to $NEW_SIZE" end # Don't show ripgrep results for very long lines (e.g. minified files)