]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
add flac with cover
authorBastian Dehn <hhaalo@arcor.de>
Mon, 14 Jul 2025 14:42:22 +0000 (16:42 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 14 Jul 2025 14:42:22 +0000 (16:42 +0200)
albentohandy

index f8032a08e20c3c02b6a68c742842d007774edc83..f101f4106078a43ab89558430e9e5f7c99699d33 100755 (executable)
@@ -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"