]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add: encode flac with apply replaygain option
authorBastian Dehn <hhaalo@arcor.de>
Sat, 4 Jun 2022 17:03:32 +0000 (19:03 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 4 Jun 2022 17:03:32 +0000 (19:03 +0200)
albentohandy

index 77006c36b25892b9859a13f5b473b3cba92499eb..cedc7b8e16b698fa52fdc41a559c6da34182c7f3 100755 (executable)
@@ -142,6 +142,20 @@ ConvertFlacToOpus()
                | parallel --will-cite --ungroup --eta --progress FlacToOpus {}
 }
 
+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
+       fi
+}
+
 PictureToFlac()
 {
        local readonly WORKDIR="$1"
@@ -413,6 +427,7 @@ ConvertProcess()
        elif [ $flac == true ]; then
                printf "\nPhase %02d of %02d: flac -> flac with cover\n" \
                        $((curphase++)) $phase
+               FlacApplyReplayGain "$WORK"
                PictureToFlac "$WORK"
        elif [ $opus == true ]; then
                printf "\nPhase %02d of %02d: flac -> opus\n" \