albumtohandy - konvertiert flac to mp3 von einer Sammlung
SYNOPSIS
- albentohandy [-3] [-i <inputfile] [-m <destfolder] [-n} [-r] [-h]
+ albentohandy [-3] [-f] [-h] [-i <inputfile>] [-m <destfolder>] [-n] [-r]
+ [-w <workdir>]
OPTIONS
- -h show this help
-3 convert to mp3
+ -f convert to flac
+ -h show this help
-i <file> input Datei default=albumlist
-m <dest> kopiert das Arbeitsverzeichnis
in das angegeben Zielverzeichnis
--sshlogin $parallelopts FlacToMp3 {}
}
+PictureToFlac()
+{
+ local readonly workdir="$1"
+
+ for i in $(find $workdir -name '*.flac' | sort); do
+ metaflac \
+ --import-picture-from="3|image/jpeg|||${i%/*}/cover.jpg" $i
+ done
+}
+
MakeSymlinksToWork()
{
local readonly workdir="$1"
{
local exists=true
local programms=("vorbiscomment" "flac" "oggenc" "parallel" "lame" \
- "eyeD3")
+ "eyeD3" "metaflac")
for programm in $programms; do
if [ ! -f /usr/bin/$programm ]; then
parallelopts=":"
curphase=1
phase=3
+ flac=false
mp3=false
nocover=false
removework=false
ReadArguments()
{
- while getopts "3hi:m:nrw:" optname; do
+ while getopts "3fhi:m:nrw:" optname; do
case "$optname" in
"3")
mp3=true;
+ flac=false;
+ ;;
+ "f")
+ mp3=false;
+ flac=true;
;;
"h")
Usage
printf "create symlinks of flac's in %s\n" "$WORK"
MakeSymlinksToWork "$WORK" "$MUSICPATH" "$albumlist"
- if [ ! $mp3 == true ]; then
+ if [ $mp3 == false ] && [ $flac == false ]; then
printf "\nPhase %02d of %02d: flac -> ogg\n" \
$((curphase++)) $phase
ConvertCoverToMeta "$WORK" "$parallelopts"
ConvertFlacToOgg "$WORK" "$parallelopts"
- else
+ elif [ $mp3 == true ] && [ $flac == false ]; then
printf "\nPhase %02d of %02d: flac -> mp3\n" \
$((curphase++)) $phase
ConvertFlacToMp3 "$WORK" "$parallelopts"
+ elif [ $mp3 == false ] && [ $flac == true ]; then
+ printf "\nPhase %02d of %02d: flac -> mp3\n" \
+ $((curphase++)) $phase
+ PictureToFlac "$WORK"
fi
- printf "\nPhase %02d of %02d: " $((curphase++)) $phase
- printf "remove flac's\n\n"
- CleanupFlac "$WORK"
+ printf "\nPhase %02d of %02d: cleanup\n\n" $((curphase++)) $phase
+ if [ $flac == false ]; then
+ CleanupFlac "$WORK"
+ fi
CleanupCover "$WORK"
}