Removal of some problematic whitespace generated on MacOSX.
[clinton/abcde.git] / abcde
diff --git a/abcde b/abcde
index f9ea19f..ababbd3 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -51,7 +51,7 @@ echo "-m     Modify playlist to include CRLF endings, to comply with some player
 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 "-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 "       Output file type(s) (vorbis,mp3,flac,spx,mpc,wav,m4a,opus). Defaults to vorbis"
 echo "-p     Pad track numbers with 0's (if less than 10 tracks)"
 echo "-P     Use UNIX pipes to read+encode without wav files"
 echo "-q <level>"
 echo "-p     Pad track numbers with 0's (if less than 10 tracks)"
 echo "-P     Use UNIX pipes to read+encode without wav files"
 echo "-q <level>"
@@ -433,8 +433,8 @@ getcddbinfo()
 gettracknum()
 {
        if [ -n "$STARTTRACKNUMBER" ] ; then
 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}
                TRACKNUM=$( printf %0.${CURRENTTRACKPADDING}d $(expr ${UTRACKNUM} + ${STARTTRACKNUMBER} - $FIRSTTRACK ))
        else
                TRACKNUM=${UTRACKNUM}
@@ -515,6 +515,9 @@ do_replaygain()
                                vorbis|ogg)
                                        OUTPUT=$OGGOUTPUTCONTAINER
                                        ;;
                                vorbis|ogg)
                                        OUTPUT=$OGGOUTPUTCONTAINER
                                        ;;
+                               opus)
+                                       OUTPUT=$OPUSOUTPUTCONTAINER
+                                       ;;
                                flac)
                                        OUTPUT=$FLACOUTPUTCONTAINER
                                        ;;
                                flac)
                                        OUTPUT=$FLACOUTPUTCONTAINER
                                        ;;
@@ -898,6 +901,10 @@ do_tag ()
                                        ;;
                        esac
                        ;;
                                        ;;
                        esac
                        ;;
+               opus)
+                       run_command tagtrack-$OUTPUT-$1 true
+                       ;;
+
                flac)
                        (
                        echo ARTIST="$TRACKARTIST"
                flac)
                        (
                        echo ARTIST="$TRACKARTIST"
@@ -1018,6 +1025,9 @@ do_encode ()
                        vorbis|ogg)
                                TEMPARG="PIPE_$OGGENCODERSYNTAX"
                                ;;
                        vorbis|ogg)
                                TEMPARG="PIPE_$OGGENCODERSYNTAX"
                                ;;
+                       opus)
+                               TEMPARG="PIPE_$OPUSENCODERSYNTAX"
+                               ;;
                        flac)
                                TEMPARG="PIPE_$FLACENCODERSYNTAX"
                                ;;
                        flac)
                                TEMPARG="PIPE_$FLACENCODERSYNTAX"
                                ;;
@@ -1025,7 +1035,7 @@ do_encode ()
                                TEMPARG="PIPE_$SPEEXENCODER"
                                ;;
                        mpc)
                                TEMPARG="PIPE_$SPEEXENCODER"
                                ;;
                        mpc)
-                               TEMPARG="PIPE_$MPPENCODER"
+                               TEMPARG="PIPE_$MPCENCODER"
                                ;;
                        m4a)
                                TEMPARG="PIPE_$AACENCODERSYNTAX"
                                ;;
                        m4a)
                                TEMPARG="PIPE_$AACENCODERSYNTAX"
@@ -1060,6 +1070,9 @@ do_encode ()
                                vorbis|ogg)
                                        OUTPUT=$OGGOUTPUTCONTAINER
                                        ;;
                                vorbis|ogg)
                                        OUTPUT=$OGGOUTPUTCONTAINER
                                        ;;
+                               opus)
+                                       OUTPUT=$OPUSOUTPUTCONTAINER
+                                       ;;
                                flac)
                                        OUTPUT=$FLACOUTPUTCONTAINER
                                        ;;
                                flac)
                                        OUTPUT=$FLACOUTPUTCONTAINER
                                        ;;
