Fix Hyphen/Minus signs in manpage.
[abcde.git] / abcde
diff --git a/abcde b/abcde
index 7585109..4ab5d00 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -13,7 +13,7 @@
 #
 # $Id$
 
-VERSION='2.3.99.8'
+VERSION='2.4'
 
 usage ()
 {
@@ -496,7 +496,7 @@ makeids ()
 do_replaygain()
 {
        if checkstatus replaygain; then :; else
-               run_command "" echo "Adding replygain information..."
+               run_command "" echo "Adding replaygain information..."
                for TMPOUTPUT in $( echo $OUTPUTTYPE | tr , \ )
                do
                        case $TMPOUTPUT in
@@ -548,7 +548,7 @@ do_replaygain()
                                        run_command replaygain-vorbis nice $ENCNICE $VORBISGAIN --album "${OUTPUTFILES[@]}"
                                        ;;
                                mp3)
-                                       run_command replaygain-mp3 nice $ENCNICE $MP3GAIN -a "${OUTPUTFILES[@]}"
+                                       run_command replaygain-mp3 nice $ENCNICE $MP3GAIN -a -k "${OUTPUTFILES[@]}"
                                        ;;
                                mpc)
                                        run_command replaygain-mpc nice $ENCNICE $MPPGAIN --auto "${OUTPUTFILES[@]}"
@@ -799,6 +799,11 @@ do_tag ()
                mp3)
                        # id3v2 v0.1.9 claims to have solved the -c bug, so we merge both id3 and id3v2
                        GENREID=$(do_getgenreid "${CDGENRE}")
+                       # Set TPE2 in case we have a Various Artists rip.
+                       TPE2=""
+                       if [ "$VARIOUSARTISTS" = "y" ]; then
+                               TPE2="Various"
+                       fi
        
                        case "$ID3SYNTAX" in
                                id3);;
@@ -811,6 +816,7 @@ do_tag ()
                                                -G "$GENREID" -n "${TRACKNUM:-$1}" \
                                                "${TRACKNUM:+-N $TRACKS}" \
                                                "${ENCODING:+--set-encoding=$ENCODING}" \
+                                               "${TPE2:+--set-user-text-frame=TPE2:$TPE2}" \
                                                "$ABCDETEMPDIR/track$1.$OUTPUT"
                                        ;;
                                # FIXME # Still not activated...
@@ -828,7 +834,8 @@ do_tag ()
                                                $TAGGER $TAGGEROPTS -c "$COMMENTOUTPUT" \
                                                -A "$DALBUM" -a "$TRACKARTIST" -t "$TRACKNAME" \
                                                -y "$CDYEAR" -g "$GENREID" \
-                                               -T "${TRACKNUM:-$1/$TRACKS}" \
+                                               -T "${TRACKNUM:-$1}/$TRACKS" \
+                                               "${TPE2:+--TPE2 \"$TPE2\"}" \
                                                "$ABCDETEMPDIR/track$1.$OUTPUT"
                                        ;;
                        esac
@@ -1672,7 +1679,7 @@ abcde.mkcue () {
     echo REM DISCID $DISCID
     echo FILE \"dummy.wav\" WAVE
 
-    if [ $1 -ne 150 ] && [ $MODE = "PREGAP"] ; then
+    if [ $1 -ne 150 ] && [ $MODE = "PREGAP" ] ; then
         OFFSET=$1
     else
         OFFSET=150
@@ -2708,7 +2715,7 @@ do_cdread ()
                # FIXME # Add the possibility of grabbing ranges of tracks in onetrack
                # FIXME # Until then, we grab the whole CD in one track, no matter what
                # the user said
-               # We need the first and last track for cdda2wav
+               # We need the first and last track for cdda2wav/icedax
                FIRSTTRACK=$2
                LASTTRACK=$(expr $3 + 0)
                UTRACKNUM=$FIRSTTRACK
@@ -2718,7 +2725,7 @@ do_cdread ()
                                #XX FIXME XX
                                # Add a variable to check if tracks are provided in command line and if not, use "0-" to rip the tracks
                                READTRACKNUMS="$FIRSTTRACK-$LASTTRACK" ;;
-                       cdda2wav) READTRACKNUMS="$FIRSTTRACK+$LASTTRACK" ;;
+                       cdda2wav | icedax) READTRACKNUMS="$FIRSTTRACK+$LASTTRACK" ;;
                        *) echo "abcde error: $CDROMREADERSYNTAX does not support ONETRACK mode"
                                exit 1 ;;
                esac
