--sshlogin $parallelopts $scriptdir/flactovorbis {}
}
+ConvertCoverToMeta()
+{
+ local readonly workdir="$1"
+ local readonly parallelopts="$2"
+ local readonly scriptdir="$3"
+
+ find $workdir -name '*.jpg' \
+ | sort \
+ | parallel --will-cite --ungroup \
+ --sshlogin $parallelopts $scriptdir/covertometa {}
+}
+
CleanupFlac()
{
local readonly workdir="$1"
find $workdir -name '*.flac' -exec rm {} \;
}
+CleanupCover()
+{
+ local readonly wordir="$1"
+
+ find $workdir -name 'cover.txt' -exec rm {} \;
+}
+
CleanupWorkDir()
{
local readonly workdir="$1"
MakeSymlinksToWork "$WORK" "$MUSICPATH" "$albumlist"
printf "\nPhase %02d of %02d: flac -> ogg\n" $((curphase++)) $phase
+ ConvertCoverToMeta "$WORK" "$parallelopts" "$SCRIPTPATH"
ConvertFlacToOgg "$WORK" "$parallelopts" "$SCRIPTPATH"
printf "\nPhase %02d of %02d: " $((curphase++)) $phase
printf "remove flac's\n\n"
CleanupFlac "$WORK"
+ CleanupCover "$WORK"
}
AdvancedFeatures()
--- /dev/null
+#!/bin/bash
+
+main()
+{
+ local readonly INPUTFILE="$1"
+ local readonly OUTPUTFILE="${INPUTFILE/%.jpg/.txt}"
+
+ # Picture Typ
+ printf "0: %.8x" 3 | xxd -r -g0 > $OUTPUTFILE
+ # Mime type
+ printf "0: %.8x" $(printf "image/jpeg" | wc -c) \
+ | xxd -r -g0 >> $OUTPUTFILE
+ printf "image/jpeg" >> $OUTPUTFILE
+ # Description
+ printf "0: %.8x" 0 | xxd -r -g0 >> $OUTPUTFILE
+ # Width
+ printf "0: %.8x" 0 | xxd -r -g0 >> $OUTPUTFILE
+ # Heigth
+ printf "0: %.8x" 0 | xxd -r -g0 >> $OUTPUTFILE
+ # Color depth
+ printf "0: %.8x" 0 | xxd -r -g0 >> $OUTPUTFILE
+ # Color Count
+ printf "0: %.8x" 0 | xxd -r -g0 >> $OUTPUTFILE
+ # File Size
+ printf "0: %.8x" $(wc -c "$INPUTFILE" \
+ | cut --delimiter=' ' --fields=1) \
+ | xxd -r -g0 >> $OUTPUTFILE
+ cat $INPUTFILE >> $OUTPUTFILE
+}
+
+main $*
+exit 0
{
local readonly INPUTFILE="$1"
local readonly OUTPUFILE="$2"
+ local readonly COVERFILE="${INPUTFILE%/*}/cover.txt"
metaflac --export-tags-to=- $INPUTFILE \
| vorbiscomment --commentfile - --write $OUTPUTFILE
+ if [ -f $COVERFILE ]; then
+ echo "METADATA_BLOCK_PICTURE=$(base64 --wrap 0 $COVERFILE)" \
+ | vorbiscomment --commentfile - --raw --append $OUTPUTFILE
+ fi
}
EncodingFlacToOgg()