]> gitweb.hhaalo.de Git - albentohandy.git/commitdiff
replaygain tagging; symlink instead of copy
authorBastian Dehn <hhaalo@arcor.de>
Tue, 14 Jun 2016 18:50:26 +0000 (20:50 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 27 Jun 2016 18:08:37 +0000 (20:08 +0200)
add: replaygain tagging
add: option -S parallel cluster
change: symlink instead of copy
change: short status; remove verbose
remove: mp3gainalbum.sh

albentohandy.sh
flactomp3v2.sh
mp3gainalbum.sh [deleted file]

index 28e293bd578c5d48a05327561695e6f963ff6956..c32eba12397cb42e2c7b25d0a05fcdb7632fb0ea 100755 (executable)
@@ -1,8 +1,12 @@
 #!/bin/bash
 
+# work is a directory do symlinked original and convert
 work="$(pwd)/handy"
+# scriptpath is the path to flactomp3v2.sh script
 scriptpath="/media/smbdaten1/scripts"
+# musicpath is collection directory
 musicpath="/media/smbdaten1/musik-flac"
+parallelopts=":"
 
 if [ ! -f albumlist ]
 then
@@ -12,34 +16,37 @@ then
        exit
 fi
 
+while getopts "S:" optname
+do
+       case "$optname" in
+       "S")
+               parallelopts="$OPTARG"
+               ;;
+       *)
+               parallelopts=":"
+               ;;
+       esac
+done
+
 echo
-echo "Phase 01 von 04: flac's in das Arbeitsverzeichnis $work kopieren"
-echo
+echo "Phase 01 von 03: flac's in das Arbeitsverzeichnis $work verlinken"
 
 if [ ! -d $work ]
 then
        mkdir $work
 fi
 
-anzahl=$(cat albumlist | wc -l)
+# make symlinks of original flac's
 for i in $(cat albumlist)
 do
-       z=$(($z+1))
-       rsync -av $musicpath/$i $work/
-       echo
-       echo "Phase 01: $((100*$z/$anzahl))% fertig"
-       echo
+       cp -rs $musicpath/$i $work/
 done
 
-echo "Phase 02 von 04: flac -> mp3"
-echo
-find $work -name '*.flac' | sort | parallel $scriptpath/flactomp3v2.sh {}
-echo
-echo "Phase 03 von 04: flac's und cover's loeschen"
 echo
-find $work -name '*.flac' | sort | xargs rm -v
-find $work -name 'cover*' | sort | xargs rm -v
+echo "Phase 02 von 03: flac -> mp3"
+find $work -name '*.flac' | sort | parallel --eta --progress --noswap -S $parallelopts $scriptpath/flactomp3v2.sh {}
 echo
-echo "Phase 04 von 04: replaygain hinzufuegen" 
+echo "Phase 03 von 03: flac's und cover's loeschen"
 echo
-$scriptpath/mp3gainalbum.sh $work
+find $work -name '*.flac' | sort | xargs rm
+find $work -name 'cover*' | sort | xargs rm
index 55cf105aac0f1226efb2aa86c1a3c4aa51c30a01..b0512585d9ab594f8a00f49602d26aca425ee6cf 100755 (executable)
@@ -11,21 +11,40 @@ ALBUM=$(metaflac "$a" --show-tag=ALBUM | sed s/.*=//g)
 GENRE=$(metaflac "$a" --show-tag=GENRE | sed s/.*=//g)
 TRACKNUMBER=$(metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g)
 DATE=$(metaflac "$a" --show-tag=DATE | sed s/.*=//g)
+RRL=$(metaflac "$a" --show-tag=REPLAYGAIN_REFERENCE_LOUDNESS | sed s/.*=//g)
+RTG=$(metaflac "$a" --show-tag=REPLAYGAIN_TRACK_GAIN | sed s/.*=//g)
+RTP=$(metaflac "$a" --show-tag=REPLAYGAIN_TRACK_PEAK | sed s/.*=//g)
+RAG=$(metaflac "$a" --show-tag=REPLAYGAIN_ALBUM_GAIN | sed s/.*=//g)
+RAP=$(metaflac "$a" --show-tag=REPLAYGAIN_ALBUM_PEAK | sed s/.*=//g)
 
 # stream flac into the lame encoder
-# tag-v2
-flac -s -c -d "$a" | lame --silent -b 192 -m j --id3v2-only --pad-id3v2 --ignore-tag-errors \
---ta "$ARTIST" --tt "$TITLE" --tl "$ALBUM" --tg "${GENRE:-12}" \
---tn "${TRACKNUMBER:-0}" --ty "$DATE" - "$OUTF"
+flac -s -c -d "$a" | lame --silent -b 192 -m j --noreplaygain - "$OUTF"
 
-if [ -f ${a%/*}/cover.jpeg ]
+# ID3v2.3 tagging
+if [ -f ${a%/*}/cover.jpg ]
 then
-        eyeD3 --to-v2.3 --add-image ${a%/*}/cover.jpeg:FRONT_COVER --no-tagging-time-frame $OUTF > /dev/null 2>&1
+       eyeD3 --to-v2.3 \
+-a "$ARTIST" -t "$TITLE" -A "$ALBUM" -G "${GENRE:-12}" \
+-n "${TRACKNUMBER:-0}" -Y "$DATE" \
+--set-user-text-frame="REPLAYGAIN_REFERENCE_LOUDNESS:$RRL" \
+--set-user-text-frame="REPLAYGAIN_TRACK_GAIN:$RTG" \
+--set-user-text-frame="REPLAYGAIN_TRACK_PEAK:$RTP" \
+--set-user-text-frame="REPLAYGAIN_ALBUM_GAIN:$RAG" \
+--set-user-text-frame="REPLAYGAIN_ALBUM_PEAK:$RAP" \
+--add-image ${a%/*}/cover.jpg:FRONT_COVER \
+--no-tagging-time-frame \
+$OUTF > /dev/null 2>&1
 else
-        if [ -f ${a%/*}/cover.jpg ]
-        then
-                eyeD3 --to-v2.3 --add-image ${a%/*}/cover.jpg:FRONT_COVER --no-tagging-time-frame $OUTF > /dev/null 2>&1
-        fi  
+       eyeD3 --to-v2.3 \
+-a "$ARTIST" -t "$TITLE" -A "$ALBUM" -G "${GENRE:-12}" \
+-n "${TRACKNUMBER:-0}" -Y "$DATE" \
+--set-user-text-frame="REPLAYGAIN_REFERENCE_LOUDNESS:$RRL" \
+--set-user-text-frame="REPLAYGAIN_TRACK_GAIN:$RTG" \
+--set-user-text-frame="REPLAYGAIN_TRACK_PEAK:$RTP" \
+--set-user-text-frame="REPLAYGAIN_ALBUM_GAIN:$RAG" \
+--set-user-text-frame="REPLAYGAIN_ALBUM_PEAK:$RAP" \
+--no-tagging-time-frame \
+$OUTF > /dev/null 2>&1
 fi
 
-echo "$a -> $OUTF"
+exit 0
diff --git a/mp3gainalbum.sh b/mp3gainalbum.sh
deleted file mode 100755 (executable)
index 1a63cf8..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-pfad=$1
-
-tmp=""
-
-suchverz()
-{
-       for i in $(find $pfad -name '*.mp3' | sort)
-       do
-               if [ ! "$tmp" == "${i%/*}" ]
-               then
-                       tmp=${i%/*}
-                       echo $tmp
-               fi
-       done
-}
-
-suchverz | parallel mp3gain -o {}/*.mp3