r49@yurie: data | 2005-02-21 01:39:35 +0200
authorJesus Climent <mooch@debian.org>
Sun, 20 Feb 2005 18:54:33 +0000 (18:54 +0000)
committerJesus Climent <mooch@debian.org>
Sun, 20 Feb 2005 18:54:33 +0000 (18:54 +0000)
 More PIPES work
 New output mode with command line options
 New CUE file mode

README
abcde
abcde.1

diff --git a/README b/README
index b0b674e..2494e29 100644 (file)
--- a/README
+++ b/README
@@ -25,6 +25,13 @@ ID3TAGV=1
 
 MAJOR CHANGES
 =============
+Changes in 2.4:
+* Support for mkcue, to create a CUE sheet of the CD structure.
+* New -o <output(1)>:<options(1)>,... way of passing specific options to an
+  output. Now we can pass specific options without having to modify a config
+  file.
+* Unix PIPEs, as a second way to encode files with a tight disc space.
+
 Changes in 2.2:
 
 * Support for MPP/MP+(Musepack) format. It can be downloaded from
diff --git a/abcde b/abcde
index 30dfc1c..bd13e20 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -39,6 +39,7 @@ 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 "-M     Create a CUE file"
 echo "-o <type1[,type2]...>"
 echo "       Output file type(s) (ogg,mp3,flac,spx,mpc). Defaults to ogg"
 echo "-p     Pad track numbers with 0's (if less than 10 tracks)"
@@ -970,7 +971,12 @@ do_discid ()
                fi
                cat /dev/null > "$ABCDETEMPDIR/status"
        fi
-       
+       if [ X"$CUEFILE" = "Xy" -a X"$WEHAVEACD" = "Xy" ]; then
+               if checkstatus cuefile ; then :; else
+                       $MKCUE $MKCUEOPTS > $ABCDETEMPDIR/cue-$(echo $TRACKINFO | cut -f1 -d' ').txt
+                       echo cuefile >> "$ABCDETEMPDIR/status"
+               fi
+       fi
        # If we got the CDPARANOIA status and it is not recorded, save it now
        if [ -n "$CDPARANOIAAUDIOTRACKS" ]; then
                if checkstatus cdparanoia-audio-tracks; then :; else
@@ -1517,64 +1523,6 @@ do_cddbedit ()
        echo "cddb-edit" >> "$ABCDETEMPDIR/status"
 }
 
