From fde4be2940b8fedfea255df945bc9acd3f98d309 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Mon, 14 Jul 2025 16:42:22 +0200 Subject: [PATCH] add flac with cover --- albentohandy | 52 +++++++++++++--------------------------------------- 1 file changed, 13 insertions(+), 39 deletions(-) diff --git a/albentohandy b/albentohandy index f8032a0..f101f41 100755 --- a/albentohandy +++ b/albentohandy @@ -156,51 +156,22 @@ ConvertFlacToOpus() } #### END OPUS #### -#### BEGIN FLAC REENCODE #### +#### BEGIN FLAC #### -ReEncodeFlac() +picture_to_flac() { - local readonly INPUTFILE="$1" - - metaflac --export-tags-to=- $INPUTFILE \ - | sed '/REPLAYGAIN/d' > $INPUTFILE-meta - - nice --adjustment=10 flac --totally-silent --stdout --decode \ - $replaygainapply $INPUTFILE \ - | nice --adjustment=15 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 - declare -xf ReEncodeFlac - find $WORKDIR -name *.flac \ - | sort \ - | parallel --will-cite --ungroup --eta --progress \ - ReEncodeFlac {} - fi - -} - -PictureToFlac() -{ - local readonly WORKDIR="$1" + local workdir="$1" + local flacfiles="$(find $workdir -name '*.flac' | sort)" - for i in $(find $WORKDIR -name '*.flac' | sort); do + local file= + for file in $flacfiles; do metaflac \ - --import-picture-from="3|image/jpeg|||${i%/*}/cover.jpg" $i + --import-picture-from="3|image/jpeg|||${file%/*}/cover.jpg" \ + $file done } -#### END FLAC REENCODE #### +#### END FLAC #### #### BEGIN VORBIS #### read_flac_to_ogg_tags() @@ -434,7 +405,10 @@ convert_process() case "$format" in "mp3") ;; - "flac") ;; + "flac") + picture_to_flac "$workdir" + cleanup_cover "$workdir" + ;; "opus") ;; *) convert_cover_to_metadata "$workdir" -- 2.47.3