@@ -2729,7 +2736,7 @@ do_cdread ()
        if [ "$USEPIPES" = "y" ]; then
                TEMPARG="PIPERIPPER_$CDROMREADERSYNTAX"
                FILEARG="$( eval echo "\$$TEMPARG" )"
-               REDIR=""
+               REDIR="y"
                PIPE_MESSAGE="and encoding "
        else
                WAVDATA="$ABCDETEMPDIR/track$UTRACKNUM.wav"
@@ -2745,7 +2752,7 @@ do_cdread ()
                                FILEARG="$WAVDATA"
                                ;;
                esac
-               REDIR=">&2"
+               REDIR="n"
        fi
        if [ "$1" = "onetrack" ]; then
                echo "Grabbing ${PIPE_MESSAGE}tracks $UTRACKNUM - $LASTTRACK as one track ..." >&2
@@ -2765,12 +2772,17 @@ do_cdread ()
                        STRIPTRACKNUM=$(expr $UTRACKNUM + 0)
                        nice $READNICE $FLAC -d -f --cue=${READTRACKNUMS:-$STRIPTRACKNUM.1-$(($STRIPTRACKNUM + 1)).0} "$FILEARG" "$CDROM" ;;
                cdparanoia) 
-                       nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" $REDIR ;;
-               cdda2wav)
+                   if [ "$REDIR" = "y" ]; then
+                           nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" >&2
+                       else
+                           nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG"
+                       fi;;
+
+               cdda2wav | icedax)
                        if [ "$OSFLAVOUR" = "OSX" ] ; then
-                               # Hei, we have to unmount the device before running anything like cdda2wav in OSX
+                               # Hei, we have to unmount the device before running anything like cdda2wav/icedax in OSX
                                disktool -u ${CDROM#/dev/} 0
-                               # Also, in OSX the cdrom device for cdda2wav changes...
+                               # Also, in OSX the cdrom device for cdda2wav/icedax changes...
                                CDDA2WAVCDROM="IODVDServices"
                        elif [ "$OSFLAVOUR" = "FBSD" ] ; then
                                CDDA2WAVCDROM="$CDROMID"
@@ -2781,12 +2793,19 @@ do_cdread ()
                                        CDDA2WAVCDROM="$CDROMID"
                                fi
                        fi
-                       nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" $REDIR
-                       ;;
+                   if [ "$REDIR" = "y" ]; then
+                               nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG" >&2
+                   else
+                               nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t ${READTRACKNUMS:-$UTRACKNUM} "$FILEARG"
+                       fi ;;
                ## FIXME ## We have an exception for dagrab, since it uses -f
                ## FIXME ## Shall we just use -f $FILEARG ??
-               dagrab) nice $READNICE $CDROMREADER -d "$CDROM" -v $UTRACKNUM "$FILEARG" $REDIR
-                       ;;
+               dagrab) 
+                   if [ "$REDIR" = "y" ]; then
+                               nice $READNICE $CDROMREADER -d "$CDROM" -v $UTRACKNUM "$FILEARG" >&2
+                       else
+                               nice $READNICE $CDROMREADER -d "$CDROM" -v $UTRACKNUM "$FILEARG"
+                       fi ;;
                cddafs)
                        # Find the track's mounted path
                        REALTRACKNUM=$(expr $UTRACKNUM + 0)
@@ -2794,12 +2813,20 @@ do_cdread ()
                        FILEPATH=$(find "$FILEPATH" | grep "/$REALTRACKNUM ");
                        # If the file exists, copy it
                        if [ -e "$FILEPATH" ] ; then