@@ -1115,6 +1128,32 @@ do_encode ()
                                        ;;
                                esac
                                ;;
                                        ;;
                                esac
                                ;;
+                       opus)
+                               case "$2" in
+                               %local*%)
+                                       case "$OPUSENCODERSYNTAX" in
+                                       opusenc) 
+
+                                           if [ "$(eval echo ${COMMENT})" != "" ]; then
+                                               case "$COMMENT" in
+                                                   *=*) ;;
+                                                    *)   COMMENT="COMMENT=$COMMENT" ;;
+                                               esac    
+                                           fi
+                                           # Tag the file at encode time, as it can't be done after encoding.
+                                           if [ "$DOTAG" = "y" ]; then
+                                             $RUN_COMMAND nice $EFFECTIVE_NICE $OPUSENCODER $OPUSENCODEROPTS --artist "$TRACKARTIST" --comment album="$DALBUM" --title "$TRACKNAME" --comment track="$1" --comment genre="$CDGENRE" --comment year="$CDYEAR" ${COMMENT:+--comment "$COMMENT"} "$IN" "$OUT"
+                                           else
+                                             $RUN_COMMAND nice $EFFECTIVE_NICE $OPUSENCODER $OPUSENCODEROPTS "$IN" "$OUT"  
+                                           fi
+                                             ;;
+                                       esac
+                                       ;;
+                               *)
+                                       $RUN_COMMAND nice $DISTMP3NICE $DISTMP3 $DISTMP3OPTS "$2" "$IN" "$OUT" >/dev/null 2>&1
+                                       ;;
+                               esac
+                               ;;
                        flac)
                                case "$2" in
                                %local*%)
                        flac)
                                case "$2" in
                                %local*%)
@@ -1145,16 +1184,16 @@ do_encode ()
                                ;;
                        mpc)    
                                # MPP/MP+(Musepack) format (.mpc) is done locally, with inline
                                ;;
                        mpc)    
                                # MPP/MP+(Musepack) format (.mpc) is done locally, with inline
-                               # tagging.
-                               # I tried compiling the mppenc from corecodecs.org and got some
-                               # errors, so I have not tried it myself.
-                               ## FIXME ## Needs some cleanup to determine if an empty tag sent
-                               ## FIXME ## to the encoder ends up empty.
-                               $RUN_COMMAND nice $EFFECTIVE_NICE $MPPENCODER $MPPENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" --track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" "$IN" "$OUT"
+                               # tagging. Uses mpcenc for Musepack SV8 encoding, changed from
+                               # Musepack SV7 which used mppenc....
+                               $RUN_COMMAND nice $EFFECTIVE_NICE $MPCENCODER $MPCENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" --track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" "$IN" "$OUT"
                                ;;
                        m4a)
                                # Tag the file at encode time, as it can't be done after encoding.
                                ;;
                        m4a)
                                # Tag the file at encode time, as it can't be done after encoding.
-                               if [ "$DOTAG" = "y" ]; then
+                               if [ "$AACENC" = "neroAacEnc" ] ; then
+                                       DOTAG=y
+                                       $RUN_COMMAND nice $ENCNICE $AACENC $AACENCOPTS -if "$IN" -of "$OUT"
+                                                                       elif [ ! "$DOTAG" = "y" ]; then
                                        $RUN_COMMAND nice $EFFECTIVE_NICE $AACENCODER $AACENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" --track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" -o "$OUT" "$IN"
                                        
                                else
                                        $RUN_COMMAND nice $EFFECTIVE_NICE $AACENCODER $AACENCODEROPTS --artist "$TRACKARTIST" --album "$DALBUM" --title "$TRACKNAME" --track "$1" --genre "$CDGENRE" --year "$CDYEAR" --comment "$COMMENT" -o "$OUT" "$IN"
                                        
                                else
@@ -1397,6 +1436,9 @@ do_move ()
                                vorbis|ogg)
                                        OUTPUT=$OGGOUTPUTCONTAINER
                                        ;;
                                vorbis|ogg)
                                        OUTPUT=$OGGOUTPUTCONTAINER
                                        ;;
