From: Bastian Dehn Date: Sat, 4 Jun 2022 18:55:44 +0000 (+0200) Subject: change: fix and parallel flac replay gain apply X-Git-Tag: v1.0.0^2~56 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=0d56c61781f9fe021e0f7a57e49dd4d5a60e2b9f;p=albentohandy.git change: fix and parallel flac replay gain apply --- diff --git a/albentohandy b/albentohandy index cedc7b8..c27aff8 100755 --- a/albentohandy +++ b/albentohandy @@ -142,18 +142,35 @@ ConvertFlacToOpus() | parallel --will-cite --ungroup --eta --progress FlacToOpus {} } +ReEncodeFlac() +{ + local readonly INPUTFILE="$1" + + metaflac --export-tags-to=- $INPUTFILE \ + | sed '/REPLAYGAIN/d' > $INPUTFILE-meta + + nice --adjustment=10 flac --totally-silent --stdout --decode \ + $replaygainapply $INPUTFILE \ + | flac --silent --output-name=$INPUTFILE-tmp - + + metaflac --import-tags-from=$INPUTFILE-meta $INPUTFILE-tmp + + rm $INPUTFILE-meta + mv $INPUTFILE-tmp $INPUTFILE +} + FlacApplyReplayGain() { local readonly WORKDIR="$1" if [ -n "$replaygainapply" ]; then - for i in $(find $WORKDIR -name '*.flac' | sort); do - nice --adjustment=10 flac --totally-silent \ - $replaygainapply --output-name=$i-tmp $i - metaflac --remove-replay-gain $i-tmp - mv $i-tmp $i - done + declare -xf ReEncodeFlac + find $WORKDIR -name *.flac \ + | sort \ + | parallel --will-cite --ungroup --eta --progress \ + ReEncodeFlac {} fi + } PictureToFlac()