Syntax changes required by eyeD3 versions 0.7.0 and greater.
[clinton/abcde.git] / abcde
diff --git a/abcde b/abcde
index d0585f6..6b07ddd 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -433,8 +433,8 @@ getcddbinfo()
 gettracknum()
 {
        if [ -n "$STARTTRACKNUMBER" ] ; then
-               # Get the trackpadding from the current track
-               CURRENTTRACKPADDING=$(echo -n $UTRACKNUM | wc -c)
+               # Get the trackpadding from the current track, also trim whitespace for MacOSX
+               CURRENTTRACKPADDING=$(echo -n $UTRACKNUM | wc -c | tr -d ' ')
                TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - $FIRSTTRACK ))
        else
                TRACKNUM=${UTRACKNUM}
@@ -827,13 +827,17 @@ do_tag ()
                                eyed3)
                                        # FIXME # track numbers in mp3 come with 1/10, so we cannot
                                        # happily substitute them with $TRACKNUM
+                                       # FIXME as well! # Older versions of eyeD3 (< 0.7.0) expect
+                                       # --set-encoding and --set-text-frame so perhaps some version 
+                                       # sniffing would be useful. Might also be better to simply cut 
+                                       # ties with the older eyeD3... Andrew.
                                        run_command tagtrack-$OUTPUT-$1 nice $ENCNICE $TAGGER $TAGGEROPTS \
                                                --comment=::"$COMMENTOUTPUT" -A "$DALBUM" \
                                                -a "$TRACKARTIST" -t "$TRACKNAME" -Y "$CDYEAR" \
                                                -G "$GENREID" -n "${TRACKNUM:-$1}" \
                                                ${TRACKNUM:+-N "$TRACKS"} \
-                                               ${ENCODING:+--set-encoding="$ENCODING"} \
-                                               ${TPE2:+--set-text-frame=TPE2:"$TPE2"} \
+                                               ${ENCODING:+--encoding="$ENCODING"} \
+                                               ${TPE2:+--text-frame=TPE2:"$TPE2"} \
                                                "$ABCDETEMPDIR/track$1.$OUTPUT"
                                        ;;
                                # FIXME # Still not activated...
@@ -1750,7 +1754,7 @@ abcde.mkcue () {
        shift 2
 
        echo REM DISCID $DISCID
-       echo FILE \""$CUEWAVEFILE"\" WAVE
+       echo FILE \""$CUEWAVFILE"\" WAVE
 
        if [ $1 -ne 150 ] && [ $MODE = "PREGAP" ] ; then
                OFFSET=$1
@@ -3310,7 +3314,10 @@ MPCENCOPTS=
 AACENCOPTS=
 
 ID3OPTS=
-EYED3OPTS="--set-encoding=utf16-LE"
+# FIXME # Older versions of eyeD3 (< 0.7.0) expect --set-encoding=utf16-LE
+# so perhaps some version sniffing would be useful. Or perhaps it might be
+# better to simply cut ties with the older eyeD3... Andrew.
+EYED3OPTS="--encoding utf16"
 CDPARANOIAOPTS=
 CDDA2WAVOPTS=
 DAGRABOPTS=
@@ -3361,6 +3368,8 @@ elif [ X$(uname) = "XDarwin" ] ; then
        # We should have diskutil in OSX, but let's be sure...
        NEEDDISKUTIL=y
        CDROMREADERSYNTAX=cddafs
+       # We won't find the eject program in OSX, and doing checkexec will fail further below...
+       unset EJECT
 elif [ X$(uname) = "XOpenBSD" ] ; then
        HTTPGET=wget
        MD5SUM=md5
@@ -4285,7 +4294,7 @@ post_read
 
 # We are now finished with the cdrom - it can be safely ejected. Note that
 # abcde will not have completed yet.
-if [ "$EJECTCD" = "y" ] && [ -x $(which $EJECT) ]; then
+if [ "$EJECTCD" = "y" ]; then
        # We check if the disk we are processing is actually the disk inside the
        # CD tray. If not, we do not eject the CD, since it might be so that the
        # user ejected it manually.
@@ -4302,7 +4311,7 @@ if [ "$EJECTCD" = "y" ] && [ -x $(which $EJECT) ]; then
                $eject $EJECTOPTS $cd
        elif [ X"$(uname)" = X"Darwin" ] ; then
                diskutil eject ${CDROM#/dev/} 0
-       else
+    elif [ -x $(which $EJECT) ]; then
                $EJECT $EJECTOPTS "$CDROM"
        fi
        #fi