+                               opus)
+                                       OUTPUT=$OPUSOUTPUTCONTAINER
+                                       ;;
                                flac)
                                        OUTPUT=$FLACOUTPUTCONTAINER
                                        ;;
                                flac)
                                        OUTPUT=$FLACOUTPUTCONTAINER
                                        ;;
@@ -1478,6 +1520,9 @@ do_playlist ()
                        vorbis|ogg)
                                OUTPUT=$OGGOUTPUTCONTAINER
                                ;;
                        vorbis|ogg)
                                OUTPUT=$OGGOUTPUTCONTAINER
                                ;;
+                       opus)
+                               OUTPUT=$OPUSOUTPUTCONTAINER
+                               ;;
                        flac)
                                OUTPUT=$FLACOUTPUTCONTAINER
                                ;;
                        flac)
                                OUTPUT=$FLACOUTPUTCONTAINER
                                ;;
@@ -1705,7 +1750,7 @@ abcde.mkcue () {
        shift 2
 
        echo REM DISCID $DISCID
        shift 2
 
        echo REM DISCID $DISCID
-       echo FILE \""$CUEWAVEFILE"\" WAVE
+       echo FILE \""$CUEWAVFILE"\" WAVE
 
        if [ $1 -ne 150 ] && [ $MODE = "PREGAP" ] ; then
                OFFSET=$1
 
        if [ $1 -ne 150 ] && [ $MODE = "PREGAP" ] ; then
                OFFSET=$1
@@ -2400,6 +2445,9 @@ do_cddbstat ()
                                                2??)    # Server responded, everything seems OK
                                                        rc=0
                                                        ;;
                                                2??)    # Server responded, everything seems OK
                                                        rc=0
                                                        ;;
+                                               *)      # unknown error
+                                                       break
+                                                       ;;
                                        esac
                                        ;;
                                esac
                                        esac
                                        ;;
                                esac
@@ -3146,9 +3194,10 @@ ENCODERSYNTAX=default
 
 MP3ENCODERSYNTAX=default
 OGGENCODERSYNTAX=default
 
 MP3ENCODERSYNTAX=default
 OGGENCODERSYNTAX=default
+OPUSENCODERSYNTAX=default
 FLACENCODERSYNTAX=default
 SPEEXENCODERSYNTAX=default
 FLACENCODERSYNTAX=default
 SPEEXENCODERSYNTAX=default
-MPPENCODERSYNTAX=default
+MPCENCODERSYNTAX=default
 AACENCODERSYNTAX=default
 NORMALIZERSYNTAX=default
 CUEREADERSYNTAX=default
 AACENCODERSYNTAX=default
 NORMALIZERSYNTAX=default
 CUEREADERSYNTAX=default
@@ -3196,17 +3245,18 @@ MP3ENC=mp3enc
 # ogg
 VORBIZE=vorbize
 OGGENC=oggenc
 # ogg
 VORBIZE=vorbize
 OGGENC=oggenc
+#opus
+OPUSENC=opusenc
 # flac
 FLAC=flac
 # speex
 SPEEXENC=speexenc
 # mpp (Musepack)
 # flac
 FLAC=flac
 # speex
 SPEEXENC=speexenc
 # mpp (Musepack)
-MPPENC=mppenc
+MPCENC=mpcenc
 # m4a
 AACENC=faac
 
 ID3=id3
 # m4a
 AACENC=faac
 
 ID3=id3
-ID3V2=id3v2
 EYED3=eyeD3
 VORBISCOMMENT=vorbiscomment
 METAFLAC=metaflac
 EYED3=eyeD3
 VORBISCOMMENT=vorbiscomment
 METAFLAC=metaflac
@@ -3247,18 +3297,20 @@ MP3GAINOPTS="-a -k"
 VORBIZEOPTS=
 OGGENCOPTS=
 VORBISGAINOPTS="--album"
 VORBIZEOPTS=
 OGGENCOPTS=
 VORBISGAINOPTS="--album"
