]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
change vorbis cover without xxd
authorBastian Dehn <hhaalo@arcor.de>
Fri, 18 Jul 2025 09:31:22 +0000 (11:31 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 18 Jul 2025 09:31:22 +0000 (11:31 +0200)
albentohandy
libs/voribs.sh

index fc9a202493f1d15ccde3727c092a2bf092faf9b4..4ffd45575a336aea4cbeabc9682f52cc8b15b4f8 100755 (executable)
@@ -149,9 +149,6 @@ check_programms()
        command -v rsync > /dev/null \
                || errlog "command rsync not found" \
                || return $?
-       command -v xxd > /dev/null \
-               || errlog "command xxd not found" \
-               || return $?
 }
 
 convert_process()
index 9b1579edd9274c2197b5459dc2478a1ba77b8d6b..e2295dcd7391f7ea956b5435266b06696bd8b052 100644 (file)
@@ -38,6 +38,8 @@ cover_to_metadata()
 {
        local inputfile="$1"
        local outputfile="${inputfile/.jpg/.txt}"
+       local filesize=$(cat $inputfile | wc -c)
+       local filesizehex=$(printf "%08x" "$filesize")
 
        # picture typ (jpg)
        printf "%b" "\x0\x0\x0\x3" > $outputfile
@@ -54,8 +56,9 @@ cover_to_metadata()
        # Color Count (zero)
        printf "%b" "\x0\x0\x0\x0" >> $outputfile
        # File Size
-       printf "0: %.8x" $(cat $inputfile | wc -c) \
-               | xxd -r -g4 >> $outputfile
+       for i in {0..6..2}; do
+               printf "%b" "\x${filesizehex:$i:2}" >> $outputfile
+       done
        cat $inputfile >> $outputfile
 }