-# do_cdread_one [lasttrack] [firsttrack]
-# 
-# Reads the CD in a single track. Live performances, concerts, mixes,... benefit from this.
-do_cdread_one ()
-{
-       # The commands here don't go through run_command because they're never supposed to be silenced
-       # return codes need to be doublechecked anyway, however
-       LASTTRACKNUMBER=$1
-       FIRSTTRACKNUMBER=$2
-       WAVDATA="$ABCDETEMPDIR/track$FIRSTTRACKNUMBER.wav"
-       echo "Grabbing the CD to a single track..." >&2
-       case "$CDROMREADERSYNTAX" in
-               cdparanoia) nice $READNICE $CDROMREADER -d $CDROM "1-" "$WAVDATA" >&2 ;;
-               cdda2wav)
-                       if [ "$OSFLAVOUR" = "OSX" ] ; then
-                               # Hei, we have to unmount the device before running anything like cdda2wav in OSX
-                               disktool -u ${CDROM#/dev/} 0
-                               # Also, in OSX the cdrom device for cdda2wav changes...
-                               CDDA2WAVCDROM="IODVDServices"
-                       elif [ "$OSFLAVOUR" = "FBSD" ] ; then
-                               CDDA2WAVCDROM="$CDROMID"
-                       else
-                               if [ "$CDROMID" = "" ]; then
-                                       CDDA2WAVCDROM="$CDROM"
-                               else
-                                       CDDA2WAVCDROM="$CDROMID"
-                               fi
-                       fi
-                       nice $READNICE $CDROMREADER -D $CDDA2WAVCDROM -t 1+$LASTTRACKNUM "$WAVDATA" >&2 
-                       ;;
-               dagrab) nice $READNICE $CDROMREADER -d $CDROM -f $WAVDATA -v $UTRACKNUM >&2 ;;
-               cddafs)
-                       # Find the track's mounted path
-                       REALTRACKNUM=$(expr $UTRACKNUM + 0)
-                       FILEPATH=$(mount | grep "$CDROM on" | sed 's/^[^ ]* on \(.*\) (.*/\1/')
-                       FILEPATH=$(find "$FILEPATH" | grep "/$REALTRACKNUM ");
-                       # If the file exists, copy it
-                       if [ -e "$FILEPATH" ] ; then
-                               nice $READNICE $CDROMREADER "$FILEPATH" "$WAVDATA" >&2
-                       else
-                               false
-                       fi ;;
-               debug) nice $READNICE $CDROMREADER -d $CDROM -w $UTRACKNUM-[:1] "$WAVDATA" >&2 ;;
-       esac
-       RETURN=$?
-       if [ "$RETURN" != "0" -o ! -s "$WAVDATA" ]; then
-               # Thank goodness errors is only machine-parseable up to the
-               # first colon, otherwise this woulda sucked
-               if [ "$RETURN" = "0" -a ! -s "$WAVDATA" ]; then
-                       RETURN=73 # fake a return code as cdparanoia return 0 also on aborted reads
-               fi
-                echo "readtrack-$FIRSTTRACKNUMBER: $CDROMREADER returned code $RETURN" >> "$ABCDETEMPDIR/errors"
-               return $RETURN
-       else
-               echo readtrack-$FIRSTTRACKNUMBER >> "$ABCDETEMPDIR/status"
-       fi
-}
-
 # do_cdread [tracknumber]
 # do_cdread onetrack [firsttrack] [lasttrack]
 # 
@@ -1809,6 +1757,7 @@ METAFLAC=metaflac
 NORMALIZE=normalize-audio
 CDSPEED=eject
 VORBISGAIN=vorbisgain
+MKCUE=mkcue
 
 # Options for programs called from abcde
 # mp3
@@ -1840,6 +1789,7 @@ DISTMP3OPTS=
 NORMALIZEOPTS=
 CDSPEEDOPTS="-x"
 CDSPEEDVALUE=
+MKCUEOPTS=
 
 # Default to one process if -j isn't specified
 MAXPROCS=1
@@ -1869,6 +1819,7 @@ fi
 # If USEID3 is set to n, no ID3 tagging is done
 CDDBAVAIL=y
 USEID3=y
+USEID3V2=y
 
 if [ -z "$OUTPUTDIR" ]; then
        OUTPUTDIR=$(pwd)
@@ -1918,7 +1869,7 @@ fi
 
 # Parse command line options
 #while getopts 1a:bc:C:d:Dhj:klLnNo:pr:S:t:T:vVx opt ; do
-while getopts 1a:A:bc:C:d:Dhj:klLnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do
+while getopts 1a:A:bc:C:d:Dhj:klLmMnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do
        case "$opt" in
                1) ONETRACK=y ;;
                a) ACTIONS="$OPTARG" ;;
@@ -1938,6 +1889,7 @@ while getopts 1a:A:bc:C:d:Dhj:klLnNo:pPr:Rs:S:t:T:vVxw:W: opt ; do
                n) CDDBAVAIL=n ;;
                N) INTERACTIVE=n ;;
                m) DOSPLAYLIST=y ;;
+               M) CUEFILE=y ;;
                o) OUTPUTTYPE="$OPTARG" ;;
                p) PADTRACKS=y ;;
                P) USEPIPES=y ;;
@@ -2016,16 +1968,16 @@ DOCLEAN=n
 for ACTION in $(echo $ACTIONS | tr , \ )
 do
        case $ACTION in