+#opus
+OPUSENCOPTS=
 # flac
 FLACOPTS=
 FLACGAINOPTS="--add-replay-gain"
 # speex
 SPEEXENCOPTS=
 # mpc
 # flac
 FLACOPTS=
 FLACGAINOPTS="--add-replay-gain"
 # speex
 SPEEXENCOPTS=
 # mpc
-MPPENCOPTS=
+MPCENCOPTS=
 # m4a
 AACENCOPTS=
 
 ID3OPTS=
 # m4a
 AACENCOPTS=
 
 ID3OPTS=
-ID3V2OPTS=
+EYED3OPTS="--set-encoding=utf16-LE"
 CDPARANOIAOPTS=
 CDDA2WAVOPTS=
 DAGRABOPTS=
 CDPARANOIAOPTS=
 CDDA2WAVOPTS=
 DAGRABOPTS=
@@ -3283,7 +3335,7 @@ ACTIONS=cddb,read,encode,tag,move,clean
 
 # This option is basically for Debian package dependencies:
 # List of preferred outputs - by default, run with whatever we have in the path
 
 # This option is basically for Debian package dependencies:
 # List of preferred outputs - by default, run with whatever we have in the path
-DEFAULT_OUTPUT_BINARIES=vorbis:oggenc,flac:flac,mp3:toolame,mp3:lame,mp3:bladeenc,spx:speex,m4a:faac
+DEFAULT_OUTPUT_BINARIES=vorbis:oggenc,flac:flac,mp3:toolame,mp3:lame,mp3:bladeenc,spx:speex,m4a:faac:opus
 
 # List of preferred cdromreaders - by default, run whichever we have in the path
 DEFAULT_CDROMREADERS="cdparanoia icedax cdda2wav"
 
 # List of preferred cdromreaders - by default, run whichever we have in the path
 DEFAULT_CDROMREADERS="cdparanoia icedax cdda2wav"
@@ -3309,6 +3361,8 @@ elif [ X$(uname) = "XDarwin" ] ; then
        # We should have diskutil in OSX, but let's be sure...
        NEEDDISKUTIL=y
        CDROMREADERSYNTAX=cddafs
        # 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
 elif [ X$(uname) = "XOpenBSD" ] ; then
        HTTPGET=wget
        MD5SUM=md5
@@ -3728,10 +3782,11 @@ if echo "$OUTPUTTYPE" | grep ":" > /dev/null 2>&1 ; then
        for OUTPUT in "$(echo "$OUTPUTTYPE" | tr \  \|| tr , \ | tr \| \ )"; do
                case "$OUTPUT" in
                        vorbis:*|ogg:*) OGGENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
        for OUTPUT in "$(echo "$OUTPUTTYPE" | tr \  \|| tr , \ | tr \| \ )"; do
                case "$OUTPUT" in
                        vorbis:*|ogg:*) OGGENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
+                       opus:*) OPUSENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                        mp3:*)  MP3ENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                        flac:*) FLACENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                        spx:*)  SPEEXENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                        mp3:*)  MP3ENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                        flac:*) FLACENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                        spx:*)  SPEEXENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
-                       mpc:*)  MPPENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
+                       mpc:*)  MPCENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                        m4a:*)  AACENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                esac
        done
                        m4a:*)  AACENCODEROPTSCLI="$( echo $OUTPUT | cut -d: -f2- )" ;;
                esac
        done
@@ -3743,7 +3798,7 @@ if echo "$OUTPUTTYPE" | grep ":" > /dev/null 2>&1 ; then
 fi
 
 # If nothing has been specified, use oggenc for oggs and lame for mp3s and flac
 fi
 
 # If nothing has been specified, use oggenc for oggs and lame for mp3s and flac
-# for flacs and speexenc for speex and mppenc for mpps and faac for m4as
+# for flacs and speexenc for speex and mpcenc for mpcs and faac for m4as
 
 # Getting ready for multiple output changes
 for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
 
 # Getting ready for multiple output changes
 for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
