From 9081d4f1c6690534b4d783ef08b725a7bf1d4c5c Mon Sep 17 00:00:00 2001 From: lub Date: Sat, 17 Nov 2018 23:40:46 +0100 Subject: [PATCH] fix find filters --- compress-music.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compress-music.sh b/compress-music.sh index a6da9db..4dfa546 100755 --- a/compress-music.sh +++ b/compress-music.sh @@ -14,12 +14,10 @@ cd "$source" find . -type d -exec mkdir -p "$destination/{}" \; # copy existing files -find . -type f -name '*.mp3' -exec cp --reflink=always "{}" "$destination/{}" \; -find . -type f -name '*.m4a' -exec cp --reflink=always "{}" "$destination/{}" \; -find . -type f -name '*.ogg' -exec cp --reflink=always "{}" "$destination/{}" \; +find . -type f -and \( -name '*.mp3' -or -name '*.ogg' -or -name '*.m4a' -or -name '*.opus' \) -exec cp --reflink=always "{}" "$destination/{}" \; # set +e because ffmpeg errors on .jpg, .txt, etc. # compress with mp3 set +e -find . -type f | parallel --eta --progress 'ffmpeg -v 0 -n -i ""{}"" -c:a mp3 -b:a 320 -map_metadata 0 ""$destination/{.}.mp3""' +find . -type f -not -name '*.mp3' -not -name '*.ogg' -not -name '*.m4a' -not -name '*.opus' | parallel --eta --progress 'ffmpeg -v 0 -n -i ""{}"" -c:a mp3 -b:a 320 -map_metadata 0 ""$destination/{.}.mp3""' #set -e