-       cddb) DOCDDB=y;;
-       read) DOREAD=y;;
-       normalize) DONORMALIZE=y; DOREAD=y;;
-#      preprocess) DOPREPROCESS=y; DOREAD=y;;
-       encode) DOENCODE=y; DOREAD=y;;
-#      postprocess) DOPREPROCESS=y; DOENCODE=y; DOREAD=y;;
-       tag) DOTAG=y; DOREAD=y; DOENCODE=y; DOCDDB=y;;
-       move) DOMOVE=y; DOTAG=y; DOREAD=y; DOENCODE=y; DOCDDB=y;;
-       playlist) DOCDDB=y; DOPLAYLIST=y;;
-       clean) DOCLEAN=y;;
+               cddb) DOCDDB=y;;
+               read) DOREAD=y;;
+               normalize) DONORMALIZE=y; DOREAD=y;;
+#              preprocess) DOPREPROCESS=y; DOREAD=y;;
+               encode) DOENCODE=y; DOREAD=y;;
+#              postprocess) DOPREPROCESS=y; DOENCODE=y; DOREAD=y;;
+               tag) DOTAG=y; DOREAD=y; DOENCODE=y; DOCDDB=y;;
+               move) DOMOVE=y; DOTAG=y; DOREAD=y; DOENCODE=y; DOCDDB=y;;
+               playlist) DOCDDB=y; DOPLAYLIST=y;;
+               clean) DOCLEAN=y;;
        esac
 done
 
@@ -2104,86 +2056,109 @@ case "$NORMALIZERSYNTAX" in
                ;;
 esac
 
+# Allow -o OUTPUT(1):OPTIONS(1),...,OUTPUT(N):OPTIONS(N) mode of operation
+if echo $OUTPUTTYPE | grep ":" > /dev/null 2>&1 ; then
+       OLDFS="$FS"
+       export FS=","
+       for OUTPUT in "$OUTPUTTYPE"
+       do
+               case "$OUTPUT" in
+                       ogg:*)  OGGENCODEROPTSCLI="$( 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- )" ;;
+               esac
+       done
+       for OUTPUT in "$OUTPUTTYPE"
+       do
+               TEMPOUTPUT=$( echo "$OUTPUT" | cut -d: -f1 )
+               TEMPOUTPUTTYPE="${TEMPOUTPUTTYPE:+$TEMPOUTPUTTYPE,}$TEMPOUTPUT"
+       done
+       OUTPUTTYPE="$TEMPOUTPUTTYPE"
+       FS="$OLDFS"
+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
 
 # Getting ready for multiple output changes
 for OUTPUT in $(echo $OUTPUTTYPE | tr , \ )
 do
        case $OUTPUT in
-               ogg)  [ "$OGGENCODERSYNTAX" = "default" ] && OGGENCODERSYNTAX=oggenc
-                     [ "$DOTAG" = "y" ] && NEEDCOMMENTER=y
-                     [ "$REPLAYGAIN" = "y" ] && NEEDVORBISGAIN=y
-                       ;;
-               mp3)  [ "$MP3ENCODERSYNTAX" = "default" ] && MP3ENCODERSYNTAX=lame
-                     [ "$DOTAG" = "y" ] && NEEDTAGGER=y
+               ogg)    [ "$OGGENCODERSYNTAX" = "default" ] && OGGENCODERSYNTAX=oggenc
+                               [ "$DOTAG" = "y" ] && NEEDCOMMENTER=y
+                               [ "$REPLAYGAIN" = "y" ] && NEEDVORBISGAIN=y
+                               ;;
+               mp3)    [ "$MP3ENCODERSYNTAX" = "default" ] && MP3ENCODERSYNTAX=lame
+                               [ "$DOTAG" = "y" ] && NEEDTAGGER=y
+                               ;;
+               flac)   [ "$FLACENCODERSYNTAX" = "default" ] && FLACENCODERSYNTAX=flac
+                               [ "$DOTAG" = "y" ] && NEEDMETAFLAC=y
+                               ;;
+               spx)    [ "$SPEEXENCODERSYNTAX" = "default" ] && SPEEXENCODERSYNTAX=speexenc ;;
+               mpc)    [ "$MPPENCODERSYNTAX" = "default" ] && MPPENCODERSYNTAX=mppenc ;;
+               *)      echo "abcde error: Invalid OUTPUTTYPE defined" >&2
+                       exit 1
                        ;;