-                               nice $READNICE $CDROMREADER "$FILEPATH" "$FILEARG" $REDIR
+                       if [ "$REDIR" = "y" ]; then
+                                       nice $READNICE $CDROMREADER "$FILEPATH" "$FILEARG" >&2
+                               else
+                                       nice $READNICE $CDROMREADER "$FILEPATH" "$FILEARG"
+                               fi
                        else
                                false
                        fi ;;
-               debug) nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" -w $UTRACKNUM-[:1] "$FILEARG" $REDIR
-                       ;;
+               debug)
+                   if [ "$REDIR" = "y" ]; then
+                               nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" -w $UTRACKNUM-[:1] "$FILEARG" >&2
+                       else
+                               nice $READNICE $CDROMREADER -$CDPARANOIACDROMBUS "$CDROM" -w $UTRACKNUM-[:1] "$FILEARG"
+                       fi ;;
        esac
        RETURN=$?
        # If we get some error or we get some missing wav 
@@ -2963,7 +2990,7 @@ NOGAP=n
 BATCHNORM=n
 NOCDDBQUERY=n
 
-# If using scsi devices, cdda2wav needs a CDROMID, instead of a device node
+# If using scsi devices, cdda2wav/icedax needs a CDROMID, instead of a device node
 # i.e. CDROMID="1,0,0"
 CDROMID=""
 # If we are using the IDE bus, we need CDPARANOIACDROMBUS defined as "d"
@@ -2999,7 +3026,7 @@ METAFLAC=metaflac
 AACTAG=faac
 
 CDPARANOIA=cdparanoia
-CDDA2WAV=cdda2wav
+CDDA2WAV=icedax
 DAGRAB=dagrab
 CDDAFS=cp
 CDDISCID=cd-discid
@@ -3068,7 +3095,7 @@ ACTIONS=cddb,read,encode,tag,move,clean
 DEFAULT_OUTPUT_BINARIES=vorbis:oggenc,flac:flac,mp3:toolame,mp3:lame,mp3:bladeenc,spx:speex,m4a:faac
 
 # List of prefered cdromreaders - by default, run whichever we have in the path
-DEFAULT_CDROMREADERS="cdparanoia cdda2wav"
+DEFAULT_CDROMREADERS="cdparanoia icedax cdda2wav"
 
 # List of quality levels associated with the encoders:
 DEFAULT_QUALITY_XLO="oggenc:-q -1,lame:-q 9,speex:--quality 1,m4a:"
@@ -3281,7 +3308,7 @@ if [ "$ONETRACK" = "y" ]; then
        case "$CDROMREADERSYNTAX" in
                flac) ;;
                cdparanoia) ;;
-               cdda2wav) ;;
+               cdda2wav | icedax) ;;
                *) log error "$CDROMREADERSYNTAX does not support ONETRACK mode"
                   exit 1 ;;
        esac
@@ -3369,7 +3396,7 @@ done
 
 # At this point a CDROM has to be defined, so we check it exists.
 if [ X"$CDROM" != "X" ] ; then 
-       if [ "$CDROMREADERSYNTAX" = "cdda2wav" ] && [ "$NEEDCDROMID" = "y" ] ; then
+       if ( [ "$CDROMREADERSYNTAX" = "cdda2wav" ] || [ "$CDROMREADERSYNTAX" = "icedax" ] ) && [ "$NEEDCDROMID" = "y" ] ; then
                if [ "$OSFLAVOUR" = "FBSD" ]; then
                        if echo "$CDROMID" | grep "^[0-9],[0-9],[0-9]$" >/dev/null 2>&1 ; then :; else
                                log error "CDROMID not in the right format for $CDROMREADERSYNTAX"
@@ -3467,7 +3494,7 @@ case "$CDROMREADERSYNTAX" in
                CDROMREADER="$CDPARANOIA"
                CDROMREADEROPTS="$CDPARANOIAOPTS"
                ;;
-       cdda2wav)
+       cdda2wav | icedax)
                CDROMREADER="$CDDA2WAV"
                CDROMREADEROPTS="$CDDA2WAVOPTS"
                ;;