Fix encoding call for m4a. (Closes issue 31).
[clinton/abcde.git] / abcde
diff --git a/abcde b/abcde
index 33f7128..b8416cc 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -13,7 +13,7 @@
 #
 # $Id$
 
-VERSION='2.5.1-UNRELEASED'
+VERSION='2.5.3-UNRELEASED'
 
 usage ()
 {
@@ -43,11 +43,11 @@ echo "-j <#> Number of encoder processes to run at once (localhost)"
 echo "-k     Keep the wav tracks for later use"
 echo "-l     Use low disk space algorithm"
 echo "-L     Use local CDDB storage directory"
-echo "-n     No lookup. Don't query CDDB, just create and use template"
-echo "-N     Noninteractive. Never prompt for anything"
 echo "-m     Modify playlist to include CRLF endings, to comply with some players"
 #echo "       WARNING: Deprecated. Use \"cue\" action"
 #echo "-M     Create a CUE file"
+echo "-n     No lookup. Don't query CDDB, just create and use template"
+echo "-N     Noninteractive. Never prompt for anything"
 echo "-o <type1[,type2]...>"
 echo "       Output file type(s) (vorbis,mp3,flac,spx,mpc,wav,m4a). Defaults to vorbis"
 echo "-p     Pad track numbers with 0's (if less than 10 tracks)"
@@ -118,7 +118,7 @@ f_seq_line ()
                done
                echo
        else
-               log error "syntax error while processing track numbers"
+               log error "syntax error while processing track numbers ($i)"
                exit 1
        fi
 }
@@ -1027,7 +1027,7 @@ do_encode ()
                                TEMPARG="PIPE_$MPPENCODER"
                                ;;
                        m4a)
-                               TEMPARG="PIPE_$MPPENCODER"
+                               TEMPARG="PIPE_$AACENCODERSYNTAX"
                                ;;
                esac
                IN="$( eval echo "\$$TEMPARG" )"
@@ -1137,7 +1137,7 @@ do_encode ()
                                fi
                                # Tag the file at encode time, as it can't be done after encoding.
                                if [ "$DOTAG" = "y" ]; then
-                                       RUN_COMMAND nice $EFFECTIVE_NICE $SPEEXENCODER $SPEEXENCODEROPTS --author "$TRACKARTIST" --title "$TRACKNAME" ${COMMENT:+--comment "$COMMENT"} "$IN" "$OUT"
+                                       $RUN_COMMAND nice $EFFECTIVE_NICE $SPEEXENCODER $SPEEXENCODEROPTS --author "$TRACKARTIST" --title "$TRACKNAME" ${COMMENT:+--comment "$COMMENT"} "$IN" "$OUT"
                                else
                                        $RUN_COMMAND nice $EFFECTIVE_NICE $SPEEXENCODER $SPEEXENCODEROPTS "$IN" "$OUT"
                                fi
@@ -2272,7 +2272,7 @@ do_cdtext ()
        for TRACK in $(f_seq_row 1 $TRACKS)
        do
                TRACKM1=$(($TRACK - 1))
-               TITLE="$(grep -E ^Track\ +$TRACK: "$ABCDETEMPDIR/cd-text" | cut -c11- | tr -d \\r\\n)"
+               TITLE="$(grep -E ^Track\ +$TRACK: "$ABCDETEMPDIR/cd-text" | tr -d \\r\\n | sed 's~^Track ..: .~~g;'"s~'$~~g")"
                echo "$TRACK: $TITLE" >> "$ABCDETEMPDIR/cddbchoices"
                sed -i "s~^TTITLE${TRACKM1}=.*~TTITLE${TRACKM1}=${TITLE}~" $ABCDETEMPDIR/cddbread.1
        done
@@ -3520,7 +3520,8 @@ else
                # Range parsing code courtesy of Vincent Ho
                # Cleaned up to use shell built-ins by Charles Steinkuehler
                if [ "${1#*[^0-9-]}" != "$1" ]; then
-                       log error "syntax error while processing track numbers"
+                       log error "syntax error while processing track numbers ($1)"
+                       exit 1
                else
                        RSTART=${1%%-*}
                        REND=${1##*-}