-               flac) [ "$FLACENCODERSYNTAX" = "default" ] && FLACENCODERSYNTAX=flac
-                     [ "$DOTAG" = "y" ] && NEEDMETAFLAC=y
-                       ;;
-               spx) [ "$SPEEXENCODERSYNTAX" = "default" ] && SPEEXENCODERSYNTAX=speexenc ;;
-               mpc) [ "$MPPENCODERSYNTAX" = "default" ] && MPPENCODERSYNTAX=mppenc ;;
-               *) echo "abcde error: Invalid OUTPUTTYPE defined" >&2
-                  exit 1
-                  ;;
        esac
 done
 
 # decide which encoder
 case "$MP3ENCODERSYNTAX" in
        lame)
-               MP3ENCODEROPTS="$LAMEOPTS"
+               MP3ENCODEROPTS="${MP3ENCODEROPTSCLI:-$LAMEOPTS}"
                MP3ENCODER="$LAME"
                ;;
        gogo)
-               MP3ENCODEROPTS="$GOGOOPTS"
+               MP3ENCODEROPTS="${MP3ENCODEROPTSCLI:-$GOGOOPTS}"
                MP3ENCODER="$GOGO"
                ;;
        bladeenc)
-               MP3ENCODEROPTS="$BLADEENCOPTS"
+               MP3ENCODEROPTS="${MP3ENCODEROPTSCLI:-$BLADEENCOPTS}"
                MP3ENCODER="$BLADEENC"
                ;;
        l3enc)
-               MP3ENCODEROPTS="$L3ENCOPTS"
+               MP3ENCODEROPTS="${MP3ENCODEROPTSCLI:-$L3ENCOPTS}"
                MP3ENCODER="$L3ENC"
                ;;
        xingmp3enc)
-               MP3ENCODEROPTS="$XINGMP3ENCOPTS"
+               MP3ENCODEROPTS="${MP3ENCODEROPTSCLI:-$XINGMP3ENCOPTS}"
                MP3ENCODER="$XINGMP3ENC"
                ;;
        mp3enc)
-               MP3ENCODEROPTS="$MP3ENCOPTS"
+               MP3ENCODEROPTS="${MP3ENCODEROPTSCLI:-$MP3ENCOPTS}"
                MP3ENCODER="$MP3ENC"
                ;;
 esac
 case "$OGGENCODERSYNTAX" in
        vorbize)
-               OGGENCODEROPTS="$VORBIZEOPTS"
+               OGGENCODEROPTS="${OGGENCODEROPTSCLI:-$VORBIZEOPTS}"
                OGGENCODER="$VORBIZE"
                ;;
        oggenc)
-               OGGENCODEROPTS="$OGGENCOPTS"
+               OGGENCODEROPTS="${OGGENCODEROPTSCLI:-$OGGENCOPTS}"
                OGGENCODER="$OGGENC"
                ;;
 esac
 case "$FLACENCODERSYNTAX" in
        flac)
-               FLACENCODEROPTS="$FLACOPTS"
+               FLACENCODEROPTS="${FLACENCODEROPTSCLI:-$FLACOPTS}"
                FLACENCODER="$FLAC"
                ;;
 esac
 case "$SPEEXENCODERSYNTAX" in
        speexenc)
-               SPEEXENCODEROPTS="$SPEEXENCOPTS"
+               SPEEXENCODEROPTS="${SPEEXENCODEROPTSCLI:-$SPEEXENCOPTS}"
                SPEEXENCODER="$SPEEXENC"
                ;;
 esac
 case "$MPPENCODERSYNTAX" in
        mppenc)