@@ -3755,6 +3810,10 @@ do
                        [ "$DOREPLAYGAIN" = "y" ] && NEEDVORBISGAIN=y
                        OGGOUTPUTCONTAINER=ogg
                        ;;
                        [ "$DOREPLAYGAIN" = "y" ] && NEEDVORBISGAIN=y
                        OGGOUTPUTCONTAINER=ogg
                        ;;
+               opus)
+                       [ "$OPUSENCODERSYNTAX" = "default" ] && OPUSENCODERSYNTAX=opusenc
+                       OPUSOUTPUTCONTAINER=opus
+                       ;;
                mp3)
                        [ "$MP3ENCODERSYNTAX" = "default" ] && MP3ENCODERSYNTAX=lame
                        [ "$DOTAG" = "y" ] && NEEDTAGGER=y
                mp3)
                        [ "$MP3ENCODERSYNTAX" = "default" ] && MP3ENCODERSYNTAX=lame
                        [ "$DOTAG" = "y" ] && NEEDTAGGER=y
@@ -3771,7 +3830,7 @@ do
 #                      [ "$DOREPLAYGAIN" = "y" ] &&
                        ;;
                mpc)
 #                      [ "$DOREPLAYGAIN" = "y" ] &&
                        ;;
                mpc)
-                       [ "$MPPENCODERSYNTAX" = "default" ] && MPPENCODERSYNTAX=mppenc
+                       [ "$MPCENCODERSYNTAX" = "default" ] && MPCENCODERSYNTAX=mpcenc
                        [ "$DOREPLAYGAIN" = "y" ] && NEEDMPPGAIN=y
                        ;;
                m4a)
                        [ "$DOREPLAYGAIN" = "y" ] && NEEDMPPGAIN=y
                        ;;
                m4a)
@@ -3831,6 +3890,12 @@ case "$OGGENCODERSYNTAX" in
                OGGENCODER="$OGGENC"
                ;;
 esac
                OGGENCODER="$OGGENC"
                ;;
 esac
+case "$OPUSENCODERSYNTAX" in
+       opusenc)
+               OPUSENCODEROPTS="${OPUSENCODEROPTSCLI:-$OPUSENCOPTS}"
+               OPUSENCODER="$OPUSENC"
+               ;;
+esac
 case "$FLACENCODERSYNTAX" in
        flac)
                FLACENCODEROPTS="${FLACENCODEROPTSCLI:-$FLACOPTS}"
 case "$FLACENCODERSYNTAX" in
        flac)
                FLACENCODEROPTS="${FLACENCODEROPTSCLI:-$FLACOPTS}"
@@ -3855,10 +3920,10 @@ case "$SPEEXENCODERSYNTAX" in
                SPEEXENCODER="$SPEEXENC"
                ;;
 esac
                SPEEXENCODER="$SPEEXENC"
                ;;
 esac
-case "$MPPENCODERSYNTAX" in
-       mppenc)
-               MPPENCODEROPTS="${MPPENCODEROPTSCLI:-$MPPENCOPTS}"
-               MPPENCODER="$MPPENC"
+case "$MPCENCODERSYNTAX" in
+       mpcenc)
+               MPCENCODEROPTS="${MPCENCODEROPTSCLI:-$MPCENCOPTS}"
+               MPCENCODER="$MPCENC"
                ;;
 esac
 case "$AACENCODERSYNTAX" in
                ;;
 esac
 case "$AACENCODERSYNTAX" in
@@ -3874,9 +3939,8 @@ if [ "$ID3TAGV" = "1" ]; then
        TAGGEROPTS="$ID3OPTS"
 else
        TAGGER="$EYED3"
        TAGGEROPTS="$ID3OPTS"
 else
        TAGGER="$EYED3"
-       TAGGEROPTS="$ID3V2OPTS"
+       TAGGEROPTS="$EYED3OPTS"
        ID3SYNTAX=eyed3
        ID3SYNTAX=eyed3
