]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change write vorbis picture metadata once
authorBastian Dehn <hhaalo@arcor.de>
Sun, 6 Sep 2026 07:23:55 +0000 (09:23 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 6 Sep 2026 07:23:55 +0000 (09:23 +0200)
libs/vorbis.sh

index 20b540c54e1d0b5eb72746a77a23d1170b7160bb..3da863685625ad45d0d0b43328198fdcae75bef0 100644 (file)
@@ -56,12 +56,11 @@ flac_to_vorbis()
 write_hex_to_file()
 {
        local number="$1"
-       local output="$2"
        local hex_number=
        hex_number=$(printf "%08x" "$number")
 
        for i in {0..6..2}; do
-               printf "%b" "\x${hex_number:$i:2}" >> "$output"
+               printf "%b" "\x${hex_number:$i:2}"
        done
 }
 
@@ -73,24 +72,26 @@ cover_to_metadata()
        filesize=$(wc --bytes "$input")
        filesize=${filesize/ */}
 
-       # picture typ (jpg)
-       write_hex_to_file "3" "$output"
-       # mime type (image/jpeg)
-       write_hex_to_file "10" "$output"
-       printf "%s" "image/jpeg" >> "$output"
-       # description length (zero)
-       write_hex_to_file "0" "$output"
-       # width (zero)
-       write_hex_to_file "0" "$output"
-       # heigth (zero)
-       write_hex_to_file "0" "$output"
-       # color depth (zero)
-       write_hex_to_file "0" "$output"
-       # color count (zero)
-       write_hex_to_file "0" "$output"
-       # file size
-       write_hex_to_file "$filesize" "$output"
-       cat "$input" >> "$output"
+       {
+               # picture typ (jpg)
+               write_hex_to_file "3"
+               # mime type (image/jpeg)
+               write_hex_to_file "10"
+               printf "%s" "image/jpeg"
+               # description length (zero)
+               write_hex_to_file "0"
+               # width (zero)
+               write_hex_to_file "0"
+               # heigth (zero)
+               write_hex_to_file "0"
+               # color depth (zero)
+               write_hex_to_file "0"
+               # color count (zero)
+               write_hex_to_file "0"
+               # file size
+               write_hex_to_file "$filesize"
+               cat "$input"
+       } > "$output"
 }
 
 convert_flac_to_ogg()