-               MPPENCODEROPTS="$MPPENCOPTS"
+               MPPENCODEROPTS="${MPPENCODEROPTSCLI:-$MPPENCOPTS}"
                MPPENCODER="$MPPENC"
                ;;
 esac
-
+               
 # and which tagger
 
 if [ "$ID3TAGV" = "1" ]; then
@@ -2211,6 +2186,7 @@ if [ "$REMOTEHOSTS" ]; then NEEDDISTMP3=y; fi
 [ "$DONORMALIZE" = "y" ] && NEEDNORMALIZER=y
 [ "$EJECTCD" = "y" ] && NEEDEJECT=y
 [ ! "$CDDBAVAIL" = "n" ] && [ "$DOCDDB" = "y" ] && NEEDHTTPGET=y
+[ "$CUEFILE" = "y" ] && NEEDMKCUE=y
 
 if [ X"$CDSPEEDVALUE" != "X" ]; then
        case "$CDROMREADERSYNTAX" in
@@ -2240,7 +2216,7 @@ if [ "$USEPIPES" = "y" ]; then
                flac)
                        PIPEENCODERSVARCHECK="PIPE_$FLACENCODERSYTNAX" ;;
                spx)
-                       PIPEENCODERSVARCHECK="PIPE_$SPEEXENCODER" ;;
+                       IPEENCODERSVARCHECK="PIPE_$SPEEXENCODER" ;;
                mpc)
                        PIPEENCODERSVARCHECK="PIPE_$MPPENCODER" ;;
        esac
@@ -2351,7 +2327,6 @@ if [ "$ONETRACK" = "y" ]; then
        TRACKS="$FIRSTTRACK"
        for UTRACKNUM in $TRACKQUEUE; do :;done
        if checkstatus readtrack-$FIRSTTRACK; then :; else
-               #do_cdread_one $UTRACKNUM $FIRSTTRACK
                do_cdread onetrack $FIRSTTRACK $UTRACKNUM
        fi
 else
diff --git a/abcde.1 b/abcde.1
index 223d5b7..6f5946a 100644 (file)
--- a/abcde.1
+++ b/abcde.1
@@ -94,10 +94,12 @@ Non interactive mode. Do not ask anything from the user. Just go ahead.
 Create DOS-style playlists, modifying the resulting one by adding CRLF line
 endings. Some hardware players insist on having those to work.
 .TP
-.B \-o [filetype]
+.B \-o [filetype][:filetypeoptions]
 Select output type. Can be "ogg", "mp3", "flac", "spx" or "mpc". Specify a 
 comma-delimited list of output types to obtain all specified types. See 
-the OUTPUTTYPE configuration variable.
+the OUTPUTTYPE configuration variable. One can pass options to the encoder for
+a specific filetype on the command line separating them with a colon. The
+options must be escaped with double-quotes.
 .TP
 .B \-p
 Pads track numbers with 0\'s.
@@ -380,6 +382,25 @@ after all tracks have been read.
 If set to "y", some operations which are usually now shown to the end user
 are visible, such as CDDB queries. Usefull for initial debug and if your
 network/CDDB server is slow.
+.SH EXAMPLES
+Possible ways one can call abcdeƑ
+.TP
+.B abcde
+Will work in most systems
+.TP
+.B abcde -d /dev/cdrom2
+If the CDROM you are reding from is not the standard /dev/cdrom (in GNU/Linux systems)
+.TP
+.B abcde -o ogg,flac
+Will create both Ogg/Vorbis and Ogg/FLAC files.
+.TP
+.B abcde -o ogg:"-b 192"
+Will pass "-b 192" to the Ogg/Vorbis encoder, without having to modify the
+config file
+.TP
+.B abcde -W 1
+For double CDs settings: will create the 1st CD starting with the track number
+101, and will add a comment "CD 1" to the tracks
 .SH BACKEND TOOLS
 abcde requires the following backend tools to work:
 .TP