-       TAGGEROPTS="--set-encoding=utf16-LE $ID3V2OPTS"
 fi
 
 # NOGAP is specific to lame. Other encoders fail ...
 fi
 
 # NOGAP is specific to lame. Other encoders fail ...
@@ -3964,6 +4028,7 @@ PIPERIPPER_flac="-c "
 PIPE_lame="-"
 PIPE_bladeenc="-"
 PIPE_oggenc="-"
 PIPE_lame="-"
 PIPE_bladeenc="-"
 PIPE_oggenc="-"
+PIPE_opusenc="-"
 PIPE_flac="-"
 
 # Figure out if we can use pipes with the ripper/encoder combination
 PIPE_flac="-"
 
 # Figure out if we can use pipes with the ripper/encoder combination
@@ -3975,12 +4040,14 @@ if [ "$USEPIPES" = "y" ]; then
                        PIPEENCODERSVARCHECK="PIPE_$MP3ENCODERSYNTAX" ;;
                vorbis|ogg)
                        PIPEENCODERSVARCHECK="PIPE_$OGGENCODERSYNTAX" ;;
                        PIPEENCODERSVARCHECK="PIPE_$MP3ENCODERSYNTAX" ;;
                vorbis|ogg)
                        PIPEENCODERSVARCHECK="PIPE_$OGGENCODERSYNTAX" ;;
+               opus)
+                       PIPEENCODERSVARCHECK="PIPE_$OPUSENCODERSYNTAX" ;;
                flac)
                        PIPEENCODERSVARCHECK="PIPE_$FLACENCODERSYNTAX" ;;
                spx)
                        PIPEENCODERSVARCHECK="PIPE_$SPEEXENCODER" ;;
                mpc)
                flac)
                        PIPEENCODERSVARCHECK="PIPE_$FLACENCODERSYNTAX" ;;
                spx)
                        PIPEENCODERSVARCHECK="PIPE_$SPEEXENCODER" ;;
                mpc)
-                       PIPEENCODERSVARCHECK="PIPE_$MPPENCODER" ;;
+                       PIPEENCODERSVARCHECK="PIPE_$MPCENCODER" ;;
        esac
        decho "PIPERIPPERSVARCHECK: $( eval echo "\$$PIPERIPPERSVARCHECK" )"
        if [ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "$" ] || \
        esac
        decho "PIPERIPPERSVARCHECK: $( eval echo "\$$PIPERIPPERSVARCHECK" )"
        if [ "$( eval echo "\$$PIPERIPPERSVARCHECK" )" = "$" ] || \
@@ -4002,7 +4069,7 @@ fi
 
 # Make sure a buncha things exist
 for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $MP3ENCODER \
 
 # Make sure a buncha things exist
 for X in $CDROMREADER $CDDISCID ${NEEDTAGGER+$TAGGER} $MP3ENCODER \
-       $OGGENCODER $FLACENCODER $SPEEXENCODER $MPPENCODER \
+       $OGGENCODER $OPUSENCODER $FLACENCODER $SPEEXENCODER $MPCENCODER \
        $AACENCODER $CDDBTOOL \
        ${NEEDATOMICPARSLEY+$ATOMICPARSLEY} \
        ${NEEDHTTPGET+$HTTPGET} ${NEEDDISTMP3+$DISTMP3} \
        $AACENCODER $CDDBTOOL \
        ${NEEDATOMICPARSLEY+$ATOMICPARSLEY} \
        ${NEEDHTTPGET+$HTTPGET} ${NEEDDISTMP3+$DISTMP3} \
@@ -4220,7 +4287,7 @@ post_read
 
 # We are now finished with the cdrom - it can be safely ejected. Note that
 # abcde will not have completed yet.
 
 # 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.
        # 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.
@@ -4237,7 +4304,7 @@ if [ "$EJECTCD" = "y" ] && [ -x $(which $EJECT) ]; then
                $eject $EJECTOPTS $cd
        elif [ X"$(uname)" = X"Darwin" ] ; then
                diskutil eject ${CDROM#/dev/} 0
                $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
                $EJECT $EJECTOPTS "$CDROM"
        fi
        #fi