From f08909e53f95fc37a4cfd14d194a27ef065af3df Mon Sep 17 00:00:00 2001 From: lub Date: Sat, 26 Jun 2021 14:45:20 +0200 Subject: [PATCH] add m4a and check if target file already exists --- dotfiles/bin/.bin/compress-music | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dotfiles/bin/.bin/compress-music b/dotfiles/bin/.bin/compress-music index 53fc5da..f9b969d 100755 --- a/dotfiles/bin/.bin/compress-music +++ b/dotfiles/bin/.bin/compress-music @@ -14,10 +14,10 @@ cd "$source" find . -type d -exec mkdir -p "$destination/{}" \; # copy existing files -find . -type f -and \( -name '*.mp3' -or -name '*.ogg' -or -name '*.opus' \) -exec cp -a --reflink=always "{}" "$destination/{}" \; +find . -type f -and \( -name '*.mp3' -or -name '*.m4a' -or -name '*.ogg' -or -name '*.opus' \) -exec cp -a --reflink=always "{}" "$destination/{}" \; # set +e because ffmpeg errors on .jpg, .txt, etc. set +e # compress with opus -find . -type f -not -name '*.mp3' -not -name '*.ogg' -not -name '*.opus' | parallel --jobs $(($(nproc) - 1)) --eta --progress 'nice -n19 opusenc --bitrate 128 --music ""{}"" ""$destination/{.}.opus""' +find . -type f -not -name '*.mp3' -not -name '*.m4a' -not -name '*.ogg' -not -name '*.opus' | parallel --jobs $(($(nproc) - 1)) --eta --progress 'test -f ""$destination/{.}.opus"" || nice -n19 opusenc --bitrate 128 --music ""{}"" ""$destination/{.}.opus""' #set -e